-
Notifications
You must be signed in to change notification settings - Fork 853
Expand file tree
/
Copy pathDxilConstants.h
More file actions
2106 lines (1836 loc) · 70 KB
/
DxilConstants.h
File metadata and controls
2106 lines (1836 loc) · 70 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////////////////
// //
// DxilConstants.h //
// Copyright (C) Microsoft Corporation. All rights reserved. //
// This file is distributed under the University of Illinois Open Source //
// License. See LICENSE.TXT for details. //
// //
// Essential DXIL constants. //
// //
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <stdint.h>
namespace hlsl {
/* <py>
import hctdb_instrhelp
</py> */
// TODO:
// 2. get rid of DXIL namespace.
// 3. use class enum for shader flags.
// 4. use class enum for address spaces.
namespace DXIL {
// DXIL version.
const unsigned kDxilMajor = 1;
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_dxil_version_minor()</py>*/
// VALRULE-TEXT:BEGIN
const unsigned kDxilMinor = 9;
// VALRULE-TEXT:END
inline unsigned MakeDxilVersion(unsigned DxilMajor, unsigned DxilMinor) {
return 0 | (DxilMajor << 8) | (DxilMinor);
}
inline unsigned GetCurrentDxilVersion() {
return MakeDxilVersion(kDxilMajor, kDxilMinor);
}
inline unsigned GetDxilVersionMajor(unsigned DxilVersion) {
return (DxilVersion >> 8) & 0xFF;
}
inline unsigned GetDxilVersionMinor(unsigned DxilVersion) {
return DxilVersion & 0xFF;
}
// Return positive if v1 > v2, negative if v1 < v2, zero if equal
inline int CompareVersions(unsigned Major1, unsigned Minor1, unsigned Major2,
unsigned Minor2) {
if (Major1 != Major2) {
// Special case for Major == 0 (latest/unbound)
if (Major1 == 0 || Major2 == 0)
return Major1 > 0 ? -1 : 1;
return Major1 < Major2 ? -1 : 1;
}
if (Minor1 < Minor2)
return -1;
if (Minor1 > Minor2)
return 1;
return 0;
}
// Utility for updating major,minor to max of current and new.
inline bool UpdateToMaxOfVersions(unsigned &major, unsigned &minor,
unsigned newMajor, unsigned newMinor) {
if (newMajor > major) {
major = newMajor;
minor = newMinor;
return true;
} else if (newMajor == major) {
if (newMinor > minor) {
minor = newMinor;
return true;
}
}
return false;
}
// Shader flags.
const unsigned kDisableOptimizations =
0x00000001; // D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
const unsigned kDisableMathRefactoring =
0x00000002; //~D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED
const unsigned kEnableDoublePrecision =
0x00000004; // D3D11_SB_GLOBAL_FLAG_ENABLE_DOUBLE_PRECISION_FLOAT_OPS
const unsigned kForceEarlyDepthStencil =
0x00000008; // D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL
const unsigned kEnableRawAndStructuredBuffers =
0x00000010; // D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS
const unsigned kEnableMinPrecision =
0x00000020; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
const unsigned kEnableDoubleExtensions =
0x00000040; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_DOUBLE_EXTENSIONS
const unsigned kEnableMSAD =
0x00000080; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_SHADER_EXTENSIONS
const unsigned kAllResourcesBound =
0x00000100; // D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND
const unsigned kNumOutputStreams = 4;
const unsigned kNumClipPlanes = 6;
// TODO: move these to appropriate places (ShaderModel.cpp?)
const unsigned kMaxTempRegCount = 4096; // DXBC only
const unsigned kMaxCBufferSize = 4096;
const unsigned kMaxStructBufferStride = 2048;
const unsigned kMaxHSOutputControlPointsTotalScalars = 3968;
const unsigned kMaxHSOutputPatchConstantTotalScalars = 32 * 4;
const unsigned kMaxSignatureTotalVectors = 32;
const unsigned kMaxOutputTotalScalars = kMaxSignatureTotalVectors * 4;
const unsigned kMaxInputTotalScalars = kMaxSignatureTotalVectors * 4;
const unsigned kMaxClipOrCullDistanceElementCount = 2;
const unsigned kMaxClipOrCullDistanceCount = 2 * 4;
const unsigned kMaxGSOutputVertexCount = 1024;
const unsigned kMaxGSInstanceCount = 32;
const unsigned kMinIAPatchControlPointCount = 1;
const unsigned kMaxIAPatchControlPointCount = 32;
const float kHSMaxTessFactorLowerBound = 1.0f;
const float kHSMaxTessFactorUpperBound = 64.0f;
const unsigned kHSDefaultInputControlPointCount = 1;
const unsigned kMaxCSThreadsPerGroup = 1024;
const unsigned kMaxCSThreadGroupX = 1024;
const unsigned kMaxCSThreadGroupY = 1024;
const unsigned kMaxCSThreadGroupZ = 64;
const unsigned kMinCSThreadGroupX = 1;
const unsigned kMinCSThreadGroupY = 1;
const unsigned kMinCSThreadGroupZ = 1;
const unsigned kMaxCS4XThreadsPerGroup = 768;
const unsigned kMaxCS4XThreadGroupX = 768;
const unsigned kMaxCS4XThreadGroupY = 768;
const unsigned kMaxTGSMSize = 8192 * 4;
const unsigned kMaxGSOutputTotalScalars = 1024;
const unsigned kMaxMSASThreadsPerGroup = 128;
const unsigned kMaxMSASThreadGroupX = 128;
const unsigned kMaxMSASThreadGroupY = 128;
const unsigned kMaxMSASThreadGroupZ = 128;
const unsigned kMinMSASThreadGroupX = 1;
const unsigned kMinMSASThreadGroupY = 1;
const unsigned kMinMSASThreadGroupZ = 1;
const unsigned kMaxMSASPayloadBytes = 1024 * 16;
const unsigned kMaxMSOutputPrimitiveCount = 256;
const unsigned kMaxMSOutputVertexCount = 256;
const unsigned kMaxMSOutputTotalBytes = 1024 * 32;
const unsigned kMaxMSInputOutputTotalBytes = 1024 * 47;
const unsigned kMaxMSVSigRows = 32;
const unsigned kMaxMSPSigRows = 32;
const unsigned kMaxMSTotalSigRows = 32;
const unsigned kMaxMSSMSize = 1024 * 28;
const unsigned kMinWaveSize = 4;
const unsigned kMaxWaveSize = 128;
const unsigned kDefaultMaxVectorLength = 4;
const unsigned kSM69MaxVectorLength = 1024;
const float kMaxMipLodBias = 15.99f;
const float kMinMipLodBias = -16.0f;
const unsigned kResRetStatusIndex = 4;
/* <py::lines('OLOAD_DIMS-TEXT')>hctdb_instrhelp.get_max_oload_dims()</py>*/
// OLOAD_DIMS-TEXT:BEGIN
const unsigned kDxilMaxOloadDims = 2;
// OLOAD_DIMS-TEXT:END
enum class ComponentType : uint32_t {
Invalid = 0,
I1,
I16,
U16,
I32,
U32,
I64,
U64,
F16,
F32,
F64,
SNormF16,
UNormF16,
SNormF32,
UNormF32,
SNormF64,
UNormF64,
PackedS8x32,
PackedU8x32,
LastEntry
};
// Must match D3D_INTERPOLATION_MODE
enum class InterpolationMode : uint8_t {
Undefined = 0,
Constant = 1,
Linear = 2,
LinearCentroid = 3,
LinearNoperspective = 4,
LinearNoperspectiveCentroid = 5,
LinearSample = 6,
LinearNoperspectiveSample = 7,
Invalid = 8
};
// size of each scalar type in signature element in bits
enum class SignatureDataWidth : uint8_t {
Undefined = 0,
Bits16 = 16,
Bits32 = 32,
};
enum class SignatureKind {
Invalid = 0,
Input,
Output,
PatchConstOrPrim,
};
// Must match D3D11_SHADER_VERSION_TYPE
enum class ShaderKind {
Pixel = 0,
Vertex,
Geometry,
Hull,
Domain,
Compute,
Library,
RayGeneration,
Intersection,
AnyHit,
ClosestHit,
Miss,
Callable,
Mesh,
Amplification,
Node,
Invalid,
// Last* values identify the last shader kind recognized by the highest
// validator version before additional kinds were added.
Last_1_2 = Compute,
Last_1_4 = Callable,
Last_1_7 = Amplification,
Last_1_8 = Node,
LastValid = Last_1_8,
};
static_assert((unsigned)DXIL::ShaderKind::LastValid + 1 ==
(unsigned)DXIL::ShaderKind::Invalid,
"otherwise, enum needs updating.");
// clang-format off
// Python lines need to be not formatted.
/* <py::lines('SemanticKind-ENUM')>hctdb_instrhelp.get_enum_decl("SemanticKind", hide_val=True, sort_val=False)</py>*/
// clang-format on
// SemanticKind-ENUM:BEGIN
// Semantic kind; Arbitrary or specific system value.
enum class SemanticKind : unsigned {
Arbitrary,
VertexID,
InstanceID,
Position,
RenderTargetArrayIndex,
ViewPortArrayIndex,
ClipDistance,
CullDistance,
OutputControlPointID,
DomainLocation,
PrimitiveID,
GSInstanceID,
SampleIndex,
IsFrontFace,
Coverage,
InnerCoverage,
Target,
Depth,
DepthLessEqual,
DepthGreaterEqual,
StencilRef,
DispatchThreadID,
GroupID,
GroupIndex,
GroupThreadID,
TessFactor,
InsideTessFactor,
ViewID,
Barycentrics,
ShadingRate,
CullPrimitive,
StartVertexLocation,
StartInstanceLocation,
Invalid,
};
// SemanticKind-ENUM:END
// clang-format off
// Python lines need to be not formatted.
/* <py::lines('SigPointKind-ENUM')>hctdb_instrhelp.get_enum_decl("SigPointKind", hide_val=True, sort_val=False)</py>*/
// clang-format on
// SigPointKind-ENUM:BEGIN
// Signature Point is more specific than shader stage or signature as it is
// unique in both stage and item dimensionality or frequency.
enum class SigPointKind : unsigned {
VSIn, // Ordinary Vertex Shader input from Input Assembler
VSOut, // Ordinary Vertex Shader output that may feed Rasterizer
PCIn, // Patch Constant function non-patch inputs
HSIn, // Hull Shader function non-patch inputs
HSCPIn, // Hull Shader patch inputs - Control Points
HSCPOut, // Hull Shader function output - Control Point
PCOut, // Patch Constant function output - Patch Constant data passed to
// Domain Shader
DSIn, // Domain Shader regular input - Patch Constant data plus system values
DSCPIn, // Domain Shader patch input - Control Points
DSOut, // Domain Shader output - vertex data that may feed Rasterizer
GSVIn, // Geometry Shader vertex input - qualified with primitive type
GSIn, // Geometry Shader non-vertex inputs (system values)
GSOut, // Geometry Shader output - vertex data that may feed Rasterizer
PSIn, // Pixel Shader input
PSOut, // Pixel Shader output
CSIn, // Compute Shader input
MSIn, // Mesh Shader input
MSOut, // Mesh Shader vertices output
MSPOut, // Mesh Shader primitives output
ASIn, // Amplification Shader input
Invalid,
};
// SigPointKind-ENUM:END
// clang-format off
// Python lines need to be not formatted.
/* <py::lines('SemanticInterpretationKind-ENUM')>hctdb_instrhelp.get_enum_decl("SemanticInterpretationKind", hide_val=True, sort_val=False)</py>*/
// clang-format on
// SemanticInterpretationKind-ENUM:BEGIN
// Defines how a semantic is interpreted at a particular SignaturePoint
enum class SemanticInterpretationKind : unsigned {
NA, // Not Available
SV, // Normal System Value
SGV, // System Generated Value (sorted last)
Arb, // Treated as Arbitrary
NotInSig, // Not included in signature (intrinsic access)
NotPacked, // Included in signature, but does not contribute to packing
Target, // Special handling for SV_Target
TessFactor, // Special handling for tessellation factors
Shadow, // Shadow element must be added to a signature for compatibility
ClipCull, // Special packing rules for SV_ClipDistance or SV_CullDistance
Invalid,
};
// SemanticInterpretationKind-ENUM:END
// clang-format off
// Python lines need to be not formatted.
/* <py::lines('PackingKind-ENUM')>hctdb_instrhelp.get_enum_decl("PackingKind", hide_val=True, sort_val=False)</py>*/
// clang-format on
// PackingKind-ENUM:BEGIN
// Kind of signature point
enum class PackingKind : unsigned {
None, // No packing should be performed
InputAssembler, // Vertex Shader input from Input Assembler
Vertex, // Vertex that may feed the Rasterizer
PatchConstant, // Patch constant signature
Target, // Render Target (Pixel Shader Output)
Invalid,
};
// PackingKind-ENUM:END
// clang-format off
// Python lines need to be not formatted.
/* <py::lines('FPDenormMode-ENUM')>hctdb_instrhelp.get_enum_decl("Float32DenormMode", hide_val=False, sort_val=False)</py>*/
// clang-format on
// FPDenormMode-ENUM:BEGIN
// float32 denorm behavior
enum class Float32DenormMode : unsigned {
Any = 0, // Undefined behavior for denormal numbers
Preserve = 1, // Preserve both input and output
FTZ = 2, // Preserve denormal inputs. Flush denorm outputs
Reserve3 = 3, // Reserved Value. Not used for now
Reserve4 = 4, // Reserved Value. Not used for now
Reserve5 = 5, // Reserved Value. Not used for now
Reserve6 = 6, // Reserved Value. Not used for now
Reserve7 = 7, // Reserved Value. Not used for now
};
// FPDenormMode-ENUM:END
enum class PackingStrategy : unsigned {
Default = 0, // Choose default packing algorithm based on target (currently
// PrefixStable)
PrefixStable, // Maintain assumption that all elements are packed in order and
// stable as new elements are added.
Optimized, // Optimize packing of all elements together (all elements must be
// present, in the same order, for identical placement of any
// individual element)
Invalid,
};
enum class DefaultLinkage : unsigned {
Default = 0,
Internal = 1,
External = 2,
};
enum class SamplerKind : unsigned {
Default = 0,
Comparison,
Mono,
Invalid,
};
enum class ResourceClass { SRV = 0, UAV, CBuffer, Sampler, Invalid };
enum class ResourceKind : unsigned {
Invalid = 0,
Texture1D,
Texture2D,
Texture2DMS,
Texture3D,
TextureCube,
Texture1DArray,
Texture2DArray,
Texture2DMSArray,
TextureCubeArray,
TypedBuffer,
RawBuffer,
StructuredBuffer,
CBuffer,
Sampler,
TBuffer,
RTAccelerationStructure,
FeedbackTexture2D,
FeedbackTexture2DArray,
NumEntries,
};
/// Whether the resource kind is a texture. This does not include
/// FeedbackTextures.
inline bool IsAnyTexture(DXIL::ResourceKind ResourceKind) {
return DXIL::ResourceKind::Texture1D <= ResourceKind &&
ResourceKind <= DXIL::ResourceKind::TextureCubeArray;
}
/// Whether the resource kind is an array of textures. This does not include
/// FeedbackTextures.
inline bool IsAnyArrayTexture(DXIL::ResourceKind ResourceKind) {
return DXIL::ResourceKind::Texture1DArray <= ResourceKind &&
ResourceKind <= DXIL::ResourceKind::TextureCubeArray;
}
/// Whether the resource kind is a Texture or FeedbackTexture with array
/// dimension.
inline bool IsArrayKind(DXIL::ResourceKind ResourceKind) {
return IsAnyArrayTexture(ResourceKind) ||
ResourceKind == DXIL::ResourceKind::FeedbackTexture2DArray;
}
/// Whether the resource kind is a TextureCube or TextureCubeArray.
inline bool IsAnyTextureCube(DXIL::ResourceKind ResourceKind) {
return DXIL::ResourceKind::TextureCube == ResourceKind ||
DXIL::ResourceKind::TextureCubeArray == ResourceKind;
}
inline bool IsStructuredBuffer(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::StructuredBuffer;
}
inline bool IsTypedBuffer(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::TypedBuffer;
}
inline bool IsTyped(DXIL::ResourceKind ResourceKind) {
return IsTypedBuffer(ResourceKind) || IsAnyTexture(ResourceKind);
}
inline bool IsRawBuffer(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::RawBuffer;
}
inline bool IsTBuffer(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::TBuffer;
}
inline bool IsCTBuffer(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::CBuffer ||
ResourceKind == DXIL::ResourceKind::TBuffer;
}
/// Whether the resource kind is a FeedbackTexture.
inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) {
return ResourceKind == DXIL::ResourceKind::FeedbackTexture2D ||
ResourceKind == DXIL::ResourceKind::FeedbackTexture2DArray;
}
// TODO: change opcodes.
/* <py::lines('OPCODE-ENUM')>hctdb_instrhelp.get_enum_decl("OpCode")</py>*/
// OPCODE-ENUM:BEGIN
// Enumeration for operations specified by DXIL
enum class OpCode : unsigned {
//
Reserved0 = 226, // Reserved
Reserved1 = 227, // Reserved
Reserved10 = 236, // Reserved
Reserved11 = 237, // Reserved
Reserved2 = 228, // Reserved
Reserved3 = 229, // Reserved
Reserved4 = 230, // Reserved
Reserved5 = 231, // Reserved
Reserved6 = 232, // Reserved
Reserved7 = 233, // Reserved
Reserved8 = 234, // Reserved
Reserved9 = 235, // Reserved
ReservedA0 = 259, // reserved
ReservedA1 = 260, // reserved
ReservedA2 = 261, // reserved
ReservedB0 = 262, // reserved
ReservedB1 = 263, // reserved
ReservedB10 = 272, // reserved
ReservedB11 = 273, // reserved
ReservedB12 = 274, // reserved
ReservedB13 = 275, // reserved
ReservedB14 = 276, // reserved
ReservedB15 = 277, // reserved
ReservedB16 = 278, // reserved
ReservedB17 = 279, // reserved
ReservedB18 = 280, // reserved
ReservedB19 = 281, // reserved
ReservedB2 = 264, // reserved
ReservedB20 = 282, // reserved
ReservedB21 = 283, // reserved
ReservedB22 = 284, // reserved
ReservedB23 = 285, // reserved
ReservedB24 = 286, // reserved
ReservedB25 = 287, // reserved
ReservedB26 = 288, // reserved
ReservedB27 = 289, // reserved
ReservedB28 = 290, // reserved
ReservedB29 = 291, // reserved
ReservedB30 = 292, // reserved
ReservedB5 = 267, // reserved
ReservedB6 = 268, // reserved
ReservedB7 = 269, // reserved
ReservedB8 = 270, // reserved
ReservedB9 = 271, // reserved
ReservedC0 = 293, // reserved
ReservedC1 = 294, // reserved
ReservedC2 = 295, // reserved
ReservedC3 = 296, // reserved
ReservedC4 = 297, // reserved
ReservedC5 = 298, // reserved
ReservedC6 = 299, // reserved
ReservedC7 = 300, // reserved
ReservedC8 = 301, // reserved
ReservedC9 = 302, // reserved
// Amplification shader instructions
DispatchMesh = 173, // Amplification shader intrinsic DispatchMesh
// AnyHit Terminals
AcceptHitAndEndSearch =
156, // Used in an any hit shader to abort the ray query and the
// intersection shader (if any). The current hit is committed and
// execution passes to the closest hit shader with the closest hit
// recorded so far
IgnoreHit = 155, // Used in an any hit shader to reject an intersection and
// terminate the shader
// Binary float
FMax = 35, // returns a if a >= b, else b
FMin = 36, // returns a if a < b, else b
// Binary int with two outputs
IMul = 41, // multiply of 32-bit operands to produce the correct full 64-bit
// result.
// Binary int
IMax = 37, // IMax(a,b) returns a if a > b, else b
IMin = 38, // IMin(a,b) returns a if a < b, else b
// Binary uint with carry or borrow
UAddc = 44, // unsigned add of 32-bit operand with the carry
USubb = 45, // unsigned subtract of 32-bit operands with the borrow
// Binary uint with two outputs
UDiv = 43, // unsigned divide of the 32-bit operand src0 by the 32-bit operand
// src1.
UMul = 42, // multiply of 32-bit operands to produce the correct full 64-bit
// result.
// Binary uint
UMax = 39, // unsigned integer maximum. UMax(a,b) = a > b ? a : b
UMin = 40, // unsigned integer minimum. UMin(a,b) = a < b ? a : b
// Bitcasts with different sizes
BitcastF16toI16 = 125, // bitcast between different sizes
BitcastF32toI32 = 127, // bitcast between different sizes
BitcastF64toI64 = 129, // bitcast between different sizes
BitcastI16toF16 = 124, // bitcast between different sizes
BitcastI32toF32 = 126, // bitcast between different sizes
BitcastI64toF64 = 128, // bitcast between different sizes
// Comparison Samples
SampleCmpBias = 255, // samples a texture after applying the input bias to the
// mipmap level and compares a single component against
// the specified comparison value
SampleCmpGrad =
254, // samples a texture using a gradient and compares a single component
// against the specified comparison value
// Compute/Mesh/Amplification/Node shader
FlattenedThreadIdInGroup = 96, // provides a flattened index for a given
// thread within a given group (SV_GroupIndex)
GroupId = 94, // reads the group ID (SV_GroupID)
ThreadId = 93, // reads the thread ID
ThreadIdInGroup =
95, // reads the thread ID within the group (SV_GroupThreadID)
// Create/Annotate Node Handles
AllocateNodeOutputRecords = 238, // returns a handle for the output records
AnnotateNodeHandle = 249, // annotate handle with node properties
AnnotateNodeRecordHandle = 251, // annotate handle with node record properties
CreateNodeInputRecordHandle = 250, // create a handle for an InputRecord
CreateNodeOutputHandle = 247, // Creates a handle to a NodeOutput
IndexNodeHandle = 248, // returns the handle for the location in the output
// node array at the indicated index
// Derivatives
CalculateLOD = 81, // calculates the level of detail
DerivCoarseX = 83, // computes the rate of change per stamp in x direction.
DerivCoarseY = 84, // computes the rate of change per stamp in y direction.
DerivFineX = 85, // computes the rate of change per pixel in x direction.
DerivFineY = 86, // computes the rate of change per pixel in y direction.
// Domain and hull shader
LoadOutputControlPoint = 103, // LoadOutputControlPoint
LoadPatchConstant = 104, // LoadPatchConstant
// Domain shader
DomainLocation = 105, // DomainLocation
// Dot product with accumulate
Dot2AddHalf = 162, // 2D half dot product with accumulate to float
Dot4AddI8Packed = 163, // signed dot product of 4 x i8 vectors packed into
// i32, with accumulate to i32
Dot4AddU8Packed = 164, // unsigned dot product of 4 x u8 vectors packed into
// i32, with accumulate to i32
// Dot
Dot2 = 54, // Two-dimensional vector dot-product
Dot3 = 55, // Three-dimensional vector dot-product
Dot4 = 56, // Four-dimensional vector dot-product
// Double precision
LegacyDoubleToFloat = 132, // legacy fuction to convert double to float
LegacyDoubleToSInt32 = 133, // legacy fuction to convert double to int32
LegacyDoubleToUInt32 = 134, // legacy fuction to convert double to uint32
MakeDouble = 101, // creates a double value
SplitDouble = 102, // splits a double into low and high parts
// Extended Command Information
StartInstanceLocation =
257, // returns the StartInstanceLocation from Draw*Instanced
StartVertexLocation =
256, // returns the BaseVertexLocation from DrawIndexedInstanced or
// StartVertexLocation from DrawInstanced
// Geometry shader
CutStream =
98, // completes the current primitive topology at the specified stream
EmitStream = 97, // emits a vertex to a given stream
EmitThenCutStream = 99, // equivalent to an EmitStream followed by a CutStream
GSInstanceID = 100, // GSInstanceID
// Get Pointer to Node Record in Address Space 6
GetNodeRecordPtr =
239, // retrieve node input/output record pointer in address space 6
// Get handle from heap
AnnotateHandle = 216, // annotate handle with resource properties
CreateHandleFromBinding = 217, // create resource handle from binding
CreateHandleFromHeap = 218, // create resource handle from heap
// Graphics shader
ViewID = 138, // returns the view index
// Helper Lanes
IsHelperLane = 221, // returns true on helper lanes in pixel shaders
// Hull shader
OutputControlPointID = 107, // OutputControlPointID
StorePatchConstant = 106, // StorePatchConstant
// Hull, Domain and Geometry shaders
PrimitiveID = 108, // PrimitiveID
// Indirect Shader Invocation
CallShader = 159, // Call a shader in the callable shader table supplied
// through the DispatchRays() API
ReportHit = 158, // returns true if hit was accepted
TraceRay = 157, // initiates raytrace
// Inline Ray Query
AllocateRayQuery = 178, // allocates space for RayQuery and return handle
AllocateRayQuery2 = 258, // allocates space for RayQuery and return handle
RayQuery_Abort = 181, // aborts a ray query
RayQuery_CandidateGeometryIndex = 203, // returns candidate hit geometry index
RayQuery_CandidateInstanceContributionToHitGroupIndex =
214, // returns candidate hit InstanceContributionToHitGroupIndex
RayQuery_CandidateInstanceID = 202, // returns candidate hit instance ID
RayQuery_CandidateInstanceIndex = 201, // returns candidate hit instance index
RayQuery_CandidateObjectRayDirection =
206, // returns candidate object ray direction
RayQuery_CandidateObjectRayOrigin =
205, // returns candidate hit object ray origin
RayQuery_CandidateObjectToWorld3x4 =
186, // returns matrix for transforming from object-space to world-space
// for a candidate hit.
RayQuery_CandidatePrimitiveIndex =
204, // returns candidate hit geometry index
RayQuery_CandidateProceduralPrimitiveNonOpaque =
190, // returns if current candidate procedural primitive is non opaque
RayQuery_CandidateTriangleBarycentrics =
193, // returns candidate triangle hit barycentrics
RayQuery_CandidateTriangleFrontFace =
191, // returns if current candidate triangle is front facing
RayQuery_CandidateTriangleRayT =
199, // returns float representing the parametric point on the ray for the
// current candidate triangle hit.
RayQuery_CandidateType =
185, // returns uint candidate type (CANDIDATE_TYPE) of the current hit
// candidate in a ray query, after Proceed() has returned true
RayQuery_CandidateWorldToObject3x4 =
187, // returns matrix for transforming from world-space to object-space
// for a candidate hit.
RayQuery_CommitNonOpaqueTriangleHit =
182, // commits a non opaque triangle hit
RayQuery_CommitProceduralPrimitiveHit =
183, // commits a procedural primitive hit
RayQuery_CommittedGeometryIndex = 209, // returns committed hit geometry index
RayQuery_CommittedInstanceContributionToHitGroupIndex =
215, // returns committed hit InstanceContributionToHitGroupIndex
RayQuery_CommittedInstanceID = 208, // returns committed hit instance ID
RayQuery_CommittedInstanceIndex = 207, // returns committed hit instance index
RayQuery_CommittedObjectRayDirection =
212, // returns committed object ray direction
RayQuery_CommittedObjectRayOrigin =
211, // returns committed hit object ray origin
RayQuery_CommittedObjectToWorld3x4 =
188, // returns matrix for transforming from object-space to world-space
// for a Committed hit.
RayQuery_CommittedPrimitiveIndex =
210, // returns committed hit geometry index
RayQuery_CommittedRayT =
200, // returns float representing the parametric point on the ray for the
// current committed hit.
RayQuery_CommittedStatus = 184, // returns uint status (COMMITTED_STATUS) of
// the committed hit in a ray query
RayQuery_CommittedTriangleBarycentrics =
194, // returns committed triangle hit barycentrics
RayQuery_CommittedTriangleFrontFace =
192, // returns if current committed triangle is front facing
RayQuery_CommittedWorldToObject3x4 =
189, // returns matrix for transforming from world-space to object-space
// for a Committed hit.
RayQuery_Proceed = 180, // advances a ray query
RayQuery_RayFlags = 195, // returns ray flags
RayQuery_RayTMin = 198, // returns float representing the parametric starting
// point for the ray.
RayQuery_TraceRayInline = 179, // initializes RayQuery for raytrace
RayQuery_WorldRayDirection = 197, // returns world ray direction
RayQuery_WorldRayOrigin = 196, // returns world ray origin
// Legacy floating-point
LegacyF16ToF32 = 131, // legacy fuction to convert half (f16) to float (f32)
// (this is not related to min-precision)
LegacyF32ToF16 = 130, // legacy fuction to convert float (f32) to half (f16)
// (this is not related to min-precision)
// Library create handle from resource struct (like HL intrinsic)
CreateHandleForLib =
160, // create resource handle from resource struct for library
// Mesh shader instructions
EmitIndices = 169, // emit a primitive's vertex indices in a mesh shader
GetMeshPayload =
170, // get the mesh payload which is from amplification shader
SetMeshOutputCounts = 168, // Mesh shader intrinsic SetMeshOutputCounts
StorePrimitiveOutput =
172, // stores the value to mesh shader primitive output
StoreVertexOutput = 171, // stores the value to mesh shader vertex output
// Other
CycleCounterLegacy = 109, // CycleCounterLegacy
// Packing intrinsics
Pack4x8 = 220, // packs vector of 4 signed or unsigned values into a packed
// datatype, drops or clamps unused bits
// Pixel shader
AttributeAtVertex =
137, // returns the values of the attributes at the vertex.
Coverage = 91, // returns the coverage mask input in a pixel shader
Discard = 82, // discard the current pixel
EvalCentroid = 89, // evaluates an input attribute at pixel center
EvalSampleIndex = 88, // evaluates an input attribute at a sample location
EvalSnapped =
87, // evaluates an input attribute at pixel center with an offset
InnerCoverage = 92, // returns underestimated coverage input from conservative
// rasterization in a pixel shader
SampleIndex =
90, // returns the sample index in a sample-frequency pixel shader
// Quad Wave Ops
QuadOp = 123, // returns the result of a quad-level operation
QuadReadLaneAt = 122, // reads from a lane in the quad
QuadVote = 222, // compares boolean accross a quad
// Quaternary
Bfi = 53, // Given a bit range from the LSB of a number, places that number of
// bits in another number at any offset
// Ray Dispatch Arguments
DispatchRaysDimensions =
146, // The Width and Height values from the D3D12_DISPATCH_RAYS_DESC
// structure provided to the originating DispatchRays() call.
DispatchRaysIndex =
145, // The current x and y location within the Width and Height
// Ray Transforms
ObjectToWorld =
151, // Matrix for transforming from object-space to world-space.
WorldToObject =
152, // Matrix for transforming from world-space to object-space.
// Ray Vectors
WorldRayDirection = 148, // The world-space direction for the current ray.
WorldRayOrigin = 147, // The world-space origin for the current ray.
// Ray object space Vectors
ObjectRayDirection = 150, // Object-space direction for the current ray.
ObjectRayOrigin = 149, // Object-space origin for the current ray.
// RayT
RayTCurrent =
154, // float representing the current parametric ending point for the ray
RayTMin =
153, // float representing the parametric starting point for the ray.
// Raytracing hit uint System Values
HitKind = 143, // Returns the value passed as HitKind in ReportIntersection().
// If intersection was reported by fixed-function triangle
// intersection, HitKind will be one of
// HIT_KIND_TRIANGLE_FRONT_FACE or HIT_KIND_TRIANGLE_BACK_FACE.
// Raytracing object space uint System Values, raytracing tier 1.1
GeometryIndex = 213, // The autogenerated index of the current geometry in the
// bottom-level structure
// Raytracing object space uint System Values
InstanceID =
141, // The user-provided InstanceID on the bottom-level acceleration
// structure instance within the top-level structure
InstanceIndex = 142, // The autogenerated index of the current instance in the
// top-level structure
PrimitiveIndex = 161, // PrimitiveIndex for raytracing shaders
// Raytracing uint System Values
RayFlags = 144, // uint containing the current ray flags.
// Resources - gather
TextureGather = 73, // gathers the four texels that would be used in a
// bi-linear filtering operation
TextureGatherCmp = 74, // same as TextureGather, except this instrution
// performs comparison on texels, similar to SampleCmp
TextureGatherRaw = 223, // Gather raw elements from 4 texels with no type
// conversions (SRV type is constrained)
// Resources - sample
RenderTargetGetSampleCount =
77, // gets the number of samples for a render target
RenderTargetGetSamplePosition =
76, // gets the position of the specified sample
Sample = 60, // samples a texture
SampleBias =
61, // samples a texture after applying the input bias to the mipmap level
SampleCmp = 64, // samples a texture and compares a single component against
// the specified comparison value
SampleCmpLevel = 224, // samples a texture and compares a single component
// against the specified comparison value
SampleCmpLevelZero = 65, // samples a texture and compares a single component
// against the specified comparison value
SampleGrad = 63, // samples a texture using a gradient to influence the way
// the sample location is calculated
SampleLevel = 62, // samples a texture using a mipmap-level offset
Texture2DMSGetSamplePosition =
75, // gets the position of the specified sample
// Resources
BufferLoad = 68, // reads from a TypedBuffer
BufferStore = 69, // writes to a RWTypedBuffer
BufferUpdateCounter = 70, // atomically increments/decrements the hidden
// 32-bit counter stored with a Count or Append UAV
CBufferLoad = 58, // loads a value from a constant buffer resource
CBufferLoadLegacy = 59, // loads a value from a constant buffer resource
CheckAccessFullyMapped =
71, // determines whether all values from a Sample, Gather, or Load
// operation accessed mapped tiles in a tiled resource
CreateHandle = 57, // creates the handle to a resource
GetDimensions = 72, // gets texture size information
RawBufferLoad = 139, // reads from a raw buffer and structured buffer
RawBufferStore = 140, // writes to a RWByteAddressBuffer or RWStructuredBuffer
RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer
RawBufferVectorStore =
304, // writes to a RWByteAddressBuffer or RWStructuredBuffer
TextureLoad = 66, // reads texel data without any filtering or sampling
TextureStore = 67, // reads texel data without any filtering or sampling
TextureStoreSample = 225, // stores texel data at specified sample index
// Sampler Feedback
WriteSamplerFeedback =
174, // updates a feedback texture for a sampling operation
WriteSamplerFeedbackBias = 175, // updates a feedback texture for a sampling
// operation with a bias on the mipmap level
WriteSamplerFeedbackGrad = 177, // updates a feedback texture for a sampling
// operation with explicit gradients
WriteSamplerFeedbackLevel = 176, // updates a feedback texture for a sampling
// operation with a mipmap-level offset
// Shader Execution Reordering
HitObject_MakeMiss = 265, // Creates a new HitObject representing a miss
HitObject_MakeNop = 266, // Creates an empty nop HitObject
// Synchronization
AtomicBinOp = 78, // performs an atomic operation on two operands
AtomicCompareExchange = 79, // atomic compare and exchange to memory
Barrier = 80, // inserts a memory barrier in the shader
BarrierByMemoryHandle =
245, // Request a barrier for just the memory used by the specified object
BarrierByMemoryType = 244, // Request a barrier for a set of memory types
// and/or thread group execution sync
BarrierByNodeRecordHandle =
246, // Request a barrier for just the memory used by the node record
// Temporary, indexable, input, output registers
LoadInput = 4, // Loads the value from shader input
MinPrecXRegLoad = 2, // Helper load operation for minprecision
MinPrecXRegStore = 3, // Helper store operation for minprecision
StoreOutput = 5, // Stores the value to shader output
TempRegLoad = 0, // Helper load operation
TempRegStore = 1, // Helper store operation
// Tertiary float
FMad = 46, // floating point multiply & add
Fma = 47, // fused multiply-add
// Tertiary int
IMad = 48, // Signed integer multiply & add
Ibfe = 51, // Integer bitfield extract
Msad = 50, // masked Sum of Absolute Differences.
// Tertiary uint
UMad = 49, // Unsigned integer multiply & add
Ubfe = 52, // Unsigned integer bitfield extract
// Unary float - rounding
Round_ne = 26, // floating-point round to integral float.
Round_ni = 27, // floating-point round to integral float.
Round_pi = 28, // floating-point round to integral float.
Round_z = 29, // floating-point round to integral float.
// Unary float
Acos = 15, // Returns the arccosine of the specified value. Input should be a
// floating-point value within the range of -1 to 1.
Asin = 16, // Returns the arccosine of the specified value. Input should be a
// floating-point value within the range of -1 to 1
Atan = 17, // Returns the arctangent of the specified value. The return value
// is within the range of -PI/2 to PI/2.
Cos = 12, // returns cosine(theta) for theta in radians.
Exp = 21, // returns 2^exponent
FAbs = 6, // returns the absolute value of the input value.
Frc = 22, // extract fracitonal component.
Hcos = 18, // returns the hyperbolic cosine of the specified value.
Hsin = 19, // returns the hyperbolic sine of the specified value.
Htan = 20, // returns the hyperbolic tangent of the specified value.
IsFinite = 10, // Returns true if x is finite, false otherwise.
IsInf = 9, // Returns true if x is +INF or -INF, false otherwise.
IsNaN = 8, // Returns true if x is NAN or QNAN, false otherwise.
IsNormal = 11, // returns IsNormal
Log = 23, // returns log base 2.
Rsqrt = 25, // returns reciprocal square root (1 / sqrt(src)
Saturate = 7, // clamps the result of a single or double precision floating
// point value to [0.0f...1.0f]
Sin = 13, // returns sine(theta) for theta in radians.
Sqrt = 24, // returns square root
Tan = 14, // returns tan(theta) for theta in radians.
// Unary int
Bfrev = 30, // Reverses the order of the bits.
Countbits = 31, // Counts the number of bits in the input integer.
FirstbitLo = 32, // Returns the location of the first set bit starting from
// the lowest order bit and working upward.
FirstbitSHi = 34, // Returns the location of the first set bit from the
// highest order bit based on the sign.
// Unary uint
FirstbitHi = 33, // Returns the location of the first set bit starting from
// the highest order bit and working downward.
// Unpacking intrinsics
Unpack4x8 = 219, // unpacks 4 8-bit signed or unsigned values into int32 or
// int16 vector