Skip to content

Commit 0971d79

Browse files
authored
Initial support for NonSemantic.Shader.DebugInfo 101 (#4220)
* Rename NonSemanticShaderDebugInfo100.h to NonSemanticShaderDebugInfo.h Drop the version number from the file name and all C identifiers No semantic change. * Add NonSemantic.Shader.DebugInfo.101 support - DebugTypeVectorIdEXT: emitted for OpTypeCooperativeVectorNV types whose component count is a SPIR-V Id rather than a literal. - DebugTypeCooperativeMatrixKHR: emitted for OpTypeCooperativeMatrixKHR types, replacing the former opaque-composite workaround. - Optional FPEncoding operand on DebugTypeBasic: identifies non-standard float formats (bfloat16, float8 E4M3, float8 E5M2). The NonSemantic.Shader.DebugInfo import string is only promoted to .101 when a version-101 opcode is actually emitted.
1 parent 39bfdd6 commit 0971d79

16 files changed

Lines changed: 844 additions & 1111 deletions

BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ template("glslang_sources_common") {
130130
"SPIRV/Logger.cpp",
131131
"SPIRV/Logger.h",
132132
"SPIRV/NonSemanticDebugPrintf.h",
133-
"SPIRV/NonSemanticShaderDebugInfo100.h",
133+
"SPIRV/NonSemanticShaderDebugInfo.h",
134134
"SPIRV/SpvBuilder.cpp",
135135
"SPIRV/SpvBuilder.h",
136136
"SPIRV/SpvPostProcess.cpp",

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,24 @@ bison --defines=MachineIndependent/glslang_tab.cpp.h
221221
The above command is also available in the bash script in `updateGrammar`,
222222
when executed from the glslang subdirectory of the glslang repository.
223223

224+
### If you need to update the NonSemantic instruction headers
225+
226+
`SPIRV/NonSemanticShaderDebugInfo.h` and `SPIRV/NonSemanticDebugPrintf.h` are
227+
local copies of the canonical headers from SPIRV-Headers. They are kept here
228+
because the SPIRV-Headers include path is not unconditionally available in all
229+
glslang build configurations (it is only present when `ENABLE_OPT` is on).
230+
231+
When SPIRV-Headers publishes a new version of either header, copy the updated
232+
file from
233+
234+
```
235+
External/spirv-tools/external/spirv-headers/include/spirv/unified1/
236+
```
237+
238+
over the corresponding file in `SPIRV/`. After copying, verify that the build
239+
still compiles and update the golden test output if instruction names or opcode
240+
numbers changed.
241+
224242
### Building to WASM for the Web and Node
225243
### Building a standalone JS/WASM library for the Web and Node
226244

SPIRV/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ set(SPIRV_HEADERS
6363
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.ext.ARM.h
6464
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.ext.QCOM.h
6565
${CMAKE_CURRENT_SOURCE_DIR}/NonSemanticDebugPrintf.h
66-
${CMAKE_CURRENT_SOURCE_DIR}/NonSemanticShaderDebugInfo100.h
66+
${CMAKE_CURRENT_SOURCE_DIR}/NonSemanticShaderDebugInfo.h
6767
PARENT_SCOPE)
6868

6969
set(PUBLIC_HEADERS

SPIRV/NonSemanticShaderDebugInfo.h

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
// Copyright (c) 2018 The Khronos Group Inc.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and/or associated documentation files (the "Materials"),
5+
// to deal in the Materials without restriction, including without limitation
6+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
// and/or sell copies of the Materials, and to permit persons to whom the
8+
// Materials are furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in
11+
// all copies or substantial portions of the Materials.
12+
//
13+
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
14+
// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
15+
// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
16+
//
17+
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20+
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+
// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
23+
// IN THE MATERIALS.
24+
25+
#ifndef SPIRV_UNIFIED1_NonSemanticShaderDebugInfo_H_
26+
#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo_H_
27+
28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
32+
enum {
33+
NonSemanticShaderDebugInfoVersion = 101,
34+
NonSemanticShaderDebugInfoVersion_BitWidthPadding = 0x7fffffff
35+
};
36+
enum {
37+
NonSemanticShaderDebugInfoRevision = 6,
38+
NonSemanticShaderDebugInfoRevision_BitWidthPadding = 0x7fffffff
39+
};
40+
41+
enum NonSemanticShaderDebugInfoInstructions {
42+
NonSemanticShaderDebugInfoDebugInfoNone = 0,
43+
NonSemanticShaderDebugInfoDebugCompilationUnit = 1,
44+
NonSemanticShaderDebugInfoDebugTypeBasic = 2,
45+
NonSemanticShaderDebugInfoDebugTypePointer = 3,
46+
NonSemanticShaderDebugInfoDebugTypeQualifier = 4,
47+
NonSemanticShaderDebugInfoDebugTypeArray = 5,
48+
NonSemanticShaderDebugInfoDebugTypeVector = 6,
49+
NonSemanticShaderDebugInfoDebugTypedef = 7,
50+
NonSemanticShaderDebugInfoDebugTypeFunction = 8,
51+
NonSemanticShaderDebugInfoDebugTypeEnum = 9,
52+
NonSemanticShaderDebugInfoDebugTypeComposite = 10,
53+
NonSemanticShaderDebugInfoDebugTypeMember = 11,
54+
NonSemanticShaderDebugInfoDebugTypeInheritance = 12,
55+
NonSemanticShaderDebugInfoDebugTypePtrToMember = 13,
56+
NonSemanticShaderDebugInfoDebugTypeTemplate = 14,
57+
NonSemanticShaderDebugInfoDebugTypeTemplateParameter = 15,
58+
NonSemanticShaderDebugInfoDebugTypeTemplateTemplateParameter = 16,
59+
NonSemanticShaderDebugInfoDebugTypeTemplateParameterPack = 17,
60+
NonSemanticShaderDebugInfoDebugGlobalVariable = 18,
61+
NonSemanticShaderDebugInfoDebugFunctionDeclaration = 19,
62+
NonSemanticShaderDebugInfoDebugFunction = 20,
63+
NonSemanticShaderDebugInfoDebugLexicalBlock = 21,
64+
NonSemanticShaderDebugInfoDebugLexicalBlockDiscriminator = 22,
65+
NonSemanticShaderDebugInfoDebugScope = 23,
66+
NonSemanticShaderDebugInfoDebugNoScope = 24,
67+
NonSemanticShaderDebugInfoDebugInlinedAt = 25,
68+
NonSemanticShaderDebugInfoDebugLocalVariable = 26,
69+
NonSemanticShaderDebugInfoDebugInlinedVariable = 27,
70+
NonSemanticShaderDebugInfoDebugDeclare = 28,
71+
NonSemanticShaderDebugInfoDebugValue = 29,
72+
NonSemanticShaderDebugInfoDebugOperation = 30,
73+
NonSemanticShaderDebugInfoDebugExpression = 31,
74+
NonSemanticShaderDebugInfoDebugMacroDef = 32,
75+
NonSemanticShaderDebugInfoDebugMacroUndef = 33,
76+
NonSemanticShaderDebugInfoDebugImportedEntity = 34,
77+
NonSemanticShaderDebugInfoDebugSource = 35,
78+
NonSemanticShaderDebugInfoDebugFunctionDefinition = 101,
79+
NonSemanticShaderDebugInfoDebugSourceContinued = 102,
80+
NonSemanticShaderDebugInfoDebugLine = 103,
81+
NonSemanticShaderDebugInfoDebugNoLine = 104,
82+
NonSemanticShaderDebugInfoDebugBuildIdentifier = 105,
83+
NonSemanticShaderDebugInfoDebugStoragePath = 106,
84+
NonSemanticShaderDebugInfoDebugEntryPoint = 107,
85+
NonSemanticShaderDebugInfoDebugTypeMatrix = 108,
86+
NonSemanticShaderDebugInfoDebugTypeVectorIdEXT = 109,
87+
NonSemanticShaderDebugInfoDebugTypeCooperativeMatrixKHR = 110,
88+
NonSemanticShaderDebugInfoInstructionsMax = 0x7fffffff
89+
};
90+
91+
92+
enum NonSemanticShaderDebugInfoDebugInfoFlags {
93+
NonSemanticShaderDebugInfoNone = 0x0000,
94+
NonSemanticShaderDebugInfoFlagIsProtected = 0x01,
95+
NonSemanticShaderDebugInfoFlagIsPrivate = 0x02,
96+
NonSemanticShaderDebugInfoFlagIsPublic = 0x03,
97+
NonSemanticShaderDebugInfoFlagIsLocal = 0x04,
98+
NonSemanticShaderDebugInfoFlagIsDefinition = 0x08,
99+
NonSemanticShaderDebugInfoFlagFwdDecl = 0x10,
100+
NonSemanticShaderDebugInfoFlagArtificial = 0x20,
101+
NonSemanticShaderDebugInfoFlagExplicit = 0x40,
102+
NonSemanticShaderDebugInfoFlagPrototyped = 0x80,
103+
NonSemanticShaderDebugInfoFlagObjectPointer = 0x100,
104+
NonSemanticShaderDebugInfoFlagStaticMember = 0x200,
105+
NonSemanticShaderDebugInfoFlagIndirectVariable = 0x400,
106+
NonSemanticShaderDebugInfoFlagLValueReference = 0x800,
107+
NonSemanticShaderDebugInfoFlagRValueReference = 0x1000,
108+
NonSemanticShaderDebugInfoFlagIsOptimized = 0x2000,
109+
NonSemanticShaderDebugInfoFlagIsEnumClass = 0x4000,
110+
NonSemanticShaderDebugInfoFlagTypePassByValue = 0x8000,
111+
NonSemanticShaderDebugInfoFlagTypePassByReference = 0x10000,
112+
NonSemanticShaderDebugInfoFlagUnknownPhysicalLayout = 0x20000,
113+
NonSemanticShaderDebugInfoDebugInfoFlagsMax = 0x7fffffff
114+
};
115+
116+
enum NonSemanticShaderDebugInfoBuildIdentifierFlags {
117+
NonSemanticShaderDebugInfoIdentifierPossibleDuplicates = 0x01,
118+
NonSemanticShaderDebugInfoBuildIdentifierFlagsMax = 0x7fffffff
119+
};
120+
121+
enum NonSemanticShaderDebugInfoDebugBaseTypeAttributeEncoding {
122+
NonSemanticShaderDebugInfoUnspecified = 0,
123+
NonSemanticShaderDebugInfoAddress = 1,
124+
NonSemanticShaderDebugInfoBoolean = 2,
125+
NonSemanticShaderDebugInfoFloat = 3,
126+
NonSemanticShaderDebugInfoSigned = 4,
127+
NonSemanticShaderDebugInfoSignedChar = 5,
128+
NonSemanticShaderDebugInfoUnsigned = 6,
129+
NonSemanticShaderDebugInfoUnsignedChar = 7,
130+
NonSemanticShaderDebugInfoDebugBaseTypeAttributeEncodingMax = 0x7fffffff
131+
};
132+
133+
enum NonSemanticShaderDebugInfoDebugCompositeType {
134+
NonSemanticShaderDebugInfoClass = 0,
135+
NonSemanticShaderDebugInfoStructure = 1,
136+
NonSemanticShaderDebugInfoUnion = 2,
137+
NonSemanticShaderDebugInfoDebugCompositeTypeMax = 0x7fffffff
138+
};
139+
140+
enum NonSemanticShaderDebugInfoDebugTypeQualifier {
141+
NonSemanticShaderDebugInfoConstType = 0,
142+
NonSemanticShaderDebugInfoVolatileType = 1,
143+
NonSemanticShaderDebugInfoRestrictType = 2,
144+
NonSemanticShaderDebugInfoAtomicType = 3,
145+
NonSemanticShaderDebugInfoDebugTypeQualifierMax = 0x7fffffff
146+
};
147+
148+
enum NonSemanticShaderDebugInfoDebugOperation {
149+
NonSemanticShaderDebugInfoDeref = 0,
150+
NonSemanticShaderDebugInfoPlus = 1,
151+
NonSemanticShaderDebugInfoMinus = 2,
152+
NonSemanticShaderDebugInfoPlusUconst = 3,
153+
NonSemanticShaderDebugInfoBitPiece = 4,
154+
NonSemanticShaderDebugInfoSwap = 5,
155+
NonSemanticShaderDebugInfoXderef = 6,
156+
NonSemanticShaderDebugInfoStackValue = 7,
157+
NonSemanticShaderDebugInfoConstu = 8,
158+
NonSemanticShaderDebugInfoFragment = 9,
159+
NonSemanticShaderDebugInfoDebugOperationMax = 0x7fffffff
160+
};
161+
162+
enum NonSemanticShaderDebugInfoDebugImportedEntity {
163+
NonSemanticShaderDebugInfoImportedModule = 0,
164+
NonSemanticShaderDebugInfoImportedDeclaration = 1,
165+
NonSemanticShaderDebugInfoDebugImportedEntityMax = 0x7fffffff
166+
};
167+
168+
169+
#ifdef __cplusplus
170+
}
171+
#endif
172+
173+
#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo_H_

SPIRV/NonSemanticShaderDebugInfo100.h

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)