• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef DIXL_ENUMS_H
25 #define DIXL_ENUMS_H
26 
27 enum dxil_signature_kind {
28    DXIL_SIG_INVALID = 0,
29    DXIL_SIG_INPUT,
30    DXIL_SIG_OUTPUT,
31    DXIL_SIG_PATCH_CONST_OR_PRIM
32 };
33 
34 /* These enums are taken from
35  * DirectXShaderCompiler/lib/dxc/DXIL/DxilConstants.h
36  */
37 enum dxil_semantic_kind {
38   DXIL_SEM_ARBITRARY,
39   DXIL_SEM_VERTEX_ID,
40   DXIL_SEM_INSTANCE_ID,
41   DXIL_SEM_POSITION,
42   DXIL_SEM_RENDERTARGET_ARRAY_INDEX,
43   DXIL_SEM_VIEWPORT_ARRAY_INDEX,
44   DXIL_SEM_CLIP_DISTANCE,
45   DXIL_SEM_CULL_DISTANCE,
46   DXIL_SEM_OUTPUT_CONTROL_POINT_ID,
47   DXIL_SEM_DOMAIN_LOCATION,
48   DXIL_SEM_PRIMITIVE_ID,
49   DXIL_SEM_GS_INSTANCE_ID,
50   DXIL_SEM_SAMPLE_INDEX,
51   DXIL_SEM_IS_FRONT_FACE,
52   DXIL_SEM_COVERAGE,
53   DXIL_SEM_INNER_COVERAGE,
54   DXIL_SEM_TARGET,
55   DXIL_SEM_DEPTH,
56   DXIL_SEM_DEPTH_LE,
57   DXIL_SEM_DEPTH_GE,
58   DXIL_SEM_STENCIL_REF,
59   DXIL_SEM_DISPATCH_THREAD_ID,
60   DXIL_SEM_GROUP_ID,
61   DXIL_SEM_GROUP_INDEX,
62   DXIL_SEM_GROUP_THREAD_ID,
63   DXIL_SEM_TESS_FACTOR,
64   DXIL_SEM_INSIDE_TESS_FACTOR,
65   DXIL_SEM_VIEW_ID,
66   DXIL_SEM_BARYCENTRICS,
67   DXIL_SEM_SHADING_RATE,
68   DXIL_SEM_CULL_PRIMITIVE,
69   DXIL_SEM_INVALID
70 };
71 
72 enum dxil_prog_sig_semantic {
73    DXIL_PROG_SEM_UNDEFINED = 0,
74    DXIL_PROG_SEM_POSITION = 1,
75    DXIL_PROG_SEM_CLIP_DISTANCE = 2,
76    DXIL_PROG_SEM_CULL_DISTANCE = 3,
77    DXIL_PROG_SEM_RENDERTARGET_ARRAY_INDEX = 4,
78    DXIL_PROG_SEM_VIEWPORT_ARRAY_INDEX = 5,
79    DXIL_PROG_SEM_VERTEX_ID = 6,
80    DXIL_PROG_SEM_PRIMITIVE_ID = 7,
81    DXIL_PROG_SEM_INSTANCE_ID = 8,
82    DXIL_PROG_SEM_IS_FRONTFACE = 9,
83    DXIL_PROG_SEM_SAMPLE_INDEX = 10,
84    DXIL_PROG_SEM_FINAL_QUAD_EDGE_TESSFACTOR = 11,
85    DXIL_PROG_SEM_FINAL_QUAD_INSIDE_EDGE_TESSFACTOR = 12,
86    DXIL_PROG_SEM_FINAL_TRI_EDGE_TESSFACTOR = 13,
87    DXIL_PROG_SEM_FINAL_TRI_INSIDE_EDGE_TESSFACTOR = 14,
88    DXIL_PROG_SEM_FINAL_LINE_DETAIL_TESSFACTOR = 15,
89    DXIL_PROG_SEM_FINAL_LINE_DENSITY_TESSFACTOR = 16,
90    DXIL_PROG_SEM_BARYCENTRICS = 23,
91    DXIL_PROG_SEM_SHADING_RATE = 24,
92    DXIL_PROG_SEM_CULL_PRIMITIVE = 25,
93    DXIL_PROG_SEM_TARGET = 64,
94    DXIL_PROG_SEM_DEPTH = 65,
95    DXIL_PROG_SEM_COVERAGE = 66,
96    DXIL_PROG_SEM_DEPTH_GE = 67,
97    DXIL_PROG_SEM_DEPTH_LE = 68,
98    DXIL_PROG_SEM_STENCIL_REF = 69,
99    DXIL_PROG_SEM_INNER_COVERAGE = 70
100 };
101 
102 enum dxil_prog_sig_comp_type {
103    DXIL_PROG_SIG_COMP_TYPE_UNKNOWN = 0,
104    DXIL_PROG_SIG_COMP_TYPE_UINT32 = 1,
105    DXIL_PROG_SIG_COMP_TYPE_SINT32 = 2,
106    DXIL_PROG_SIG_COMP_TYPE_FLOAT32 = 3,
107    DXIL_PROG_SIG_COMP_TYPE_UINT16 = 4,
108    DXIL_PROG_SIG_COMP_TYPE_SINT16 = 5,
109    DXIL_PROG_SIG_COMP_TYPE_FLOAT16 = 6,
110    DXIL_PROG_SIG_COMP_TYPE_UINT64 = 7,
111    DXIL_PROG_SIG_COMP_TYPE_SINT64 = 8,
112    DXIL_PROG_SIG_COMP_TYPE_FLOAT64 = 9,
113    DXIL_PROG_SIG_COMP_TYPE_COUNT
114 };
115 
116 
117 enum dxil_sig_point_kind {
118    DXIL_SIG_POINT_VSIN, // Ordinary Vertex Shader input from Input Assembler
119    DXIL_SIG_POINT_VSOUT, // Ordinary Vertex Shader output that may feed Rasterizer
120    DXIL_SIG_POINT_PCIN, // Patch Constant function non-patch inputs
121    DXIL_SIG_POINT_HSIN, // Hull Shader function non-patch inputs
122    DXIL_SIG_POINT_HSCPIN, // Hull Shader patch inputs - Control Points
123    DXIL_SIG_POINT_HSCPOut, // Hull Shader function output - Control Point
124    DXIL_SIG_POINT_PCOUT, // Patch Constant function output - Patch Constant data passed to Domain Shader
125    DXIL_SIG_POINT_DSIN, // Domain Shader regular input - Patch Constant data plus system values
126    DXIL_SIG_POINT_DSCPIN, // Domain Shader patch input - Control Points
127    DXIL_SIG_POINT_DSOUT, // Domain Shader output - vertex data that may feed Rasterizer
128    DXIL_SIG_POINT_GSVIN, // Geometry Shader vertex input - qualified with primitive type
129    DXIL_SIG_POINT_GSIN, // Geometry Shader non-vertex inputs (system values)
130    DXIL_SIG_POINT_GSOUT, // Geometry Shader output - vertex data that may feed Rasterizer
131    DXIL_SIG_POINT_PSIN, // Pixel Shader input
132    DXIL_SIG_POINT_PSOUT, // Pixel Shader output
133    DXIL_SIG_POINT_CSIN, // Compute Shader input
134    DXIL_SIG_POINT_MSIN, // Mesh Shader input
135    DXIL_SIG_POINT_MSOUT, // Mesh Shader vertices output
136    DXIL_SIG_POINT_MSPOUT, // Mesh Shader primitives output
137    DXIL_SIG_POINT_ASIN, // Amplification Shader input
138    DXIL_SIG_POINT_INVALID
139 };
140 
141 enum dxil_min_precision  {
142   DXIL_MIN_PREC_DEFAULT = 0,
143   DXIL_MIN_PREC_FLOAT16 = 1,
144   DXIL_MIN_PREC_FLOAT2_8 = 2,
145   DXIL_MIN_PREC_RESERVED = 3,
146   DXIL_MIN_PREC_SINT16 = 4,
147   DXIL_MIN_PREC_UINT16 = 5,
148   DXIL_MIN_PREC_ANY16 = 0xf0,
149   DXIL_MIN_PREC_ANY10 = 0xf1
150 };
151 
152 enum dxil_semantic_interpret_kind {
153    DXIL_SEM_INTERP_NA, // Not Available
154    DXIL_SEM_INTERP_SV, // Normal System Value
155    DXIL_SEM_INTERP_SGV, // System Generated Value (sorted last)
156    DXIL_SEM_INTERP_ARB, // Treated as Arbitrary
157    DXIL_SEM_INTERP_NOT_IN_SIG, // Not included in signature (intrinsic access)
158    DXIL_SEM_INTERP_NOT_PACKED, // Included in signature, but does not contribute to packing
159    DXIL_SEM_INTERP_TARGET, // Special handling for SV_Target
160    DXIL_SEM_INTERP_TESSFACTOR, // Special handling for tessellation factors
161    DXIL_SEM_INTERP_SHADOW, // Shadow element must be added to a signature for compatibility
162    DXIL_SEM_INTERP_CLIPCULL, // Special packing rules for SV_ClipDistance or SV_CullDistance
163    DXIL_SEM_INTERP_INVALID
164 };
165 
166 enum dxil_component_type {
167    DXIL_COMP_TYPE_INVALID = 0,
168    DXIL_COMP_TYPE_I1 = 1,
169    DXIL_COMP_TYPE_I16 = 2,
170    DXIL_COMP_TYPE_U16 = 3,
171    DXIL_COMP_TYPE_I32 = 4,
172    DXIL_COMP_TYPE_U32 = 5,
173    DXIL_COMP_TYPE_I64 = 6,
174    DXIL_COMP_TYPE_U64 = 7,
175    DXIL_COMP_TYPE_F16 = 8,
176    DXIL_COMP_TYPE_F32 = 9,
177    DXIL_COMP_TYPE_F64 = 10,
178    DXIL_COMP_TYPE_SNORMF16 = 11,
179    DXIL_COMP_TYPE_UNORMF16 = 12,
180    DXIL_COMP_TYPE_SNORMF32 = 13,
181    DXIL_COMP_TYPE_UNORMF32 = 14,
182    DXIL_COMP_TYPE_SNORMF64 = 15,
183    DXIL_COMP_TYPE_UNORMF64 = 16
184 };
185 
186 enum dxil_interpolation_mode  {
187   DXIL_INTERP_UNDEFINED                   = 0,
188   DXIL_INTERP_CONSTANT                    = 1,
189   DXIL_INTERP_LINEAR                      = 2,
190   DXIL_INTERP_LINEAR_CENTROID             = 3,
191   DXIL_INTERP_LINEAR_NOPERSPECTIVE        = 4,
192   DXIL_INTERP_LINEAR_NOPERSPECTIVE_CENTROID  = 5,
193   DXIL_INTERP_LINEAR_SAMPLE               = 6,
194   DXIL_INTERP_LINEAR_NOPERSPECTIVE_SAMPLE = 7,
195   DXIL_INTERP_INVALID                     = 8
196 };
197 
198 enum overload_type {
199    DXIL_NONE,
200    DXIL_I16,
201    DXIL_I32,
202    DXIL_I64,
203    DXIL_F16,
204    DXIL_F32,
205    DXIL_F64,
206    DXIL_NUM_OVERLOADS
207 };
208 
209 enum dxil_resource_class {
210    DXIL_RESOURCE_CLASS_SRV     = 0,
211    DXIL_RESOURCE_CLASS_UAV     = 1,
212    DXIL_RESOURCE_CLASS_CBV     = 2,
213    DXIL_RESOURCE_CLASS_SAMPLER = 3
214 };
215 
216 enum dxil_resource_kind {
217    DXIL_RESOURCE_KIND_INVALID           = 0,
218    DXIL_RESOURCE_KIND_TEXTURE1D         = 1,
219    DXIL_RESOURCE_KIND_TEXTURE2D         = 2,
220    DXIL_RESOURCE_KIND_TEXTURE2DMS       = 3,
221    DXIL_RESOURCE_KIND_TEXTURE3D         = 4,
222    DXIL_RESOURCE_KIND_TEXTURECUBE       = 5,
223    DXIL_RESOURCE_KIND_TEXTURE1D_ARRAY   = 6,
224    DXIL_RESOURCE_KIND_TEXTURE2D_ARRAY   = 7,
225    DXIL_RESOURCE_KIND_TEXTURE2DMS_ARRAY = 8,
226    DXIL_RESOURCE_KIND_TEXTURECUBE_ARRAY = 9,
227    DXIL_RESOURCE_KIND_TYPED_BUFFER      = 10,
228    DXIL_RESOURCE_KIND_RAW_BUFFER        = 11,
229    DXIL_RESOURCE_KIND_STRUCTURED_BUFFER = 12,
230    DXIL_RESOURCE_KIND_CBUFFER           = 13,
231    DXIL_RESOURCE_KIND_SAMPLER           = 14,
232    DXIL_RESOURCE_KIND_TBUFFER           = 15,
233 };
234 
235 enum dxil_sampler_kind {
236    DXIL_SAMPLER_KIND_DEFAULT    = 0,
237    DXIL_SAMPLER_KIND_COMPARISON = 1,
238    DXIL_SAMPLER_KIND_MONO       = 2,
239    DXIL_SAMPLER_KIND_INVALID    = 3,
240 };
241 
242 enum dxil_attr_kind {
243    DXIL_ATTR_KIND_NONE = 0,
244    DXIL_ATTR_KIND_NO_DUPLICATE = 12,
245    DXIL_ATTR_KIND_NO_UNWIND = 18,
246    DXIL_ATTR_KIND_READ_NONE = 20,
247    DXIL_ATTR_KIND_READ_ONLY = 21,
248 };
249 
250 enum dxil_input_primitive {
251    DXIL_INPUT_PRIMITIVE_UNDEFINED         = 0,
252    DXIL_INPUT_PRIMITIVE_POINT             = 1,
253    DXIL_INPUT_PRIMITIVE_LINE              = 2,
254    DXIL_INPUT_PRIMITIVE_TRIANGLE          = 3,
255    DXIL_INPUT_PRIMITIVE_LINES_ADJENCY     = 6,
256    DXIL_INPUT_PRIMITIVE_TRIANGLES_ADJENCY = 7,
257 };
258 
259 enum dxil_primitive_topology {
260    DXIL_PRIMITIVE_TOPOLOGY_UNDEFINED      = 0,
261    DXIL_PRIMITIVE_TOPOLOGY_POINT_LIST     = 1,
262    DXIL_PRIMITIVE_TOPOLOGY_LINE_LIST      = 2,
263    DXIL_PRIMITIVE_TOPOLOGY_LINE_STRIP     = 3,
264    DXIL_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST  = 4,
265    DXIL_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 5,
266 };
267 
268 enum dxil_shader_tag {
269    DXIL_SHADER_TAG_FLAGS       = 0,
270    DXIL_SHADER_TAG_GS_STATE    = 1,
271    DXIL_SHADER_TAG_DS_STATE    = 2,
272    DXIL_SHADER_TAG_HS_STATE    = 3,
273    DXIL_SHADER_TAG_NUM_THREADS = 4,
274 };
275 
276 enum dxil_barrier_mode {
277    DXIL_BARRIER_MODE_SYNC_THREAD_GROUP = 1,
278    DXIL_BARRIER_MODE_UAV_FENCE_GLOBAL = 2,
279    DXIL_BARRIER_MODE_UAV_FENCE_THREAD_GROUP = 4,
280    DXIL_BARRIER_MODE_GROUPSHARED_MEM_FENCE = 8,
281 };
282 
283 enum dxil_address_space {
284    DXIL_AS_DEFAULT = 0,
285    DXIL_AS_DEVMEM = 1,
286    DXIL_AS_CBUF = 2,
287    DXIL_AS_GROUPSHARED = 3,
288 };
289 
290 enum dxil_rmw_op {
291    DXIL_RMWOP_XCHG = 0,
292    DXIL_RMWOP_ADD = 1,
293    DXIL_RMWOP_SUB = 2,
294    DXIL_RMWOP_AND = 3,
295    DXIL_RMWOP_NAND = 4,
296    DXIL_RMWOP_OR = 5,
297    DXIL_RMWOP_XOR = 6,
298    DXIL_RMWOP_MAX = 7,
299    DXIL_RMWOP_MIN = 8,
300    DXIL_RMWOP_UMAX = 9,
301    DXIL_RMWOP_UMIN = 10,
302 };
303 
304 enum dxil_atomic_ordering {
305    DXIL_ATOMIC_ORDERING_NOTATOMIC = 0,
306    DXIL_ATOMIC_ORDERING_UNORDERED = 1,
307    DXIL_ATOMIC_ORDERING_MONOTONIC = 2,
308    DXIL_ATOMIC_ORDERING_ACQUIRE = 3,
309    DXIL_ATOMIC_ORDERING_RELEASE = 4,
310    DXIL_ATOMIC_ORDERING_ACQREL = 5,
311    DXIL_ATOMIC_ORDERING_SEQCST = 6,
312 };
313 
314 enum dxil_sync_scope {
315    DXIL_SYNC_SCOPE_SINGLETHREAD = 0,
316    DXIL_SYNC_SCOPE_CROSSTHREAD = 1,
317 };
318 
319 enum dxil_tessellator_domain {
320    DXIL_TESSELLATOR_DOMAIN_UNDEFINED = 0,
321    DXIL_TESSELLATOR_DOMAIN_ISOLINE = 1,
322    DXIL_TESSELLATOR_DOMAIN_TRI = 2,
323    DXIL_TESSELLATOR_DOMAIN_QUAD = 3,
324 };
325 
326 enum dxil_tessellator_output_primitive {
327    DXIL_TESSELLATOR_OUTPUT_PRIMITIVE_UNDEFINED = 0,
328    DXIL_TESSELLATOR_OUTPUT_PRIMITIVE_POINT = 1,
329    DXIL_TESSELLATOR_OUTPUT_PRIMITIVE_LINE = 2,
330    DXIL_TESSELLATOR_OUTPUT_PRIMITIVE_TRIANGLE_CW = 3,
331    DXIL_TESSELLATOR_OUTPUT_PRIMITIVE_TRIANGLE_CCW = 4,
332 };
333 
334 enum dxil_tessellator_partitioning {
335    DXIL_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
336    DXIL_TESSELLATOR_PARTITIONING_INTEGER = 1,
337    DXIL_TESSELLATOR_PARTITIONING_POW2 = 2,
338    DXIL_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
339    DXIL_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
340 };
341 
342 enum dxil_signature_element_extended_properties {
343    DXIL_SIGNATURE_ELEMENT_OUTPUT_STREAM = 0,
344    DXIL_SIGNATURE_ELEMENT_GLOBAL_SYMBOL = 1,
345    DXIL_SIGNATURE_ELEMENT_DYNAMIC_INDEX_COMPONENT_MASK = 2,
346    DXIL_SIGNATURE_ELEMENT_USAGE_COMPONENT_MASK = 3,
347 };
348 
349 #ifdef __cplusplus
350 extern "C" {
351 #endif
352 
353 struct glsl_type;
354 
355 enum dxil_component_type dxil_get_comp_type(const struct glsl_type *type);
356 
357 enum dxil_prog_sig_comp_type dxil_get_prog_sig_comp_type(const struct glsl_type *type);
358 
359 enum dxil_resource_kind dxil_get_resource_kind(const struct glsl_type *type);
360 
361 enum dxil_primitive_topology dxil_get_primitive_topology(unsigned topology);
362 
363 enum dxil_input_primitive dxil_get_input_primitive(unsigned primitive);
364 
365 const char *dxil_overload_suffix( enum overload_type overload);
366 
367 #ifdef __cplusplus
368 }
369 #endif
370 
371 
372 #endif // DXIL_ENUMS_H
373