DxilConstants.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilConstants.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Essential DXIL constants. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include <stdint.h>
  13. namespace hlsl {
  14. /* <py>
  15. import hctdb_instrhelp
  16. </py> */
  17. // TODO:
  18. // 2. get rid of DXIL namespace.
  19. // 3. use class enum for shader flags.
  20. // 4. use class enum for address spaces.
  21. namespace DXIL {
  22. // DXIL version.
  23. const unsigned kDxilMajor = 1;
  24. /* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_dxil_version_minor()</py>*/
  25. // VALRULE-TEXT:BEGIN
  26. const unsigned kDxilMinor = 6;
  27. // VALRULE-TEXT:END
  28. inline unsigned MakeDxilVersion(unsigned DxilMajor, unsigned DxilMinor) {
  29. return 0 | (DxilMajor << 8) | (DxilMinor);
  30. }
  31. inline unsigned GetCurrentDxilVersion() { return MakeDxilVersion(kDxilMajor, kDxilMinor); }
  32. inline unsigned GetDxilVersionMajor(unsigned DxilVersion) { return (DxilVersion >> 8) & 0xFF; }
  33. inline unsigned GetDxilVersionMinor(unsigned DxilVersion) { return DxilVersion & 0xFF; }
  34. // Return positive if v1 > v2, negative if v1 < v2, zero if equal
  35. inline int CompareVersions(unsigned Major1, unsigned Minor1, unsigned Major2, unsigned Minor2) {
  36. if (Major1 != Major2) {
  37. // Special case for Major == 0 (latest/unbound)
  38. if (Major1 == 0 || Major2 == 0) return Major1 > 0 ? -1 : 1;
  39. return Major1 < Major2 ? -1 : 1;
  40. }
  41. if (Minor1 < Minor2) return -1;
  42. if (Minor1 > Minor2) return 1;
  43. return 0;
  44. }
  45. // Shader flags.
  46. const unsigned kDisableOptimizations = 0x00000001; // D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
  47. const unsigned kDisableMathRefactoring = 0x00000002; //~D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED
  48. const unsigned kEnableDoublePrecision = 0x00000004; // D3D11_SB_GLOBAL_FLAG_ENABLE_DOUBLE_PRECISION_FLOAT_OPS
  49. const unsigned kForceEarlyDepthStencil = 0x00000008; // D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL
  50. const unsigned kEnableRawAndStructuredBuffers = 0x00000010; // D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS
  51. const unsigned kEnableMinPrecision = 0x00000020; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
  52. const unsigned kEnableDoubleExtensions = 0x00000040; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_DOUBLE_EXTENSIONS
  53. const unsigned kEnableMSAD = 0x00000080; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_SHADER_EXTENSIONS
  54. const unsigned kAllResourcesBound = 0x00000100; // D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND
  55. const unsigned kNumOutputStreams = 4;
  56. const unsigned kNumClipPlanes = 6;
  57. // TODO: move these to appropriate places (ShaderModel.cpp?)
  58. const unsigned kMaxTempRegCount = 4096; // DXBC only
  59. const unsigned kMaxCBufferSize = 4096;
  60. const unsigned kMaxStructBufferStride = 2048;
  61. const unsigned kMaxHSOutputControlPointsTotalScalars = 3968;
  62. const unsigned kMaxHSOutputPatchConstantTotalScalars = 32*4;
  63. const unsigned kMaxSignatureTotalVectors = 32;
  64. const unsigned kMaxOutputTotalScalars = kMaxSignatureTotalVectors * 4;
  65. const unsigned kMaxInputTotalScalars = kMaxSignatureTotalVectors * 4;
  66. const unsigned kMaxClipOrCullDistanceElementCount = 2;
  67. const unsigned kMaxClipOrCullDistanceCount = 2 * 4;
  68. const unsigned kMaxGSOutputVertexCount = 1024;
  69. const unsigned kMaxGSInstanceCount = 32;
  70. const unsigned kMaxIAPatchControlPointCount = 32;
  71. const float kHSMaxTessFactorLowerBound = 1.0f;
  72. const float kHSMaxTessFactorUpperBound = 64.0f;
  73. const unsigned kHSDefaultInputControlPointCount = 1;
  74. const unsigned kMaxCSThreadsPerGroup = 1024;
  75. const unsigned kMaxCSThreadGroupX = 1024;
  76. const unsigned kMaxCSThreadGroupY = 1024;
  77. const unsigned kMaxCSThreadGroupZ = 64;
  78. const unsigned kMinCSThreadGroupX = 1;
  79. const unsigned kMinCSThreadGroupY = 1;
  80. const unsigned kMinCSThreadGroupZ = 1;
  81. const unsigned kMaxCS4XThreadsPerGroup = 768;
  82. const unsigned kMaxCS4XThreadGroupX = 768;
  83. const unsigned kMaxCS4XThreadGroupY = 768;
  84. const unsigned kMaxTGSMSize = 8192*4;
  85. const unsigned kMaxGSOutputTotalScalars = 1024;
  86. const unsigned kMaxMSASThreadsPerGroup = 128;
  87. const unsigned kMaxMSASThreadGroupX = 128;
  88. const unsigned kMaxMSASThreadGroupY = 128;
  89. const unsigned kMaxMSASThreadGroupZ = 128;
  90. const unsigned kMinMSASThreadGroupX = 1;
  91. const unsigned kMinMSASThreadGroupY = 1;
  92. const unsigned kMinMSASThreadGroupZ = 1;
  93. const unsigned kMaxMSASPayloadBytes = 1024 * 16;
  94. const unsigned kMaxMSOutputPrimitiveCount = 256;
  95. const unsigned kMaxMSOutputVertexCount = 256;
  96. const unsigned kMaxMSOutputTotalBytes = 1024 * 32;
  97. const unsigned kMaxMSInputOutputTotalBytes = 1024 * 47;
  98. const unsigned kMaxMSVSigRows = 32;
  99. const unsigned kMaxMSPSigRows = 32;
  100. const unsigned kMaxMSTotalSigRows = 32;
  101. const unsigned kMaxMSSMSize = 1024 * 28;
  102. const unsigned kMinWaveSize = 4;
  103. const unsigned kMaxWaveSize = 128;
  104. const float kMaxMipLodBias = 15.99f;
  105. const float kMinMipLodBias = -16.0f;
  106. const unsigned kResRetStatusIndex = 4;
  107. enum class ComponentType : uint32_t {
  108. Invalid = 0,
  109. I1, I16, U16, I32, U32, I64, U64,
  110. F16, F32, F64,
  111. SNormF16, UNormF16, SNormF32, UNormF32, SNormF64, UNormF64,
  112. PackedS8x32, PackedU8x32,
  113. LastEntry };
  114. // Must match D3D_INTERPOLATION_MODE
  115. enum class InterpolationMode : uint8_t {
  116. Undefined = 0,
  117. Constant = 1,
  118. Linear = 2,
  119. LinearCentroid = 3,
  120. LinearNoperspective = 4,
  121. LinearNoperspectiveCentroid = 5,
  122. LinearSample = 6,
  123. LinearNoperspectiveSample = 7,
  124. Invalid = 8
  125. };
  126. // size of each scalar type in signature element in bits
  127. enum class SignatureDataWidth : uint8_t {
  128. Undefined = 0,
  129. Bits16 = 16,
  130. Bits32 = 32,
  131. };
  132. enum class SignatureKind {
  133. Invalid = 0,
  134. Input,
  135. Output,
  136. PatchConstOrPrim,
  137. };
  138. // Must match D3D11_SHADER_VERSION_TYPE
  139. enum class ShaderKind {
  140. Pixel = 0,
  141. Vertex,
  142. Geometry,
  143. Hull,
  144. Domain,
  145. Compute,
  146. Library,
  147. RayGeneration,
  148. Intersection,
  149. AnyHit,
  150. ClosestHit,
  151. Miss,
  152. Callable,
  153. Mesh,
  154. Amplification,
  155. Invalid,
  156. };
  157. /* <py::lines('SemanticKind-ENUM')>hctdb_instrhelp.get_enum_decl("SemanticKind", hide_val=True, sort_val=False)</py>*/
  158. // SemanticKind-ENUM:BEGIN
  159. // Semantic kind; Arbitrary or specific system value.
  160. enum class SemanticKind : unsigned {
  161. Arbitrary,
  162. VertexID,
  163. InstanceID,
  164. Position,
  165. RenderTargetArrayIndex,
  166. ViewPortArrayIndex,
  167. ClipDistance,
  168. CullDistance,
  169. OutputControlPointID,
  170. DomainLocation,
  171. PrimitiveID,
  172. GSInstanceID,
  173. SampleIndex,
  174. IsFrontFace,
  175. Coverage,
  176. InnerCoverage,
  177. Target,
  178. Depth,
  179. DepthLessEqual,
  180. DepthGreaterEqual,
  181. StencilRef,
  182. DispatchThreadID,
  183. GroupID,
  184. GroupIndex,
  185. GroupThreadID,
  186. TessFactor,
  187. InsideTessFactor,
  188. ViewID,
  189. Barycentrics,
  190. ShadingRate,
  191. CullPrimitive,
  192. Invalid,
  193. };
  194. // SemanticKind-ENUM:END
  195. /* <py::lines('SigPointKind-ENUM')>hctdb_instrhelp.get_enum_decl("SigPointKind", hide_val=True, sort_val=False)</py>*/
  196. // SigPointKind-ENUM:BEGIN
  197. // Signature Point is more specific than shader stage or signature as it is unique in both stage and item dimensionality or frequency.
  198. enum class SigPointKind : unsigned {
  199. VSIn, // Ordinary Vertex Shader input from Input Assembler
  200. VSOut, // Ordinary Vertex Shader output that may feed Rasterizer
  201. PCIn, // Patch Constant function non-patch inputs
  202. HSIn, // Hull Shader function non-patch inputs
  203. HSCPIn, // Hull Shader patch inputs - Control Points
  204. HSCPOut, // Hull Shader function output - Control Point
  205. PCOut, // Patch Constant function output - Patch Constant data passed to Domain Shader
  206. DSIn, // Domain Shader regular input - Patch Constant data plus system values
  207. DSCPIn, // Domain Shader patch input - Control Points
  208. DSOut, // Domain Shader output - vertex data that may feed Rasterizer
  209. GSVIn, // Geometry Shader vertex input - qualified with primitive type
  210. GSIn, // Geometry Shader non-vertex inputs (system values)
  211. GSOut, // Geometry Shader output - vertex data that may feed Rasterizer
  212. PSIn, // Pixel Shader input
  213. PSOut, // Pixel Shader output
  214. CSIn, // Compute Shader input
  215. MSIn, // Mesh Shader input
  216. MSOut, // Mesh Shader vertices output
  217. MSPOut, // Mesh Shader primitives output
  218. ASIn, // Amplification Shader input
  219. Invalid,
  220. };
  221. // SigPointKind-ENUM:END
  222. /* <py::lines('SemanticInterpretationKind-ENUM')>hctdb_instrhelp.get_enum_decl("SemanticInterpretationKind", hide_val=True, sort_val=False)</py>*/
  223. // SemanticInterpretationKind-ENUM:BEGIN
  224. // Defines how a semantic is interpreted at a particular SignaturePoint
  225. enum class SemanticInterpretationKind : unsigned {
  226. NA, // Not Available
  227. SV, // Normal System Value
  228. SGV, // System Generated Value (sorted last)
  229. Arb, // Treated as Arbitrary
  230. NotInSig, // Not included in signature (intrinsic access)
  231. NotPacked, // Included in signature, but does not contribute to packing
  232. Target, // Special handling for SV_Target
  233. TessFactor, // Special handling for tessellation factors
  234. Shadow, // Shadow element must be added to a signature for compatibility
  235. ClipCull, // Special packing rules for SV_ClipDistance or SV_CullDistance
  236. Invalid,
  237. };
  238. // SemanticInterpretationKind-ENUM:END
  239. /* <py::lines('PackingKind-ENUM')>hctdb_instrhelp.get_enum_decl("PackingKind", hide_val=True, sort_val=False)</py>*/
  240. // PackingKind-ENUM:BEGIN
  241. // Kind of signature point
  242. enum class PackingKind : unsigned {
  243. None, // No packing should be performed
  244. InputAssembler, // Vertex Shader input from Input Assembler
  245. Vertex, // Vertex that may feed the Rasterizer
  246. PatchConstant, // Patch constant signature
  247. Target, // Render Target (Pixel Shader Output)
  248. Invalid,
  249. };
  250. // PackingKind-ENUM:END
  251. /* <py::lines('FPDenormMode-ENUM')>hctdb_instrhelp.get_enum_decl("Float32DenormMode", hide_val=False, sort_val=False)</py>*/
  252. // FPDenormMode-ENUM:BEGIN
  253. // float32 denorm behavior
  254. enum class Float32DenormMode : unsigned {
  255. Any = 0, // Undefined behavior for denormal numbers
  256. Preserve = 1, // Preserve both input and output
  257. FTZ = 2, // Preserve denormal inputs. Flush denorm outputs
  258. Reserve3 = 3, // Reserved Value. Not used for now
  259. Reserve4 = 4, // Reserved Value. Not used for now
  260. Reserve5 = 5, // Reserved Value. Not used for now
  261. Reserve6 = 6, // Reserved Value. Not used for now
  262. Reserve7 = 7, // Reserved Value. Not used for now
  263. };
  264. // FPDenormMode-ENUM:END
  265. enum class PackingStrategy : unsigned {
  266. Default = 0, // Choose default packing algorithm based on target (currently PrefixStable)
  267. PrefixStable, // Maintain assumption that all elements are packed in order and stable as new elements are added.
  268. Optimized, // Optimize packing of all elements together (all elements must be present, in the same order, for identical placement of any individual element)
  269. Invalid,
  270. };
  271. enum class DefaultLinkage : unsigned {
  272. Default = 0,
  273. Internal = 1,
  274. External = 2,
  275. };
  276. enum class SamplerKind : unsigned {
  277. Default = 0,
  278. Comparison,
  279. Mono,
  280. Invalid,
  281. };
  282. enum class ResourceClass {
  283. SRV = 0,
  284. UAV,
  285. CBuffer,
  286. Sampler,
  287. Invalid
  288. };
  289. enum class ResourceKind : unsigned {
  290. Invalid = 0,
  291. Texture1D,
  292. Texture2D,
  293. Texture2DMS,
  294. Texture3D,
  295. TextureCube,
  296. Texture1DArray,
  297. Texture2DArray,
  298. Texture2DMSArray,
  299. TextureCubeArray,
  300. TypedBuffer,
  301. RawBuffer,
  302. StructuredBuffer,
  303. CBuffer,
  304. Sampler,
  305. TBuffer,
  306. RTAccelerationStructure,
  307. FeedbackTexture2D,
  308. FeedbackTexture2DArray,
  309. NumEntries,
  310. };
  311. inline bool IsAnyTexture(DXIL::ResourceKind ResourceKind) {
  312. return DXIL::ResourceKind::Texture1D <= ResourceKind &&
  313. ResourceKind <= DXIL::ResourceKind::TextureCubeArray;
  314. }
  315. inline bool IsStructuredBuffer(DXIL::ResourceKind ResourceKind) {
  316. return ResourceKind == DXIL::ResourceKind::StructuredBuffer;
  317. }
  318. inline bool IsTypedBuffer(DXIL::ResourceKind ResourceKind) {
  319. return ResourceKind == DXIL::ResourceKind::TypedBuffer;
  320. }
  321. inline bool IsTyped(DXIL::ResourceKind ResourceKind) {
  322. return IsTypedBuffer(ResourceKind) || IsAnyTexture(ResourceKind);
  323. }
  324. inline bool IsRawBuffer(DXIL::ResourceKind ResourceKind) {
  325. return ResourceKind == DXIL::ResourceKind::RawBuffer;
  326. }
  327. inline bool IsTBuffer(DXIL::ResourceKind ResourceKind) {
  328. return ResourceKind == DXIL::ResourceKind::TBuffer;
  329. }
  330. inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) {
  331. return ResourceKind == DXIL::ResourceKind::FeedbackTexture2D ||
  332. ResourceKind == DXIL::ResourceKind::FeedbackTexture2DArray;
  333. }
  334. inline bool IsValidWaveSizeValue(unsigned size) {
  335. // must be power of 2 between 4 and 128
  336. return size >= kMinWaveSize && size <= kMaxWaveSize && (size & (size - 1)) == 0;
  337. }
  338. // TODO: change opcodes.
  339. /* <py::lines('OPCODE-ENUM')>hctdb_instrhelp.get_enum_decl("OpCode")</py>*/
  340. // OPCODE-ENUM:BEGIN
  341. // Enumeration for operations specified by DXIL
  342. enum class OpCode : unsigned {
  343. // Amplification shader instructions
  344. DispatchMesh = 173, // Amplification shader intrinsic DispatchMesh
  345. // AnyHit Terminals
  346. 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
  347. IgnoreHit = 155, // Used in an any hit shader to reject an intersection and terminate the shader
  348. // Binary float
  349. FMax = 35, // returns a if a >= b, else b
  350. FMin = 36, // returns a if a < b, else b
  351. // Binary int with two outputs
  352. IMul = 41, // multiply of 32-bit operands to produce the correct full 64-bit result.
  353. // Binary int
  354. IMax = 37, // IMax(a,b) returns a if a > b, else b
  355. IMin = 38, // IMin(a,b) returns a if a < b, else b
  356. // Binary uint with carry or borrow
  357. UAddc = 44, // unsigned add of 32-bit operand with the carry
  358. USubb = 45, // unsigned subtract of 32-bit operands with the borrow
  359. // Binary uint with two outputs
  360. UDiv = 43, // unsigned divide of the 32-bit operand src0 by the 32-bit operand src1.
  361. UMul = 42, // multiply of 32-bit operands to produce the correct full 64-bit result.
  362. // Binary uint
  363. UMax = 39, // unsigned integer maximum. UMax(a,b) = a > b ? a : b
  364. UMin = 40, // unsigned integer minimum. UMin(a,b) = a < b ? a : b
  365. // Bitcasts with different sizes
  366. BitcastF16toI16 = 125, // bitcast between different sizes
  367. BitcastF32toI32 = 127, // bitcast between different sizes
  368. BitcastF64toI64 = 129, // bitcast between different sizes
  369. BitcastI16toF16 = 124, // bitcast between different sizes
  370. BitcastI32toF32 = 126, // bitcast between different sizes
  371. BitcastI64toF64 = 128, // bitcast between different sizes
  372. // Compute/Mesh/Amplification shader
  373. FlattenedThreadIdInGroup = 96, // provides a flattened index for a given thread within a given group (SV_GroupIndex)
  374. GroupId = 94, // reads the group ID (SV_GroupID)
  375. ThreadId = 93, // reads the thread ID
  376. ThreadIdInGroup = 95, // reads the thread ID within the group (SV_GroupThreadID)
  377. // Derivatives
  378. CalculateLOD = 81, // calculates the level of detail
  379. DerivCoarseX = 83, // computes the rate of change per stamp in x direction.
  380. DerivCoarseY = 84, // computes the rate of change per stamp in y direction.
  381. DerivFineX = 85, // computes the rate of change per pixel in x direction.
  382. DerivFineY = 86, // computes the rate of change per pixel in y direction.
  383. // Domain and hull shader
  384. LoadOutputControlPoint = 103, // LoadOutputControlPoint
  385. LoadPatchConstant = 104, // LoadPatchConstant
  386. // Domain shader
  387. DomainLocation = 105, // DomainLocation
  388. // Dot product with accumulate
  389. Dot2AddHalf = 162, // 2D half dot product with accumulate to float
  390. Dot4AddI8Packed = 163, // signed dot product of 4 x i8 vectors packed into i32, with accumulate to i32
  391. Dot4AddU8Packed = 164, // unsigned dot product of 4 x u8 vectors packed into i32, with accumulate to i32
  392. // Dot
  393. Dot2 = 54, // Two-dimensional vector dot-product
  394. Dot3 = 55, // Three-dimensional vector dot-product
  395. Dot4 = 56, // Four-dimensional vector dot-product
  396. // Double precision
  397. LegacyDoubleToFloat = 132, // legacy fuction to convert double to float
  398. LegacyDoubleToSInt32 = 133, // legacy fuction to convert double to int32
  399. LegacyDoubleToUInt32 = 134, // legacy fuction to convert double to uint32
  400. MakeDouble = 101, // creates a double value
  401. SplitDouble = 102, // splits a double into low and high parts
  402. // Geometry shader
  403. CutStream = 98, // completes the current primitive topology at the specified stream
  404. EmitStream = 97, // emits a vertex to a given stream
  405. EmitThenCutStream = 99, // equivalent to an EmitStream followed by a CutStream
  406. GSInstanceID = 100, // GSInstanceID
  407. // Get handle from heap
  408. AnnotateHandle = 216, // annotate handle with resource properties
  409. CreateHandleFromBinding = 217, // create resource handle from binding
  410. CreateHandleFromHeap = 218, // create resource handle from heap
  411. // Graphics shader
  412. ViewID = 138, // returns the view index
  413. // Helper Lanes
  414. IsHelperLane = 221, // returns true on helper lanes in pixel shaders
  415. // Hull shader
  416. OutputControlPointID = 107, // OutputControlPointID
  417. StorePatchConstant = 106, // StorePatchConstant
  418. // Hull, Domain and Geometry shaders
  419. PrimitiveID = 108, // PrimitiveID
  420. // Indirect Shader Invocation
  421. CallShader = 159, // Call a shader in the callable shader table supplied through the DispatchRays() API
  422. ReportHit = 158, // returns true if hit was accepted
  423. TraceRay = 157, // initiates raytrace
  424. // Inline Ray Query
  425. AllocateRayQuery = 178, // allocates space for RayQuery and return handle
  426. RayQuery_Abort = 181, // aborts a ray query
  427. RayQuery_CandidateGeometryIndex = 203, // returns candidate hit geometry index
  428. RayQuery_CandidateInstanceContributionToHitGroupIndex = 214, // returns candidate hit InstanceContributionToHitGroupIndex
  429. RayQuery_CandidateInstanceID = 202, // returns candidate hit instance ID
  430. RayQuery_CandidateInstanceIndex = 201, // returns candidate hit instance index
  431. RayQuery_CandidateObjectRayDirection = 206, // returns candidate object ray direction
  432. RayQuery_CandidateObjectRayOrigin = 205, // returns candidate hit object ray origin
  433. RayQuery_CandidateObjectToWorld3x4 = 186, // returns matrix for transforming from object-space to world-space for a candidate hit.
  434. RayQuery_CandidatePrimitiveIndex = 204, // returns candidate hit geometry index
  435. RayQuery_CandidateProceduralPrimitiveNonOpaque = 190, // returns if current candidate procedural primitive is non opaque
  436. RayQuery_CandidateTriangleBarycentrics = 193, // returns candidate triangle hit barycentrics
  437. RayQuery_CandidateTriangleFrontFace = 191, // returns if current candidate triangle is front facing
  438. RayQuery_CandidateTriangleRayT = 199, // returns float representing the parametric point on the ray for the current candidate triangle hit.
  439. RayQuery_CandidateType = 185, // returns uint candidate type (CANDIDATE_TYPE) of the current hit candidate in a ray query, after Proceed() has returned true
  440. RayQuery_CandidateWorldToObject3x4 = 187, // returns matrix for transforming from world-space to object-space for a candidate hit.
  441. RayQuery_CommitNonOpaqueTriangleHit = 182, // commits a non opaque triangle hit
  442. RayQuery_CommitProceduralPrimitiveHit = 183, // commits a procedural primitive hit
  443. RayQuery_CommittedGeometryIndex = 209, // returns committed hit geometry index
  444. RayQuery_CommittedInstanceContributionToHitGroupIndex = 215, // returns committed hit InstanceContributionToHitGroupIndex
  445. RayQuery_CommittedInstanceID = 208, // returns committed hit instance ID
  446. RayQuery_CommittedInstanceIndex = 207, // returns committed hit instance index
  447. RayQuery_CommittedObjectRayDirection = 212, // returns committed object ray direction
  448. RayQuery_CommittedObjectRayOrigin = 211, // returns committed hit object ray origin
  449. RayQuery_CommittedObjectToWorld3x4 = 188, // returns matrix for transforming from object-space to world-space for a Committed hit.
  450. RayQuery_CommittedPrimitiveIndex = 210, // returns committed hit geometry index
  451. RayQuery_CommittedRayT = 200, // returns float representing the parametric point on the ray for the current committed hit.
  452. RayQuery_CommittedStatus = 184, // returns uint status (COMMITTED_STATUS) of the committed hit in a ray query
  453. RayQuery_CommittedTriangleBarycentrics = 194, // returns committed triangle hit barycentrics
  454. RayQuery_CommittedTriangleFrontFace = 192, // returns if current committed triangle is front facing
  455. RayQuery_CommittedWorldToObject3x4 = 189, // returns matrix for transforming from world-space to object-space for a Committed hit.
  456. RayQuery_Proceed = 180, // advances a ray query
  457. RayQuery_RayFlags = 195, // returns ray flags
  458. RayQuery_RayTMin = 198, // returns float representing the parametric starting point for the ray.
  459. RayQuery_TraceRayInline = 179, // initializes RayQuery for raytrace
  460. RayQuery_WorldRayDirection = 197, // returns world ray direction
  461. RayQuery_WorldRayOrigin = 196, // returns world ray origin
  462. // Legacy floating-point
  463. LegacyF16ToF32 = 131, // legacy fuction to convert half (f16) to float (f32) (this is not related to min-precision)
  464. LegacyF32ToF16 = 130, // legacy fuction to convert float (f32) to half (f16) (this is not related to min-precision)
  465. // Library create handle from resource struct (like HL intrinsic)
  466. CreateHandleForLib = 160, // create resource handle from resource struct for library
  467. // Mesh shader instructions
  468. EmitIndices = 169, // emit a primitive's vertex indices in a mesh shader
  469. GetMeshPayload = 170, // get the mesh payload which is from amplification shader
  470. SetMeshOutputCounts = 168, // Mesh shader intrinsic SetMeshOutputCounts
  471. StorePrimitiveOutput = 172, // stores the value to mesh shader primitive output
  472. StoreVertexOutput = 171, // stores the value to mesh shader vertex output
  473. // Other
  474. CycleCounterLegacy = 109, // CycleCounterLegacy
  475. // Packing intrinsics
  476. Pack4x8 = 220, // packs vector of 4 signed or unsigned values into a packed datatype, drops or clamps unused bits
  477. // Pixel shader
  478. AttributeAtVertex = 137, // returns the values of the attributes at the vertex.
  479. Coverage = 91, // returns the coverage mask input in a pixel shader
  480. Discard = 82, // discard the current pixel
  481. EvalCentroid = 89, // evaluates an input attribute at pixel center
  482. EvalSampleIndex = 88, // evaluates an input attribute at a sample location
  483. EvalSnapped = 87, // evaluates an input attribute at pixel center with an offset
  484. InnerCoverage = 92, // returns underestimated coverage input from conservative rasterization in a pixel shader
  485. SampleIndex = 90, // returns the sample index in a sample-frequency pixel shader
  486. // Quad Wave Ops
  487. QuadOp = 123, // returns the result of a quad-level operation
  488. QuadReadLaneAt = 122, // reads from a lane in the quad
  489. // Quaternary
  490. Bfi = 53, // Given a bit range from the LSB of a number, places that number of bits in another number at any offset
  491. // Ray Dispatch Arguments
  492. DispatchRaysDimensions = 146, // The Width and Height values from the D3D12_DISPATCH_RAYS_DESC structure provided to the originating DispatchRays() call.
  493. DispatchRaysIndex = 145, // The current x and y location within the Width and Height
  494. // Ray Transforms
  495. ObjectToWorld = 151, // Matrix for transforming from object-space to world-space.
  496. WorldToObject = 152, // Matrix for transforming from world-space to object-space.
  497. // Ray Vectors
  498. WorldRayDirection = 148, // The world-space direction for the current ray.
  499. WorldRayOrigin = 147, // The world-space origin for the current ray.
  500. // Ray object space Vectors
  501. ObjectRayDirection = 150, // Object-space direction for the current ray.
  502. ObjectRayOrigin = 149, // Object-space origin for the current ray.
  503. // RayT
  504. RayTCurrent = 154, // float representing the current parametric ending point for the ray
  505. RayTMin = 153, // float representing the parametric starting point for the ray.
  506. // Raytracing hit uint System Values
  507. 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.
  508. // Raytracing object space uint System Values, raytracing tier 1.1
  509. GeometryIndex = 213, // The autogenerated index of the current geometry in the bottom-level structure
  510. // Raytracing object space uint System Values
  511. InstanceID = 141, // The user-provided InstanceID on the bottom-level acceleration structure instance within the top-level structure
  512. InstanceIndex = 142, // The autogenerated index of the current instance in the top-level structure
  513. PrimitiveIndex = 161, // PrimitiveIndex for raytracing shaders
  514. // Raytracing uint System Values
  515. RayFlags = 144, // uint containing the current ray flags.
  516. // Resources - gather
  517. TextureGather = 73, // gathers the four texels that would be used in a bi-linear filtering operation
  518. TextureGatherCmp = 74, // same as TextureGather, except this instrution performs comparison on texels, similar to SampleCmp
  519. // Resources - sample
  520. RenderTargetGetSampleCount = 77, // gets the number of samples for a render target
  521. RenderTargetGetSamplePosition = 76, // gets the position of the specified sample
  522. Sample = 60, // samples a texture
  523. SampleBias = 61, // samples a texture after applying the input bias to the mipmap level
  524. SampleCmp = 64, // samples a texture and compares a single component against the specified comparison value
  525. SampleCmpLevelZero = 65, // samples a texture and compares a single component against the specified comparison value
  526. SampleGrad = 63, // samples a texture using a gradient to influence the way the sample location is calculated
  527. SampleLevel = 62, // samples a texture using a mipmap-level offset
  528. Texture2DMSGetSamplePosition = 75, // gets the position of the specified sample
  529. // Resources
  530. BufferLoad = 68, // reads from a TypedBuffer
  531. BufferStore = 69, // writes to a RWTypedBuffer
  532. BufferUpdateCounter = 70, // atomically increments/decrements the hidden 32-bit counter stored with a Count or Append UAV
  533. CBufferLoad = 58, // loads a value from a constant buffer resource
  534. CBufferLoadLegacy = 59, // loads a value from a constant buffer resource
  535. CheckAccessFullyMapped = 71, // determines whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource
  536. CreateHandle = 57, // creates the handle to a resource
  537. GetDimensions = 72, // gets texture size information
  538. RawBufferLoad = 139, // reads from a raw buffer and structured buffer
  539. RawBufferStore = 140, // writes to a RWByteAddressBuffer or RWStructuredBuffer
  540. TextureLoad = 66, // reads texel data without any filtering or sampling
  541. TextureStore = 67, // reads texel data without any filtering or sampling
  542. // Sampler Feedback
  543. WriteSamplerFeedback = 174, // updates a feedback texture for a sampling operation
  544. WriteSamplerFeedbackBias = 175, // updates a feedback texture for a sampling operation with a bias on the mipmap level
  545. WriteSamplerFeedbackGrad = 177, // updates a feedback texture for a sampling operation with explicit gradients
  546. WriteSamplerFeedbackLevel = 176, // updates a feedback texture for a sampling operation with a mipmap-level offset
  547. // Synchronization
  548. AtomicBinOp = 78, // performs an atomic operation on two operands
  549. AtomicCompareExchange = 79, // atomic compare and exchange to memory
  550. Barrier = 80, // inserts a memory barrier in the shader
  551. // Temporary, indexable, input, output registers
  552. LoadInput = 4, // Loads the value from shader input
  553. MinPrecXRegLoad = 2, // Helper load operation for minprecision
  554. MinPrecXRegStore = 3, // Helper store operation for minprecision
  555. StoreOutput = 5, // Stores the value to shader output
  556. TempRegLoad = 0, // Helper load operation
  557. TempRegStore = 1, // Helper store operation
  558. // Tertiary float
  559. FMad = 46, // floating point multiply & add
  560. Fma = 47, // fused multiply-add
  561. // Tertiary int
  562. IMad = 48, // Signed integer multiply & add
  563. Ibfe = 51, // Integer bitfield extract
  564. Msad = 50, // masked Sum of Absolute Differences.
  565. // Tertiary uint
  566. UMad = 49, // Unsigned integer multiply & add
  567. Ubfe = 52, // Unsigned integer bitfield extract
  568. // Unary float - rounding
  569. Round_ne = 26, // floating-point round to integral float.
  570. Round_ni = 27, // floating-point round to integral float.
  571. Round_pi = 28, // floating-point round to integral float.
  572. Round_z = 29, // floating-point round to integral float.
  573. // Unary float
  574. Acos = 15, // Returns the arccosine of the specified value. Input should be a floating-point value within the range of -1 to 1.
  575. Asin = 16, // Returns the arccosine of the specified value. Input should be a floating-point value within the range of -1 to 1
  576. Atan = 17, // Returns the arctangent of the specified value. The return value is within the range of -PI/2 to PI/2.
  577. Cos = 12, // returns cosine(theta) for theta in radians.
  578. Exp = 21, // returns 2^exponent
  579. FAbs = 6, // returns the absolute value of the input value.
  580. Frc = 22, // extract fracitonal component.
  581. Hcos = 18, // returns the hyperbolic cosine of the specified value.
  582. Hsin = 19, // returns the hyperbolic sine of the specified value.
  583. Htan = 20, // returns the hyperbolic tangent of the specified value.
  584. IsFinite = 10, // Returns true if x is finite, false otherwise.
  585. IsInf = 9, // Returns true if x is +INF or -INF, false otherwise.
  586. IsNaN = 8, // Returns true if x is NAN or QNAN, false otherwise.
  587. IsNormal = 11, // returns IsNormal
  588. Log = 23, // returns log base 2.
  589. Rsqrt = 25, // returns reciprocal square root (1 / sqrt(src)
  590. Saturate = 7, // clamps the result of a single or double precision floating point value to [0.0f...1.0f]
  591. Sin = 13, // returns sine(theta) for theta in radians.
  592. Sqrt = 24, // returns square root
  593. Tan = 14, // returns tan(theta) for theta in radians.
  594. // Unary int
  595. Bfrev = 30, // Reverses the order of the bits.
  596. Countbits = 31, // Counts the number of bits in the input integer.
  597. FirstbitLo = 32, // Returns the location of the first set bit starting from the lowest order bit and working upward.
  598. FirstbitSHi = 34, // Returns the location of the first set bit from the highest order bit based on the sign.
  599. // Unary uint
  600. FirstbitHi = 33, // Returns the location of the first set bit starting from the highest order bit and working downward.
  601. // Unpacking intrinsics
  602. Unpack4x8 = 219, // unpacks 4 8-bit signed or unsigned values into int32 or int16 vector
  603. // Wave
  604. WaveActiveAllEqual = 115, // returns 1 if all the lanes have the same value
  605. WaveActiveBallot = 116, // returns a struct with a bit set for each lane where the condition is true
  606. WaveActiveBit = 120, // returns the result of the operation across all lanes
  607. WaveActiveOp = 119, // returns the result the operation across waves
  608. WaveAllBitCount = 135, // returns the count of bits set to 1 across the wave
  609. WaveAllTrue = 114, // returns 1 if all the lanes evaluate the value to true
  610. WaveAnyTrue = 113, // returns 1 if any of the lane evaluates the value to true
  611. WaveGetLaneCount = 112, // returns the number of lanes in the wave
  612. WaveGetLaneIndex = 111, // returns the index of the current lane in the wave
  613. WaveIsFirstLane = 110, // returns 1 for the first lane in the wave
  614. WaveMatch = 165, // returns the bitmask of active lanes that have the same value
  615. WaveMultiPrefixBitCount = 167, // returns the count of bits set to 1 on groups of lanes identified by a bitmask
  616. WaveMultiPrefixOp = 166, // returns the result of the operation on groups of lanes identified by a bitmask
  617. WavePrefixBitCount = 136, // returns the count of bits set to 1 on prior lanes
  618. WavePrefixOp = 121, // returns the result of the operation on prior lanes
  619. WaveReadLaneAt = 117, // returns the value from the specified lane
  620. WaveReadLaneFirst = 118, // returns the value from the first lane
  621. NumOpCodes_Dxil_1_0 = 137,
  622. NumOpCodes_Dxil_1_1 = 139,
  623. NumOpCodes_Dxil_1_2 = 141,
  624. NumOpCodes_Dxil_1_3 = 162,
  625. NumOpCodes_Dxil_1_4 = 165,
  626. NumOpCodes_Dxil_1_5 = 216,
  627. NumOpCodes_Dxil_1_6 = 222,
  628. NumOpCodes = 222 // exclusive last value of enumeration
  629. };
  630. // OPCODE-ENUM:END
  631. /* <py::lines('OPCODECLASS-ENUM')>hctdb_instrhelp.get_enum_decl("OpCodeClass")</py>*/
  632. // OPCODECLASS-ENUM:BEGIN
  633. // Groups for DXIL operations with equivalent function templates
  634. enum class OpCodeClass : unsigned {
  635. // Amplification shader instructions
  636. DispatchMesh,
  637. // AnyHit Terminals
  638. AcceptHitAndEndSearch,
  639. IgnoreHit,
  640. // Binary uint with carry or borrow
  641. BinaryWithCarryOrBorrow,
  642. // Binary uint with two outputs
  643. BinaryWithTwoOuts,
  644. // Binary uint
  645. Binary,
  646. // Bitcasts with different sizes
  647. BitcastF16toI16,
  648. BitcastF32toI32,
  649. BitcastF64toI64,
  650. BitcastI16toF16,
  651. BitcastI32toF32,
  652. BitcastI64toF64,
  653. // Compute/Mesh/Amplification shader
  654. FlattenedThreadIdInGroup,
  655. GroupId,
  656. ThreadId,
  657. ThreadIdInGroup,
  658. // Derivatives
  659. CalculateLOD,
  660. Unary,
  661. // Domain and hull shader
  662. LoadOutputControlPoint,
  663. LoadPatchConstant,
  664. // Domain shader
  665. DomainLocation,
  666. // Dot product with accumulate
  667. Dot2AddHalf,
  668. Dot4AddPacked,
  669. // Dot
  670. Dot2,
  671. Dot3,
  672. Dot4,
  673. // Double precision
  674. LegacyDoubleToFloat,
  675. LegacyDoubleToSInt32,
  676. LegacyDoubleToUInt32,
  677. MakeDouble,
  678. SplitDouble,
  679. // Geometry shader
  680. CutStream,
  681. EmitStream,
  682. EmitThenCutStream,
  683. GSInstanceID,
  684. // Get handle from heap
  685. AnnotateHandle,
  686. CreateHandleFromBinding,
  687. CreateHandleFromHeap,
  688. // Graphics shader
  689. ViewID,
  690. // Helper Lanes
  691. IsHelperLane,
  692. // Hull shader
  693. OutputControlPointID,
  694. StorePatchConstant,
  695. // Hull, Domain and Geometry shaders
  696. PrimitiveID,
  697. // Indirect Shader Invocation
  698. CallShader,
  699. ReportHit,
  700. TraceRay,
  701. // Inline Ray Query
  702. AllocateRayQuery,
  703. RayQuery_Abort,
  704. RayQuery_CommitNonOpaqueTriangleHit,
  705. RayQuery_CommitProceduralPrimitiveHit,
  706. RayQuery_Proceed,
  707. RayQuery_StateMatrix,
  708. RayQuery_StateScalar,
  709. RayQuery_StateVector,
  710. RayQuery_TraceRayInline,
  711. // LLVM Instructions
  712. LlvmInst,
  713. // Legacy floating-point
  714. LegacyF16ToF32,
  715. LegacyF32ToF16,
  716. // Library create handle from resource struct (like HL intrinsic)
  717. CreateHandleForLib,
  718. // Mesh shader instructions
  719. EmitIndices,
  720. GetMeshPayload,
  721. SetMeshOutputCounts,
  722. StorePrimitiveOutput,
  723. StoreVertexOutput,
  724. // Other
  725. CycleCounterLegacy,
  726. // Packing intrinsics
  727. Pack4x8,
  728. // Pixel shader
  729. AttributeAtVertex,
  730. Coverage,
  731. Discard,
  732. EvalCentroid,
  733. EvalSampleIndex,
  734. EvalSnapped,
  735. InnerCoverage,
  736. SampleIndex,
  737. // Quad Wave Ops
  738. QuadOp,
  739. QuadReadLaneAt,
  740. // Quaternary
  741. Quaternary,
  742. // Ray Dispatch Arguments
  743. DispatchRaysDimensions,
  744. DispatchRaysIndex,
  745. // Ray Transforms
  746. ObjectToWorld,
  747. WorldToObject,
  748. // Ray Vectors
  749. WorldRayDirection,
  750. WorldRayOrigin,
  751. // Ray object space Vectors
  752. ObjectRayDirection,
  753. ObjectRayOrigin,
  754. // RayT
  755. RayTCurrent,
  756. RayTMin,
  757. // Raytracing hit uint System Values
  758. HitKind,
  759. // Raytracing object space uint System Values, raytracing tier 1.1
  760. GeometryIndex,
  761. // Raytracing object space uint System Values
  762. InstanceID,
  763. InstanceIndex,
  764. PrimitiveIndex,
  765. // Raytracing uint System Values
  766. RayFlags,
  767. // Resources - gather
  768. TextureGather,
  769. TextureGatherCmp,
  770. // Resources - sample
  771. RenderTargetGetSampleCount,
  772. RenderTargetGetSamplePosition,
  773. Sample,
  774. SampleBias,
  775. SampleCmp,
  776. SampleCmpLevelZero,
  777. SampleGrad,
  778. SampleLevel,
  779. Texture2DMSGetSamplePosition,
  780. // Resources
  781. BufferLoad,
  782. BufferStore,
  783. BufferUpdateCounter,
  784. CBufferLoad,
  785. CBufferLoadLegacy,
  786. CheckAccessFullyMapped,
  787. CreateHandle,
  788. GetDimensions,
  789. RawBufferLoad,
  790. RawBufferStore,
  791. TextureLoad,
  792. TextureStore,
  793. // Sampler Feedback
  794. WriteSamplerFeedback,
  795. WriteSamplerFeedbackBias,
  796. WriteSamplerFeedbackGrad,
  797. WriteSamplerFeedbackLevel,
  798. // Synchronization
  799. AtomicBinOp,
  800. AtomicCompareExchange,
  801. Barrier,
  802. // Temporary, indexable, input, output registers
  803. LoadInput,
  804. MinPrecXRegLoad,
  805. MinPrecXRegStore,
  806. StoreOutput,
  807. TempRegLoad,
  808. TempRegStore,
  809. // Tertiary uint
  810. Tertiary,
  811. // Unary float
  812. IsSpecialFloat,
  813. // Unary int
  814. UnaryBits,
  815. // Unpacking intrinsics
  816. Unpack4x8,
  817. // Wave
  818. WaveActiveAllEqual,
  819. WaveActiveBallot,
  820. WaveActiveBit,
  821. WaveActiveOp,
  822. WaveAllOp,
  823. WaveAllTrue,
  824. WaveAnyTrue,
  825. WaveGetLaneCount,
  826. WaveGetLaneIndex,
  827. WaveIsFirstLane,
  828. WaveMatch,
  829. WaveMultiPrefixBitCount,
  830. WaveMultiPrefixOp,
  831. WavePrefixOp,
  832. WaveReadLaneAt,
  833. WaveReadLaneFirst,
  834. NumOpClasses_Dxil_1_0 = 93,
  835. NumOpClasses_Dxil_1_1 = 95,
  836. NumOpClasses_Dxil_1_2 = 97,
  837. NumOpClasses_Dxil_1_3 = 118,
  838. NumOpClasses_Dxil_1_4 = 120,
  839. NumOpClasses_Dxil_1_5 = 143,
  840. NumOpClasses_Dxil_1_6 = 149,
  841. NumOpClasses = 149 // exclusive last value of enumeration
  842. };
  843. // OPCODECLASS-ENUM:END
  844. // Operand Index for every OpCodeClass.
  845. namespace OperandIndex {
  846. // Opcode is always operand 0.
  847. const unsigned kOpcodeIdx = 0;
  848. // Unary operators.
  849. const unsigned kUnarySrc0OpIdx = 1;
  850. // Binary operators.
  851. const unsigned kBinarySrc0OpIdx = 1;
  852. const unsigned kBinarySrc1OpIdx = 2;
  853. // Trinary operators.
  854. const unsigned kTrinarySrc0OpIdx = 1;
  855. const unsigned kTrinarySrc1OpIdx = 2;
  856. const unsigned kTrinarySrc2OpIdx = 3;
  857. // LoadInput.
  858. const unsigned kLoadInputIDOpIdx = 1;
  859. const unsigned kLoadInputRowOpIdx = 2;
  860. const unsigned kLoadInputColOpIdx = 3;
  861. const unsigned kLoadInputVertexIDOpIdx = 4;
  862. // StoreOutput, StoreVertexOutput, StorePrimitiveOutput
  863. const unsigned kStoreOutputIDOpIdx = 1;
  864. const unsigned kStoreOutputRowOpIdx = 2;
  865. const unsigned kStoreOutputColOpIdx = 3;
  866. const unsigned kStoreOutputValOpIdx = 4;
  867. const unsigned kStoreOutputVPIDOpIdx = 5;
  868. // DomainLocation.
  869. const unsigned kDomainLocationColOpIdx = 1;
  870. // BufferLoad.
  871. const unsigned kBufferLoadHandleOpIdx = 1;
  872. const unsigned kBufferLoadCoord0OpIdx = 2;
  873. const unsigned kBufferLoadCoord1OpIdx = 3;
  874. // BufferStore.
  875. const unsigned kBufferStoreHandleOpIdx = 1;
  876. const unsigned kBufferStoreCoord0OpIdx = 2;
  877. const unsigned kBufferStoreCoord1OpIdx = 3;
  878. const unsigned kBufferStoreVal0OpIdx = 4;
  879. const unsigned kBufferStoreVal1OpIdx = 5;
  880. const unsigned kBufferStoreVal2OpIdx = 6;
  881. const unsigned kBufferStoreVal3OpIdx = 7;
  882. const unsigned kBufferStoreMaskOpIdx = 8;
  883. // RawBufferLoad.
  884. const unsigned kRawBufferLoadHandleOpIdx = 1;
  885. const unsigned kRawBufferLoadIndexOpIdx = 2;
  886. const unsigned kRawBufferLoadElementOffsetOpIdx = 3;
  887. const unsigned kRawBufferLoadMaskOpIdx = 4;
  888. const unsigned kRawBufferLoadAlignmentOpIdx = 5;
  889. // RawBufferStore
  890. const unsigned kRawBufferStoreHandleOpIdx = 1;
  891. const unsigned kRawBufferStoreIndexOpIdx = 2;
  892. const unsigned kRawBufferStoreElementOffsetOpIdx = 3;
  893. const unsigned kRawBufferStoreVal0OpIdx = 4;
  894. const unsigned kRawBufferStoreVal1OpIdx = 5;
  895. const unsigned kRawBufferStoreVal2OpIdx = 6;
  896. const unsigned kRawBufferStoreVal3OpIdx = 7;
  897. const unsigned kRawBufferStoreMaskOpIdx = 8;
  898. const unsigned kRawBufferStoreAlignmentOpIdx = 8;
  899. // TextureStore.
  900. const unsigned kTextureStoreHandleOpIdx = 1;
  901. const unsigned kTextureStoreCoord0OpIdx = 2;
  902. const unsigned kTextureStoreCoord1OpIdx = 3;
  903. const unsigned kTextureStoreCoord2OpIdx = 4;
  904. const unsigned kTextureStoreVal0OpIdx = 5;
  905. const unsigned kTextureStoreVal1OpIdx = 6;
  906. const unsigned kTextureStoreVal2OpIdx = 7;
  907. const unsigned kTextureStoreVal3OpIdx = 8;
  908. const unsigned kTextureStoreMaskOpIdx = 9;
  909. // TextureGather.
  910. const unsigned kTextureGatherTexHandleOpIdx = 1;
  911. const unsigned kTextureGatherSamplerHandleOpIdx = 2;
  912. const unsigned kTextureGatherCoord0OpIdx = 3;
  913. const unsigned kTextureGatherCoord1OpIdx = 4;
  914. const unsigned kTextureGatherCoord2OpIdx = 5;
  915. const unsigned kTextureGatherCoord3OpIdx = 6;
  916. const unsigned kTextureGatherOffset0OpIdx = 7;
  917. const unsigned kTextureGatherOffset1OpIdx = 8;
  918. const unsigned kTextureGatherOffset2OpIdx = 9;
  919. const unsigned kTextureGatherChannelOpIdx = 10;
  920. // TextureGatherCmp.
  921. const unsigned kTextureGatherCmpCmpValOpIdx = 11;
  922. // TextureSample.
  923. const unsigned kTextureSampleTexHandleOpIdx = 1;
  924. const unsigned kTextureSampleSamplerHandleOpIdx = 2;
  925. const unsigned kTextureSampleCoord0OpIdx = 3;
  926. const unsigned kTextureSampleCoord1OpIdx = 4;
  927. const unsigned kTextureSampleCoord2OpIdx = 5;
  928. const unsigned kTextureSampleCoord3OpIdx = 6;
  929. const unsigned kTextureSampleOffset0OpIdx = 7;
  930. const unsigned kTextureSampleOffset1OpIdx = 8;
  931. const unsigned kTextureSampleOffset2OpIdx = 9;
  932. const unsigned kTextureSampleClampOpIdx = 10;
  933. // AtomicBinOp.
  934. const unsigned kAtomicBinOpHandleOpIdx = 1;
  935. const unsigned kAtomicBinOpCoord0OpIdx = 3;
  936. const unsigned kAtomicBinOpCoord1OpIdx = 4;
  937. const unsigned kAtomicBinOpCoord2OpIdx = 5;
  938. // AtomicCmpExchange.
  939. const unsigned kAtomicCmpExchangeCoord0OpIdx = 2;
  940. const unsigned kAtomicCmpExchangeCoord1OpIdx = 3;
  941. const unsigned kAtomicCmpExchangeCoord2OpIdx = 4;
  942. // CreateHandle
  943. const unsigned kCreateHandleResClassOpIdx = 1;
  944. const unsigned kCreateHandleResIDOpIdx = 2;
  945. const unsigned kCreateHandleResIndexOpIdx = 3;
  946. const unsigned kCreateHandleIsUniformOpIdx = 4;
  947. // CreateHandleFromResource
  948. const unsigned kCreateHandleForLibResOpIdx = 1;
  949. // TraceRay
  950. const unsigned kTraceRayRayDescOpIdx = 7;
  951. const unsigned kTraceRayPayloadOpIdx = 15;
  952. const unsigned kTraceRayNumOp = 16;
  953. // TraceRayInline
  954. const unsigned kTraceRayInlineRayDescOpIdx = 5;
  955. const unsigned kTraceRayInlineNumOp = 13;
  956. // Emit/Cut
  957. const unsigned kStreamEmitCutIDOpIdx = 1;
  958. // StoreVectorOutput/StorePrimitiveOutput.
  959. const unsigned kMSStoreOutputIDOpIdx = 1;
  960. const unsigned kMSStoreOutputRowOpIdx = 2;
  961. const unsigned kMSStoreOutputColOpIdx = 3;
  962. const unsigned kMSStoreOutputVIdxOpIdx = 4;
  963. const unsigned kMSStoreOutputValOpIdx = 5;
  964. // TODO: add operand index for all the OpCodeClass.
  965. }
  966. // Atomic binary operation kind.
  967. enum class AtomicBinOpCode : unsigned {
  968. Add,
  969. And,
  970. Or,
  971. Xor,
  972. IMin,
  973. IMax,
  974. UMin,
  975. UMax,
  976. Exchange,
  977. Invalid // Must be last.
  978. };
  979. // Barrier/fence modes.
  980. enum class BarrierMode : unsigned {
  981. SyncThreadGroup = 0x00000001,
  982. UAVFenceGlobal = 0x00000002,
  983. UAVFenceThreadGroup = 0x00000004,
  984. TGSMFence = 0x00000008,
  985. };
  986. // Address space.
  987. const unsigned kDefaultAddrSpace = 0;
  988. const unsigned kDeviceMemoryAddrSpace = 1;
  989. const unsigned kCBufferAddrSpace = 2;
  990. const unsigned kTGSMAddrSpace = 3;
  991. const unsigned kGenericPointerAddrSpace = 4;
  992. const unsigned kImmediateCBufferAddrSpace = 5;
  993. // Input primitive, must match D3D_PRIMITIVE
  994. enum class InputPrimitive : unsigned {
  995. Undefined = 0,
  996. Point = 1,
  997. Line = 2,
  998. Triangle = 3,
  999. Reserved4 = 4,
  1000. Reserved5 = 5,
  1001. LineWithAdjacency = 6,
  1002. TriangleWithAdjacency = 7,
  1003. ControlPointPatch1 = 8,
  1004. ControlPointPatch2 = 9,
  1005. ControlPointPatch3 = 10,
  1006. ControlPointPatch4 = 11,
  1007. ControlPointPatch5 = 12,
  1008. ControlPointPatch6 = 13,
  1009. ControlPointPatch7 = 14,
  1010. ControlPointPatch8 = 15,
  1011. ControlPointPatch9 = 16,
  1012. ControlPointPatch10 = 17,
  1013. ControlPointPatch11 = 18,
  1014. ControlPointPatch12 = 19,
  1015. ControlPointPatch13 = 20,
  1016. ControlPointPatch14 = 21,
  1017. ControlPointPatch15 = 22,
  1018. ControlPointPatch16 = 23,
  1019. ControlPointPatch17 = 24,
  1020. ControlPointPatch18 = 25,
  1021. ControlPointPatch19 = 26,
  1022. ControlPointPatch20 = 27,
  1023. ControlPointPatch21 = 28,
  1024. ControlPointPatch22 = 29,
  1025. ControlPointPatch23 = 30,
  1026. ControlPointPatch24 = 31,
  1027. ControlPointPatch25 = 32,
  1028. ControlPointPatch26 = 33,
  1029. ControlPointPatch27 = 34,
  1030. ControlPointPatch28 = 35,
  1031. ControlPointPatch29 = 36,
  1032. ControlPointPatch30 = 37,
  1033. ControlPointPatch31 = 38,
  1034. ControlPointPatch32 = 39,
  1035. LastEntry,
  1036. };
  1037. // Primitive topology, must match D3D_PRIMITIVE_TOPOLOGY
  1038. enum class PrimitiveTopology : unsigned {
  1039. Undefined = 0,
  1040. PointList = 1,
  1041. LineList = 2,
  1042. LineStrip = 3,
  1043. TriangleList = 4,
  1044. TriangleStrip = 5,
  1045. LastEntry,
  1046. };
  1047. // Must match D3D_TESSELLATOR_DOMAIN
  1048. enum class TessellatorDomain
  1049. {
  1050. Undefined = 0,
  1051. IsoLine = 1,
  1052. Tri = 2,
  1053. Quad = 3,
  1054. LastEntry,
  1055. };
  1056. // Must match D3D_TESSELLATOR_OUTPUT_PRIMITIVE
  1057. enum class TessellatorOutputPrimitive
  1058. {
  1059. Undefined = 0,
  1060. Point = 1,
  1061. Line = 2,
  1062. TriangleCW = 3,
  1063. TriangleCCW = 4,
  1064. LastEntry,
  1065. };
  1066. enum class MeshOutputTopology
  1067. {
  1068. Undefined = 0,
  1069. Line = 1,
  1070. Triangle = 2,
  1071. LastEntry,
  1072. };
  1073. // Tessellator partitioning, must match D3D_TESSELLATOR_PARTITIONING
  1074. enum class TessellatorPartitioning : unsigned {
  1075. Undefined = 0,
  1076. Integer,
  1077. Pow2,
  1078. FractionalOdd,
  1079. FractionalEven,
  1080. LastEntry,
  1081. };
  1082. // Kind of quad-level operation
  1083. enum class QuadOpKind {
  1084. ReadAcrossX = 0, // returns the value from the other lane in the quad in the horizontal direction
  1085. ReadAcrossY = 1, // returns the value from the other lane in the quad in the vertical direction
  1086. ReadAcrossDiagonal = 2, // returns the value from the lane across the quad in horizontal and vertical direction
  1087. };
  1088. /* <py::lines('WAVEBITOPKIND-ENUM')>hctdb_instrhelp.get_enum_decl("WaveBitOpKind")</py>*/
  1089. // WAVEBITOPKIND-ENUM:BEGIN
  1090. // Kind of bitwise cross-lane operation
  1091. enum class WaveBitOpKind : unsigned {
  1092. And = 0, // bitwise and of values
  1093. Or = 1, // bitwise or of values
  1094. Xor = 2, // bitwise xor of values
  1095. };
  1096. // WAVEBITOPKIND-ENUM:END
  1097. /* <py::lines('WAVEOPKIND-ENUM')>hctdb_instrhelp.get_enum_decl("WaveOpKind")</py>*/
  1098. // WAVEOPKIND-ENUM:BEGIN
  1099. // Kind of cross-lane operation
  1100. enum class WaveOpKind : unsigned {
  1101. Max = 3, // maximum value
  1102. Min = 2, // minimum value
  1103. Product = 1, // product of values
  1104. Sum = 0, // sum of values
  1105. };
  1106. // WAVEOPKIND-ENUM:END
  1107. /* <py::lines('WAVEMULTIPREFIXOPKIND-ENUM')>hctdb_instrhelp.get_enum_decl("WaveMultiPrefixOpKind")</py>*/
  1108. // WAVEMULTIPREFIXOPKIND-ENUM:BEGIN
  1109. // Kind of cross-lane for multi-prefix operation
  1110. enum class WaveMultiPrefixOpKind : unsigned {
  1111. And = 1, // bitwise and of values
  1112. Or = 2, // bitwise or of values
  1113. Product = 4, // product of values
  1114. Sum = 0, // sum of values
  1115. Xor = 3, // bitwise xor of values
  1116. };
  1117. // WAVEMULTIPREFIXOPKIND-ENUM:END
  1118. /* <py::lines('SIGNEDOPKIND-ENUM')>hctdb_instrhelp.get_enum_decl("SignedOpKind")</py>*/
  1119. // SIGNEDOPKIND-ENUM:BEGIN
  1120. // Sign vs. unsigned operands for operation
  1121. enum class SignedOpKind : unsigned {
  1122. Signed = 0, // signed integer or floating-point operands
  1123. Unsigned = 1, // unsigned integer operands
  1124. };
  1125. // SIGNEDOPKIND-ENUM:END
  1126. // Kind of control flow hint
  1127. enum class ControlFlowHint : unsigned {
  1128. Undefined = 0,
  1129. Branch = 1,
  1130. Flatten = 2,
  1131. FastOpt = 3,
  1132. AllowUavCondition = 4,
  1133. ForceCase = 5,
  1134. Call = 6,
  1135. // Loop and Unroll is using llvm.loop.unroll Metadata.
  1136. LastEntry,
  1137. };
  1138. // XYZW component mask.
  1139. const uint8_t kCompMask_X = 0x1;
  1140. const uint8_t kCompMask_Y = 0x2;
  1141. const uint8_t kCompMask_Z = 0x4;
  1142. const uint8_t kCompMask_W = 0x8;
  1143. const uint8_t kCompMask_All = 0xF;
  1144. enum class LowPrecisionMode {
  1145. Undefined = 0,
  1146. UseMinPrecision,
  1147. UseNativeLowPrecision
  1148. };
  1149. // Corresponds to RAY_FLAG_* in HLSL
  1150. enum class RayFlag : uint32_t {
  1151. None = 0x00,
  1152. ForceOpaque = 0x01,
  1153. ForceNonOpaque = 0x02,
  1154. AcceptFirstHitAndEndSearch = 0x04,
  1155. SkipClosestHitShader = 0x08,
  1156. CullBackFacingTriangles = 0x10,
  1157. CullFrontFacingTriangles = 0x20,
  1158. CullOpaque = 0x40,
  1159. CullNonOpaque = 0x80,
  1160. SkipTriangles = 0x100,
  1161. SkipProceduralPrimitives = 0x200,
  1162. };
  1163. // Packing/unpacking intrinsics
  1164. enum class UnpackMode : uint8_t {
  1165. Unsigned = 0, // not sign extended
  1166. Signed = 1, // sign extended
  1167. };
  1168. enum class PackMode : uint8_t {
  1169. Trunc = 0, // Pack low bits, drop the rest
  1170. UClamp = 1, // Unsigned clamp - [0, 255] for 8-bits
  1171. SClamp = 2, // Signed clamp - [-128, 127] for 8-bits
  1172. };
  1173. // Corresponds to HIT_KIND_* in HLSL
  1174. enum class HitKind : uint8_t {
  1175. None = 0x00,
  1176. TriangleFrontFace = 0xFE,
  1177. TriangleBackFace = 0xFF,
  1178. };
  1179. enum class SamplerFeedbackType : uint8_t {
  1180. MinMip = 0,
  1181. MipRegionUsed = 1,
  1182. LastEntry = 2
  1183. };
  1184. // Constant for Container.
  1185. const uint8_t DxilProgramSigMaskX = 1;
  1186. const uint8_t DxilProgramSigMaskY = 2;
  1187. const uint8_t DxilProgramSigMaskZ = 4;
  1188. const uint8_t DxilProgramSigMaskW = 8;
  1189. // DFCC_FeatureInfo is a uint64_t value with these flags.
  1190. const uint64_t ShaderFeatureInfo_Doubles = 0x0001;
  1191. const uint64_t
  1192. ShaderFeatureInfo_ComputeShadersPlusRawAndStructuredBuffersViaShader4X =
  1193. 0x0002;
  1194. const uint64_t ShaderFeatureInfo_UAVsAtEveryStage = 0x0004;
  1195. const uint64_t ShaderFeatureInfo_64UAVs = 0x0008;
  1196. const uint64_t ShaderFeatureInfo_MinimumPrecision = 0x0010;
  1197. const uint64_t ShaderFeatureInfo_11_1_DoubleExtensions = 0x0020;
  1198. const uint64_t ShaderFeatureInfo_11_1_ShaderExtensions = 0x0040;
  1199. const uint64_t ShaderFeatureInfo_LEVEL9ComparisonFiltering = 0x0080;
  1200. const uint64_t ShaderFeatureInfo_TiledResources = 0x0100;
  1201. const uint64_t ShaderFeatureInfo_StencilRef = 0x0200;
  1202. const uint64_t ShaderFeatureInfo_InnerCoverage = 0x0400;
  1203. const uint64_t ShaderFeatureInfo_TypedUAVLoadAdditionalFormats = 0x0800;
  1204. const uint64_t ShaderFeatureInfo_ROVs = 0x1000;
  1205. const uint64_t
  1206. ShaderFeatureInfo_ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer =
  1207. 0x2000;
  1208. const uint64_t ShaderFeatureInfo_WaveOps = 0x4000;
  1209. const uint64_t ShaderFeatureInfo_Int64Ops = 0x8000;
  1210. const uint64_t ShaderFeatureInfo_ViewID = 0x10000;
  1211. const uint64_t ShaderFeatureInfo_Barycentrics = 0x20000;
  1212. const uint64_t ShaderFeatureInfo_NativeLowPrecision = 0x40000;
  1213. const uint64_t ShaderFeatureInfo_ShadingRate = 0x80000;
  1214. const uint64_t ShaderFeatureInfo_Raytracing_Tier_1_1 = 0x100000;
  1215. const uint64_t ShaderFeatureInfo_SamplerFeedback = 0x200000;
  1216. const uint64_t ShaderFeatureInfo_AtomicInt64OnTypedResource = 0x400000;
  1217. const uint64_t ShaderFeatureInfo_AtomicInt64OnGroupShared = 0x800000;
  1218. const uint64_t ShaderFeatureInfo_DerivativesInMeshAndAmpShaders = 0x1000000;
  1219. const unsigned ShaderFeatureInfoCount = 25;
  1220. // DxilSubobjectType must match D3D12_STATE_SUBOBJECT_TYPE, with
  1221. // certain values reserved, since they cannot be used from Dxil.
  1222. enum class SubobjectKind : uint32_t {
  1223. StateObjectConfig = 0,
  1224. GlobalRootSignature = 1,
  1225. LocalRootSignature = 2,
  1226. // 3-7 are reserved (not supported in Dxil)
  1227. SubobjectToExportsAssociation = 8,
  1228. RaytracingShaderConfig = 9,
  1229. RaytracingPipelineConfig = 10,
  1230. HitGroup = 11,
  1231. RaytracingPipelineConfig1 = 12,
  1232. NumKinds // aka D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID
  1233. };
  1234. inline bool IsValidSubobjectKind(SubobjectKind kind) {
  1235. return (kind < SubobjectKind::NumKinds &&
  1236. ( kind <= SubobjectKind::LocalRootSignature ||
  1237. kind >= SubobjectKind::SubobjectToExportsAssociation));
  1238. }
  1239. enum class StateObjectFlags : uint32_t {
  1240. AllowLocalDependenciesOnExternalDefinitions = 0x1,
  1241. AllowExternalDependenciesOnLocalDefinitions = 0x2,
  1242. AllowStateObjectAdditions = 0x4,
  1243. ValidMask_1_4 = 0x3,
  1244. ValidMask = 0x7,
  1245. };
  1246. enum class HitGroupType : uint32_t {
  1247. Triangle = 0x0,
  1248. ProceduralPrimitive = 0x1,
  1249. LastEntry,
  1250. };
  1251. enum class RaytracingPipelineFlags : uint32_t {
  1252. None = 0x0,
  1253. SkipTriangles = 0x100,
  1254. SkipProceduralPrimitives = 0x200,
  1255. ValidMask = 0x300,
  1256. };
  1257. enum class CommittedStatus : uint32_t {
  1258. CommittedNothing = 0,
  1259. CommittedTriangleHit = 1,
  1260. CommittedProceduralPrimitiveHit = 2,
  1261. };
  1262. enum class CandidateType : uint32_t {
  1263. CandidateNonOpaqueTriangle = 0,
  1264. CandidateProceduralPrimitive = 1,
  1265. };
  1266. inline bool IsValidHitGroupType(HitGroupType type) {
  1267. return (type >= HitGroupType::Triangle && type < HitGroupType::LastEntry);
  1268. }
  1269. extern const char* kLegacyLayoutString;
  1270. extern const char* kNewLayoutString;
  1271. extern const char* kFP32DenormKindString;
  1272. extern const char* kFP32DenormValueAnyString;
  1273. extern const char* kFP32DenormValuePreserveString;
  1274. extern const char* kFP32DenormValueFtzString;
  1275. extern const char *kDxBreakFuncName;
  1276. extern const char *kDxBreakCondName;
  1277. extern const char *kDxBreakMDName;
  1278. } // namespace DXIL
  1279. } // namespace hlsl