authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2026-10-14 11:29:05+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2026-10-23 09:18:03+03:30
log94ba9ff797fdc59f4f5b7e927245c3fe613c2f73
tree6c5f7efef455ec46a4215d181b7ab69fc791d7f8
parent2bbac862018599c121281f2ca5658f3879c0c0a3

spirv: generate debug info spec


3 files changed, 263 insertions(+), 7 deletions(-)

src/codegen/spirv/Section.zig+14-7
......@@ -31,7 +31,7 @@ pub fn fromWords(gpa: Allocator, words: []const Word, id_bound: Word) Error!Sect
3131 const type_widths = try gpa.alloc(u16, id_bound);
3232 defer gpa.free(type_widths);
3333 @memset(type_widths, 0);
34 var instruction_sets: std.array_hash_map.Auto(Word, spec.InstructionSet) = .empty;
34 var instruction_sets: std.array_hash_map.Auto(Word, ?spec.InstructionSet) = .empty;
3535 defer instruction_sets.deinit(gpa);
3636 var results: std.bit_set.Dynamic = try .initEmpty(gpa, id_bound);
3737 defer results.deinit(gpa);
......@@ -48,18 +48,18 @@ pub fn fromWords(gpa: Allocator, words: []const Word, id_bound: Word) Error!Sect
4848 return error.UnknownOpcode;
4949 const end = offset + len;
5050 var index = offset + 1;
51 const list: []const spec.Operand = switch (op) {
52 .OpFunction => list: {
51 const list: []const spec.Operand = list: switch (op) {
52 .OpFunction => {
5353 if (in_function) return error.NestedFunction;
5454 in_function = true;
5555 break :list op.operands();
5656 },
57 .OpFunctionEnd => list: {
57 .OpFunctionEnd => {
5858 if (!in_function) return error.InvalidInstruction;
5959 in_function = false;
6060 break :list op.operands();
6161 },
62 .OpSpecConstantOp => list: {
62 .OpSpecConstantOp => {
6363 const prefix = op.operands()[0..2];
6464 index = try section.parseOperands(type_widths, offset, end, prefix, index);
6565 if (index >= end) return error.InvalidInstruction;
......@@ -68,9 +68,14 @@ pub fn fromWords(gpa: Allocator, words: []const Word, id_bound: Word) Error!Sect
6868 index += 1;
6969 break :list inner.operands()[2..];
7070 },
71 .OpExtInst => list: {
71 .OpExtInst => {
7272 if (len < 5) return error.InvalidInstruction;
73 const set = instruction_sets.get(inst[3]) orelse return error.InvalidInstruction;
73 const maybe_set = instruction_sets.get(inst[3]) orelse return error.InvalidInstruction;
74 const set = maybe_set orelse {
75 const prefix = op.operands()[0..4];
76 index = try section.parseOperands(type_widths, offset, end, prefix, index);
77 break :list &.{.{ .kind = .id_ref, .quantifier = .variadic }};
78 };
7479 const prefix = op.operands()[0..4];
7580 index = try section.parseOperands(type_widths, offset, end, prefix, index);
7681 break :list set.operands(inst[4]) orelse return error.InvalidInstruction;
......@@ -93,6 +98,8 @@ pub fn fromWords(gpa: Allocator, words: []const Word, id_bound: Word) Error!Sect
9398 const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(inst[2..]), 0);
9499 if (std.meta.stringToEnum(spec.InstructionSet, set_name)) |set| {
95100 if (set != .core) try instruction_sets.put(gpa, inst[1], set);
101 } else if (std.mem.startsWith(u8, set_name, "NonSemantic.")) {
102 try instruction_sets.put(gpa, inst[1], null);
96103 }
97104 },
98105 else => if (op.resultIndex() == 2) {
src/codegen/spirv/spec.zig+248
......@@ -190,6 +190,13 @@ pub const OperandKind = enum {
190190 pair_id_ref_literal_integer,
191191 pair_id_ref_id_ref,
192192 tensor_operands,
193 non_semantic_shader_debug_info_100_debug_info_flags,
194 non_semantic_shader_debug_info_100_build_identifier_flags,
195 non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding,
196 non_semantic_shader_debug_info_100_debug_composite_type,
197 non_semantic_shader_debug_info_100_debug_type_qualifier,
198 non_semantic_shader_debug_info_100_debug_operation,
199 non_semantic_shader_debug_info_100_debug_imported_entity,
193200
194201 pub fn category(operand_kind: OperandKind) OperandCategory {
195202 return switch (operand_kind) {
......@@ -265,6 +272,13 @@ pub const OperandKind = enum {
265272 .pair_id_ref_literal_integer => .composite,
266273 .pair_id_ref_id_ref => .composite,
267274 .tensor_operands => .bit_enum,
275 .non_semantic_shader_debug_info_100_debug_info_flags => .bit_enum,
276 .non_semantic_shader_debug_info_100_build_identifier_flags => .bit_enum,
277 .non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding => .value_enum,
278 .non_semantic_shader_debug_info_100_debug_composite_type => .value_enum,
279 .non_semantic_shader_debug_info_100_debug_type_qualifier => .value_enum,
280 .non_semantic_shader_debug_info_100_debug_operation => .value_enum,
281 .non_semantic_shader_debug_info_100_debug_imported_entity => .value_enum,
268282 };
269283 }
270284 pub fn enumerants(operand_kind: OperandKind) []const Enumerant {
......@@ -1112,6 +1126,67 @@ pub const OperandKind = enum {
11121126 .pair_id_ref_literal_integer => unreachable,
11131127 .pair_id_ref_id_ref => unreachable,
11141128 .tensor_operands => &.{},
1129 .non_semantic_shader_debug_info_100_debug_info_flags => &.{
1130 .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &.{} },
1131 .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &.{} },
1132 .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &.{} },
1133 .{ .name = "FlagIsLocal", .value = 0x04, .parameters = &.{} },
1134 .{ .name = "FlagIsDefinition", .value = 0x08, .parameters = &.{} },
1135 .{ .name = "FlagFwdDecl", .value = 0x10, .parameters = &.{} },
1136 .{ .name = "FlagArtificial", .value = 0x20, .parameters = &.{} },
1137 .{ .name = "FlagExplicit", .value = 0x40, .parameters = &.{} },
1138 .{ .name = "FlagPrototyped", .value = 0x80, .parameters = &.{} },
1139 .{ .name = "FlagObjectPointer", .value = 0x100, .parameters = &.{} },
1140 .{ .name = "FlagStaticMember", .value = 0x200, .parameters = &.{} },
1141 .{ .name = "FlagIndirectVariable", .value = 0x400, .parameters = &.{} },
1142 .{ .name = "FlagLValueReference", .value = 0x800, .parameters = &.{} },
1143 .{ .name = "FlagRValueReference", .value = 0x1000, .parameters = &.{} },
1144 .{ .name = "FlagIsOptimized", .value = 0x2000, .parameters = &.{} },
1145 .{ .name = "FlagIsEnumClass", .value = 0x4000, .parameters = &.{} },
1146 .{ .name = "FlagTypePassByValue", .value = 0x8000, .parameters = &.{} },
1147 .{ .name = "FlagTypePassByReference", .value = 0x10000, .parameters = &.{} },
1148 .{ .name = "FlagUnknownPhysicalLayout", .value = 0x20000, .parameters = &.{} },
1149 },
1150 .non_semantic_shader_debug_info_100_build_identifier_flags => &.{
1151 .{ .name = "IdentifierPossibleDuplicates", .value = 0x01, .parameters = &.{} },
1152 },
1153 .non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding => &.{
1154 .{ .name = "Unspecified", .value = 0, .parameters = &.{} },
1155 .{ .name = "Address", .value = 1, .parameters = &.{} },
1156 .{ .name = "Boolean", .value = 2, .parameters = &.{} },
1157 .{ .name = "Float", .value = 3, .parameters = &.{} },
1158 .{ .name = "Signed", .value = 4, .parameters = &.{} },
1159 .{ .name = "SignedChar", .value = 5, .parameters = &.{} },
1160 .{ .name = "Unsigned", .value = 6, .parameters = &.{} },
1161 .{ .name = "UnsignedChar", .value = 7, .parameters = &.{} },
1162 },
1163 .non_semantic_shader_debug_info_100_debug_composite_type => &.{
1164 .{ .name = "Class", .value = 0, .parameters = &.{} },
1165 .{ .name = "Structure", .value = 1, .parameters = &.{} },
1166 .{ .name = "Union", .value = 2, .parameters = &.{} },
1167 },
1168 .non_semantic_shader_debug_info_100_debug_type_qualifier => &.{
1169 .{ .name = "ConstType", .value = 0, .parameters = &.{} },
1170 .{ .name = "VolatileType", .value = 1, .parameters = &.{} },
1171 .{ .name = "RestrictType", .value = 2, .parameters = &.{} },
1172 .{ .name = "AtomicType", .value = 3, .parameters = &.{} },
1173 },
1174 .non_semantic_shader_debug_info_100_debug_operation => &.{
1175 .{ .name = "Deref", .value = 0, .parameters = &.{} },
1176 .{ .name = "Plus", .value = 1, .parameters = &.{} },
1177 .{ .name = "Minus", .value = 2, .parameters = &.{} },
1178 .{ .name = "PlusUconst", .value = 3, .parameters = &.{.{ .kind = .id_ref }} },
1179 .{ .name = "BitPiece", .value = 4, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } } },
1180 .{ .name = "Swap", .value = 5, .parameters = &.{} },
1181 .{ .name = "Xderef", .value = 6, .parameters = &.{} },
1182 .{ .name = "StackValue", .value = 7, .parameters = &.{} },
1183 .{ .name = "Constu", .value = 8, .parameters = &.{.{ .kind = .id_ref }} },
1184 .{ .name = "Fragment", .value = 9, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } } },
1185 },
1186 .non_semantic_shader_debug_info_100_debug_imported_entity => &.{
1187 .{ .name = "ImportedModule", .value = 0, .parameters = &.{} },
1188 .{ .name = "ImportedDeclaration", .value = 1, .parameters = &.{} },
1189 },
11151190 };
11161191 }
11171192
......@@ -3256,6 +3331,102 @@ pub const GlslOpcode = enum(u16) {
32563331 };
32573332 }
32583333};
3334
3335pub const ShaderDebugInfoOpCode = enum(u16) {
3336 DebugInfoNone = 0,
3337 DebugCompilationUnit = 1,
3338 DebugTypeBasic = 2,
3339 DebugTypePointer = 3,
3340 DebugTypeQualifier = 4,
3341 DebugTypeArray = 5,
3342 DebugTypeVector = 6,
3343 DebugTypedef = 7,
3344 DebugTypeFunction = 8,
3345 DebugTypeEnum = 9,
3346 DebugTypeComposite = 10,
3347 DebugTypeMember = 11,
3348 DebugTypeInheritance = 12,
3349 DebugTypePtrToMember = 13,
3350 DebugTypeTemplate = 14,
3351 DebugTypeTemplateParameter = 15,
3352 DebugTypeTemplateTemplateParameter = 16,
3353 DebugTypeTemplateParameterPack = 17,
3354 DebugGlobalVariable = 18,
3355 DebugFunctionDeclaration = 19,
3356 DebugFunction = 20,
3357 DebugLexicalBlock = 21,
3358 DebugLexicalBlockDiscriminator = 22,
3359 DebugScope = 23,
3360 DebugNoScope = 24,
3361 DebugInlinedAt = 25,
3362 DebugLocalVariable = 26,
3363 DebugInlinedVariable = 27,
3364 DebugDeclare = 28,
3365 DebugValue = 29,
3366 DebugOperation = 30,
3367 DebugExpression = 31,
3368 DebugMacroDef = 32,
3369 DebugMacroUndef = 33,
3370 DebugImportedEntity = 34,
3371 DebugSource = 35,
3372 DebugFunctionDefinition = 101,
3373 DebugSourceContinued = 102,
3374 DebugLine = 103,
3375 DebugNoLine = 104,
3376 DebugBuildIdentifier = 105,
3377 DebugStoragePath = 106,
3378 DebugEntryPoint = 107,
3379 DebugTypeMatrix = 108,
3380
3381 pub fn operands(opcode: ShaderDebugInfoOpCode) []const Operand {
3382 return switch (opcode) {
3383 .DebugInfoNone => &.{},
3384 .DebugCompilationUnit => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3385 .DebugTypeBasic => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3386 .DebugTypePointer => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3387 .DebugTypeQualifier => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3388 .DebugTypeArray => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3389 .DebugTypeVector => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3390 .DebugTypedef => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3391 .DebugTypeFunction => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3392 .DebugTypeEnum => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic } },
3393 .DebugTypeComposite => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3394 .DebugTypeMember => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3395 .DebugTypeInheritance => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3396 .DebugTypePtrToMember => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3397 .DebugTypeTemplate => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3398 .DebugTypeTemplateParameter => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3399 .DebugTypeTemplateTemplateParameter => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3400 .DebugTypeTemplateParameterPack => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3401 .DebugGlobalVariable => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3402 .DebugFunctionDeclaration => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3403 .DebugFunction => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3404 .DebugLexicalBlock => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3405 .DebugLexicalBlockDiscriminator => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3406 .DebugScope => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3407 .DebugNoScope => &.{},
3408 .DebugInlinedAt => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3409 .DebugLocalVariable => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3410 .DebugInlinedVariable => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3411 .DebugDeclare => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3412 .DebugValue => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3413 .DebugOperation => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } },
3414 .DebugExpression => &.{.{ .kind = .id_ref, .quantifier = .variadic }},
3415 .DebugMacroDef => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3416 .DebugMacroUndef => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3417 .DebugImportedEntity => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3418 .DebugSource => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } },
3419 .DebugFunctionDefinition => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3420 .DebugSourceContinued => &.{.{ .kind = .id_ref }},
3421 .DebugLine => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3422 .DebugNoLine => &.{},
3423 .DebugBuildIdentifier => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3424 .DebugStoragePath => &.{.{ .kind = .id_ref }},
3425 .DebugEntryPoint => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3426 .DebugTypeMatrix => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } },
3427 };
3428 }
3429};
32593430pub const ImageOperands = packed struct(Word) {
32603431 bias: bool = false,
32613432 lod: bool = false,
......@@ -4460,16 +4631,93 @@ pub const ComponentType = enum(u32) {
44604631pub const TensorOperands = packed struct(Word) {
44614632 _reserved_bits_0_to_31: u32 = 0,
44624633};
4634pub const @"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags" = packed struct(Word) {
4635 flag_is_protected: bool = false,
4636 flag_is_private: bool = false,
4637 flag_is_local: bool = false,
4638 flag_is_definition: bool = false,
4639 flag_fwd_decl: bool = false,
4640 flag_artificial: bool = false,
4641 flag_explicit: bool = false,
4642 flag_prototyped: bool = false,
4643 flag_object_pointer: bool = false,
4644 flag_static_member: bool = false,
4645 flag_indirect_variable: bool = false,
4646 flag_l_value_reference: bool = false,
4647 flag_r_value_reference: bool = false,
4648 flag_is_optimized: bool = false,
4649 flag_is_enum_class: bool = false,
4650 flag_type_pass_by_value: bool = false,
4651 flag_type_pass_by_reference: bool = false,
4652 flag_unknown_physical_layout: bool = false,
4653 _reserved_bits_18_to_31: u14 = 0,
4654};
4655pub const @"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags" = packed struct(Word) {
4656 identifier_possible_duplicates: bool = false,
4657 _reserved_bits_1_to_31: u31 = 0,
4658};
4659pub const @"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) {
4660 unspecified = 0,
4661 address = 1,
4662 boolean = 2,
4663 float = 3,
4664 signed = 4,
4665 signed_char = 5,
4666 unsigned = 6,
4667 unsigned_char = 7,
4668};
4669pub const @"NonSemantic.Shader.DebugInfo.100.DebugCompositeType" = enum(u32) {
4670 class = 0,
4671 structure = 1,
4672 @"union" = 2,
4673};
4674pub const @"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier" = enum(u32) {
4675 const_type = 0,
4676 volatile_type = 1,
4677 restrict_type = 2,
4678 atomic_type = 3,
4679};
4680pub const @"NonSemantic.Shader.DebugInfo.100.DebugOperation" = enum(u32) {
4681 deref = 0,
4682 plus = 1,
4683 minus = 2,
4684 plus_uconst = 3,
4685 bit_piece = 4,
4686 swap = 5,
4687 xderef = 6,
4688 stack_value = 7,
4689 constu = 8,
4690 fragment = 9,
4691
4692 pub const Extended = union(@"NonSemantic.Shader.DebugInfo.100.DebugOperation") {
4693 deref,
4694 plus,
4695 minus,
4696 plus_uconst: struct { id_ref: Id },
4697 bit_piece: struct { id_ref_0: Id, id_ref_1: Id },
4698 swap,
4699 xderef,
4700 stack_value,
4701 constu: struct { id_ref: Id },
4702 fragment: struct { id_ref_0: Id, id_ref_1: Id },
4703 };
4704};
4705pub const @"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity" = enum(u32) {
4706 imported_module = 0,
4707 imported_declaration = 1,
4708};
44634709pub const InstructionSet = enum {
44644710 core,
44654711 @"OpenCL.std",
44664712 @"GLSL.std.450",
4713 @"NonSemantic.Shader.DebugInfo.100",
44674714
44684715 pub fn operands(inst_set: InstructionSet, opcode: Word) ?[]const Operand {
44694716 return switch (inst_set) {
44704717 .core => if (std.enums.fromInt(Opcode, opcode)) |op| op.operands() else null,
44714718 .@"OpenCL.std" => if (std.enums.fromInt(OpenClOpcode, opcode)) |op| op.operands() else null,
44724719 .@"GLSL.std.450" => if (std.enums.fromInt(GlslOpcode, opcode)) |op| op.operands() else null,
4720 .@"NonSemantic.Shader.DebugInfo.100" => if (std.enums.fromInt(ShaderDebugInfoOpCode, opcode)) |op| op.operands() else null,
44734721 };
44744722 }
44754723};
tools/gen_spirv_spec.zig+1
......@@ -15,6 +15,7 @@ const allowed_vendors = [_][]const u8{ "KHR", "EXT" };
1515const set_names = std.StaticStringMap(struct { []const u8, []const u8 }).initComptime(.{
1616 .{ "opencl.std.100", .{ "OpenCL.std", "OpenClOpcode" } },
1717 .{ "glsl.std.450", .{ "GLSL.std.450", "GlslOpcode" } },
18 .{ "nonsemantic.shader.debuginfo.100", .{ "NonSemantic.Shader.DebugInfo.100", "ShaderDebugInfoOpCode" } },
1819});
1920
2021const Extension = struct {