authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-02-24 18:39:06+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-02-24 19:48:34+02:00
logcbd5d6c704c03177be90a891fc8fd48e6966487b
treeee003f8eee14eddf58fbda75eff629e59825cad0
parentb034c45b2bcb3a28ad260037dfa34c40b6c9313b

spirv spec: do not align packed struct fields


2 files changed, 11 insertions(+), 15 deletions(-)

src/codegen/spirv/spec.zig+10-10
...@@ -1206,7 +1206,7 @@ pub const Opcode = enum(u16) {...@@ -1206,7 +1206,7 @@ pub const Opcode = enum(u16) {
1206 }1206 }
1207};1207};
1208pub const ImageOperands = packed struct {1208pub const ImageOperands = packed struct {
1209 Bias: bool align(@alignOf(u32)) = false,1209 Bias: bool = false,
1210 Lod: bool = false,1210 Lod: bool = false,
1211 Grad: bool = false,1211 Grad: bool = false,
1212 ConstOffset: bool = false,1212 ConstOffset: bool = false,
...@@ -1280,7 +1280,7 @@ pub const ImageOperands = packed struct {...@@ -1280,7 +1280,7 @@ pub const ImageOperands = packed struct {
1280 };1280 };
1281};1281};
1282pub const FPFastMathMode = packed struct {1282pub const FPFastMathMode = packed struct {
1283 NotNaN: bool align(@alignOf(u32)) = false,1283 NotNaN: bool = false,
1284 NotInf: bool = false,1284 NotInf: bool = false,
1285 NSZ: bool = false,1285 NSZ: bool = false,
1286 AllowRecip: bool = false,1286 AllowRecip: bool = false,
...@@ -1314,7 +1314,7 @@ pub const FPFastMathMode = packed struct {...@@ -1314,7 +1314,7 @@ pub const FPFastMathMode = packed struct {
1314 _reserved_bit_31: bool = false,1314 _reserved_bit_31: bool = false,
1315};1315};
1316pub const SelectionControl = packed struct {1316pub const SelectionControl = packed struct {
1317 Flatten: bool align(@alignOf(u32)) = false,1317 Flatten: bool = false,
1318 DontFlatten: bool = false,1318 DontFlatten: bool = false,
1319 _reserved_bit_2: bool = false,1319 _reserved_bit_2: bool = false,
1320 _reserved_bit_3: bool = false,1320 _reserved_bit_3: bool = false,
...@@ -1348,7 +1348,7 @@ pub const SelectionControl = packed struct {...@@ -1348,7 +1348,7 @@ pub const SelectionControl = packed struct {
1348 _reserved_bit_31: bool = false,1348 _reserved_bit_31: bool = false,
1349};1349};
1350pub const LoopControl = packed struct {1350pub const LoopControl = packed struct {
1351 Unroll: bool align(@alignOf(u32)) = false,1351 Unroll: bool = false,
1352 DontUnroll: bool = false,1352 DontUnroll: bool = false,
1353 DependencyInfinite: bool = false,1353 DependencyInfinite: bool = false,
1354 DependencyLength: bool = false,1354 DependencyLength: bool = false,
...@@ -1417,7 +1417,7 @@ pub const LoopControl = packed struct {...@@ -1417,7 +1417,7 @@ pub const LoopControl = packed struct {
1417 };1417 };
1418};1418};
1419pub const FunctionControl = packed struct {1419pub const FunctionControl = packed struct {
1420 Inline: bool align(@alignOf(u32)) = false,1420 Inline: bool = false,
1421 DontInline: bool = false,1421 DontInline: bool = false,
1422 Pure: bool = false,1422 Pure: bool = false,
1423 Const: bool = false,1423 Const: bool = false,
...@@ -1451,7 +1451,7 @@ pub const FunctionControl = packed struct {...@@ -1451,7 +1451,7 @@ pub const FunctionControl = packed struct {
1451 _reserved_bit_31: bool = false,1451 _reserved_bit_31: bool = false,
1452};1452};
1453pub const MemorySemantics = packed struct {1453pub const MemorySemantics = packed struct {
1454 _reserved_bit_0: bool align(@alignOf(u32)) = false,1454 _reserved_bit_0: bool = false,
1455 Acquire: bool = false,1455 Acquire: bool = false,
1456 Release: bool = false,1456 Release: bool = false,
1457 AcquireRelease: bool = false,1457 AcquireRelease: bool = false,
...@@ -1489,7 +1489,7 @@ pub const MemorySemantics = packed struct {...@@ -1489,7 +1489,7 @@ pub const MemorySemantics = packed struct {
1489 pub const MakeVisibleKHR: MemorySemantics = .{ .MakeVisible = true };1489 pub const MakeVisibleKHR: MemorySemantics = .{ .MakeVisible = true };
1490};1490};
1491pub const MemoryAccess = packed struct {1491pub const MemoryAccess = packed struct {
1492 Volatile: bool align(@alignOf(u32)) = false,1492 Volatile: bool = false,
1493 Aligned: bool = false,1493 Aligned: bool = false,
1494 Nontemporal: bool = false,1494 Nontemporal: bool = false,
1495 MakePointerAvailable: bool = false,1495 MakePointerAvailable: bool = false,
...@@ -1562,7 +1562,7 @@ pub const MemoryAccess = packed struct {...@@ -1562,7 +1562,7 @@ pub const MemoryAccess = packed struct {
1562 };1562 };
1563};1563};
1564pub const KernelProfilingInfo = packed struct {1564pub const KernelProfilingInfo = packed struct {
1565 CmdExecTime: bool align(@alignOf(u32)) = false,1565 CmdExecTime: bool = false,
1566 _reserved_bit_1: bool = false,1566 _reserved_bit_1: bool = false,
1567 _reserved_bit_2: bool = false,1567 _reserved_bit_2: bool = false,
1568 _reserved_bit_3: bool = false,1568 _reserved_bit_3: bool = false,
...@@ -1596,7 +1596,7 @@ pub const KernelProfilingInfo = packed struct {...@@ -1596,7 +1596,7 @@ pub const KernelProfilingInfo = packed struct {
1596 _reserved_bit_31: bool = false,1596 _reserved_bit_31: bool = false,
1597};1597};
1598pub const RayFlags = packed struct {1598pub const RayFlags = packed struct {
1599 OpaqueKHR: bool align(@alignOf(u32)) = false,1599 OpaqueKHR: bool = false,
1600 NoOpaqueKHR: bool = false,1600 NoOpaqueKHR: bool = false,
1601 TerminateOnFirstHitKHR: bool = false,1601 TerminateOnFirstHitKHR: bool = false,
1602 SkipClosestHitShaderKHR: bool = false,1602 SkipClosestHitShaderKHR: bool = false,
...@@ -1630,7 +1630,7 @@ pub const RayFlags = packed struct {...@@ -1630,7 +1630,7 @@ pub const RayFlags = packed struct {
1630 _reserved_bit_31: bool = false,1630 _reserved_bit_31: bool = false,
1631};1631};
1632pub const FragmentShadingRate = packed struct {1632pub const FragmentShadingRate = packed struct {
1633 Vertical2Pixels: bool align(@alignOf(u32)) = false,1633 Vertical2Pixels: bool = false,
1634 Vertical4Pixels: bool = false,1634 Vertical4Pixels: bool = false,
1635 Horizontal2Pixels: bool = false,1635 Horizontal2Pixels: bool = false,
1636 Horizontal4Pixels: bool = false,1636 Horizontal4Pixels: bool = false,
tools/gen_spirv_spec.zig+1-5
...@@ -329,11 +329,7 @@ fn renderBitEnum(...@@ -329,11 +329,7 @@ fn renderBitEnum(
329 try writer.print("_reserved_bit_{}", .{bitpos});329 try writer.print("_reserved_bit_{}", .{bitpos});
330 }330 }
331331
332 try writer.writeAll(": bool ");332 try writer.writeAll(": bool = false,\n");
333 if (bitpos == 0) { // Force alignment to integer boundaries
334 try writer.writeAll("align(@alignOf(u32)) ");
335 }
336 try writer.writeAll("= false,\n");
337 }333 }
338334
339 try writer.writeByte('\n');335 try writer.writeByte('\n');