diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-04-08 19:05:48 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-04-09 01:51:55 +0200 |
| commit | 979b4102588fbb0d066060a5a6b6e10f584158ac (patch) | |
| tree | 6748c0fa79b9251eda4dc456b89efa8dab8c770f /src/codegen/spirv/Module.zig | |
| parent | a7563e453dce0cc256a0c40af434731f2cf7dcaf (diff) | |
| download | zig-979b4102588fbb0d066060a5a6b6e10f584158ac.tar.gz zig-979b4102588fbb0d066060a5a6b6e10f584158ac.zip | |
spirv: Do not generate the Alignment attribute on pointers for now
It seems that some implementations may have problems with these right now,
like Intel and Rusticl. In theory, these attributes should be superficial
on the pointer type, as alignment guarantees are also added via the
alignment option of the OpLoad and OpStore instructions. Therefore, get rid
of them for now.
Diffstat (limited to 'src/codegen/spirv/Module.zig')
| -rw-r--r-- | src/codegen/spirv/Module.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index f7d392e9e3..7ae6cb0c6a 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -573,8 +573,8 @@ pub fn emitType(self: *Module, ty: Type) error{OutOfMemory}!IdResultType { if (info.array_stride != 0) { try self.decorate(ref_id, .{ .ArrayStride = .{ .array_stride = info.array_stride } }); } - if (info.alignment) |alignment| { - try self.decorate(ref_id, .{ .Alignment = .{ .alignment = alignment } }); + if (info.alignment != 0) { + try self.decorate(ref_id, .{ .Alignment = .{ .alignment = info.alignment } }); } if (info.max_byte_offset) |max_byte_offset| { try self.decorate(ref_id, .{ .MaxByteOffset = .{ .max_byte_offset = max_byte_offset } }); @@ -753,7 +753,7 @@ pub fn ptrType( self: *Module, child: Type.Ref, storage_class: spec.StorageClass, - alignment: ?u32, + alignment: u32, ) !Type.Ref { const ptr_payload = try self.arena.create(Type.Payload.Pointer); ptr_payload.* = .{ |
