diff options
| author | Robin Voetter <robin@voetter.nl> | 2024-03-11 23:23:02 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2024-03-18 19:13:49 +0100 |
| commit | 20d7bb68ac7043e7d4ec8f0653ec73a1090187da (patch) | |
| tree | 54678146af0e606e2a243099e1f1c62749dbfd1f /src/codegen | |
| parent | e566158acf034105a43690501664c45b8a065f6a (diff) | |
| download | zig-20d7bb68ac7043e7d4ec8f0653ec73a1090187da.tar.gz zig-20d7bb68ac7043e7d4ec8f0653ec73a1090187da.zip | |
spirv: add zig-specific ext inst
This may be removed again in the future...
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv/extinst.zig.grammar.json | 13 | ||||
| -rw-r--r-- | src/codegen/spirv/spec.zig | 14 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/codegen/spirv/extinst.zig.grammar.json b/src/codegen/spirv/extinst.zig.grammar.json new file mode 100644 index 0000000000..70c290097e --- /dev/null +++ b/src/codegen/spirv/extinst.zig.grammar.json @@ -0,0 +1,13 @@ +{ + "version": 0, + "revision": 0, + "instructions": [ + { + "opname": "InvocationGlobal", + "opcode": 0, + "operands": [ + { "kind": "IdRef", "name": "initializer function" } + ] + } + ] +} diff --git a/src/codegen/spirv/spec.zig b/src/codegen/spirv/spec.zig index a3da5fa2f3..a0b3048961 100644 --- a/src/codegen/spirv/spec.zig +++ b/src/codegen/spirv/spec.zig @@ -102,6 +102,7 @@ pub const Class = enum { }; pub const OperandKind = enum { + Opcode, ImageOperands, FPFastMathMode, SelectionControl, @@ -187,6 +188,7 @@ pub const OperandKind = enum { pub fn category(self: OperandKind) OperandCategory { return switch (self) { + .Opcode => .literal, .ImageOperands => .bit_enum, .FPFastMathMode => .bit_enum, .SelectionControl => .bit_enum, @@ -273,6 +275,7 @@ pub const OperandKind = enum { } pub fn enumerants(self: OperandKind) []const Enumerant { return switch (self) { + .Opcode => unreachable, .ImageOperands => &[_]Enumerant{ .{ .name = "Bias", .value = 0x0001, .parameters = &[_]OperandKind{.IdRef} }, .{ .name = "Lod", .value = 0x0002, .parameters = &[_]OperandKind{.IdRef} }, @@ -2104,7 +2107,6 @@ pub const Opcode = enum(u16) { OpGroupLogicalXorKHR = 6408, OpMaskedGatherINTEL = 6428, OpMaskedScatterINTEL = 6429, - pub const OpSDotKHR = Opcode.OpSDot; pub const OpUDotKHR = Opcode.OpUDot; pub const OpSUDotKHR = Opcode.OpSUDot; @@ -5278,6 +5280,7 @@ pub const InstructionSet = enum { @"nonsemantic.debugprintf", @"spv-amd-shader-explicit-vertex-parameter", @"nonsemantic.debugbreak", + zig, pub fn instructions(self: InstructionSet) []const Instruction { return switch (self) { @@ -16505,6 +16508,15 @@ pub const InstructionSet = enum { .operands = &[_]Operand{}, }, }, + .zig => &[_]Instruction{ + .{ + .name = "InvocationGlobal", + .opcode = 0, + .operands = &[_]Operand{ + .{ .kind = .IdRef, .quantifier = .required }, + }, + }, + }, }; } }; |
