d3d12shader.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation.
  4. // Licensed under the MIT license.
  5. //
  6. // File: D3D12Shader.h
  7. // Content: D3D12 Shader Types and APIs
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef __D3D12SHADER_H__
  11. #define __D3D12SHADER_H__
  12. #include "d3dcommon.h"
  13. typedef enum D3D12_SHADER_VERSION_TYPE
  14. {
  15. D3D12_SHVER_PIXEL_SHADER = 0,
  16. D3D12_SHVER_VERTEX_SHADER = 1,
  17. D3D12_SHVER_GEOMETRY_SHADER = 2,
  18. // D3D11 Shaders
  19. D3D12_SHVER_HULL_SHADER = 3,
  20. D3D12_SHVER_DOMAIN_SHADER = 4,
  21. D3D12_SHVER_COMPUTE_SHADER = 5,
  22. // D3D12 Shaders
  23. D3D12_SHVER_LIBRARY = 6,
  24. D3D12_SHVER_RAY_GENERATION_SHADER = 7,
  25. D3D12_SHVER_INTERSECTION_SHADER = 8,
  26. D3D12_SHVER_ANY_HIT_SHADER = 9,
  27. D3D12_SHVER_CLOSEST_HIT_SHADER = 10,
  28. D3D12_SHVER_MISS_SHADER = 11,
  29. D3D12_SHVER_CALLABLE_SHADER = 12,
  30. D3D12_SHVER_MESH_SHADER = 13,
  31. D3D12_SHVER_AMPLIFICATION_SHADER = 14,
  32. D3D12_SHVER_RESERVED0 = 0xFFF0,
  33. } D3D12_SHADER_VERSION_TYPE;
  34. #define D3D12_SHVER_GET_TYPE(_Version) \
  35. (((_Version) >> 16) & 0xffff)
  36. #define D3D12_SHVER_GET_MAJOR(_Version) \
  37. (((_Version) >> 4) & 0xf)
  38. #define D3D12_SHVER_GET_MINOR(_Version) \
  39. (((_Version) >> 0) & 0xf)
  40. // Slot ID for library function return
  41. #define D3D_RETURN_PARAMETER_INDEX (-1)
  42. typedef D3D_RESOURCE_RETURN_TYPE D3D12_RESOURCE_RETURN_TYPE;
  43. typedef D3D_CBUFFER_TYPE D3D12_CBUFFER_TYPE;
  44. typedef struct _D3D12_SIGNATURE_PARAMETER_DESC
  45. {
  46. LPCSTR SemanticName; // Name of the semantic
  47. UINT SemanticIndex; // Index of the semantic
  48. UINT Register; // Number of member variables
  49. D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
  50. D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
  51. BYTE Mask; // Mask to indicate which components of the register
  52. // are used (combination of D3D10_COMPONENT_MASK values)
  53. BYTE ReadWriteMask; // Mask to indicate whether a given component is
  54. // never written (if this is an output signature) or
  55. // always read (if this is an input signature).
  56. // (combination of D3D_MASK_* values)
  57. UINT Stream; // Stream index
  58. D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
  59. } D3D12_SIGNATURE_PARAMETER_DESC;
  60. typedef struct _D3D12_SHADER_BUFFER_DESC
  61. {
  62. LPCSTR Name; // Name of the constant buffer
  63. D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
  64. UINT Variables; // Number of member variables
  65. UINT Size; // Size of CB (in bytes)
  66. UINT uFlags; // Buffer description flags
  67. } D3D12_SHADER_BUFFER_DESC;
  68. typedef struct _D3D12_SHADER_VARIABLE_DESC
  69. {
  70. LPCSTR Name; // Name of the variable
  71. UINT StartOffset; // Offset in constant buffer's backing store
  72. UINT Size; // Size of variable (in bytes)
  73. UINT uFlags; // Variable flags
  74. LPVOID DefaultValue; // Raw pointer to default value
  75. UINT StartTexture; // First texture index (or -1 if no textures used)
  76. UINT TextureSize; // Number of texture slots possibly used.
  77. UINT StartSampler; // First sampler index (or -1 if no textures used)
  78. UINT SamplerSize; // Number of sampler slots possibly used.
  79. } D3D12_SHADER_VARIABLE_DESC;
  80. typedef struct _D3D12_SHADER_TYPE_DESC
  81. {
  82. D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
  83. D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
  84. UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
  85. UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
  86. UINT Elements; // Number of elements (0 if not an array)
  87. UINT Members; // Number of members (0 if not a structure)
  88. UINT Offset; // Offset from the start of structure (0 if not a structure member)
  89. LPCSTR Name; // Name of type, can be NULL
  90. } D3D12_SHADER_TYPE_DESC;
  91. typedef D3D_TESSELLATOR_DOMAIN D3D12_TESSELLATOR_DOMAIN;
  92. typedef D3D_TESSELLATOR_PARTITIONING D3D12_TESSELLATOR_PARTITIONING;
  93. typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D12_TESSELLATOR_OUTPUT_PRIMITIVE;
  94. typedef struct _D3D12_SHADER_DESC
  95. {
  96. UINT Version; // Shader version
  97. LPCSTR Creator; // Creator string
  98. UINT Flags; // Shader compilation/parse flags
  99. UINT ConstantBuffers; // Number of constant buffers
  100. UINT BoundResources; // Number of bound resources
  101. UINT InputParameters; // Number of parameters in the input signature
  102. UINT OutputParameters; // Number of parameters in the output signature
  103. UINT InstructionCount; // Number of emitted instructions
  104. UINT TempRegisterCount; // Number of temporary registers used
  105. UINT TempArrayCount; // Number of temporary arrays used
  106. UINT DefCount; // Number of constant defines
  107. UINT DclCount; // Number of declarations (input + output)
  108. UINT TextureNormalInstructions; // Number of non-categorized texture instructions
  109. UINT TextureLoadInstructions; // Number of texture load instructions
  110. UINT TextureCompInstructions; // Number of texture comparison instructions
  111. UINT TextureBiasInstructions; // Number of texture bias instructions
  112. UINT TextureGradientInstructions; // Number of texture gradient instructions
  113. UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
  114. UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
  115. UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
  116. UINT StaticFlowControlCount; // Number of static flow control instructions used
  117. UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
  118. UINT MacroInstructionCount; // Number of macro instructions used
  119. UINT ArrayInstructionCount; // Number of array instructions used
  120. UINT CutInstructionCount; // Number of cut instructions used
  121. UINT EmitInstructionCount; // Number of emit instructions used
  122. D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
  123. UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
  124. D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
  125. UINT PatchConstantParameters; // Number of parameters in the patch constant signature
  126. UINT cGSInstanceCount; // Number of Geometry shader instances
  127. UINT cControlPoints; // Number of control points in the HS->DS stage
  128. D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
  129. D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
  130. D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
  131. // instruction counts
  132. UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
  133. UINT cInterlockedInstructions; // Number of interlocked instructions
  134. UINT cTextureStoreInstructions; // Number of texture writes
  135. } D3D12_SHADER_DESC;
  136. typedef struct _D3D12_SHADER_INPUT_BIND_DESC
  137. {
  138. LPCSTR Name; // Name of the resource
  139. D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
  140. UINT BindPoint; // Starting bind point
  141. UINT BindCount; // Number of contiguous bind points (for arrays)
  142. UINT uFlags; // Input binding flags
  143. D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
  144. D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
  145. UINT NumSamples; // Number of samples (0 if not MS texture)
  146. UINT Space; // Register space
  147. UINT uID; // Range ID in the bytecode
  148. } D3D12_SHADER_INPUT_BIND_DESC;
  149. #define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
  150. #define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
  151. #define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
  152. #define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
  153. #define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
  154. #define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
  155. #define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
  156. #define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
  157. #define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
  158. #define D3D_SHADER_REQUIRES_STENCIL_REF 0x00000200
  159. #define D3D_SHADER_REQUIRES_INNER_COVERAGE 0x00000400
  160. #define D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00000800
  161. #define D3D_SHADER_REQUIRES_ROVS 0x00001000
  162. #define D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x00002000
  163. #define D3D_SHADER_REQUIRES_WAVE_OPS 0x00004000
  164. #define D3D_SHADER_REQUIRES_INT64_OPS 0x00008000
  165. #define D3D_SHADER_REQUIRES_VIEW_ID 0x00010000
  166. #define D3D_SHADER_REQUIRES_BARYCENTRICS 0x00020000
  167. #define D3D_SHADER_REQUIRES_NATIVE_16BIT_OPS 0x00040000
  168. #define D3D_SHADER_REQUIRES_SHADING_RATE 0x00080000
  169. #define D3D_SHADER_REQUIRES_RAYTRACING_TIER_1_1 0x00100000
  170. #define D3D_SHADER_REQUIRES_SAMPLER_FEEDBACK 0x00200000
  171. #define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_TYPED_RESOURCE 0x00400000
  172. #define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_GROUP_SHARED 0x00800000
  173. #define D3D_SHADER_REQUIRES_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x01000000
  174. #define D3D_SHADER_REQUIRES_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x02000000
  175. #define D3D_SHADER_REQUIRES_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x04000000
  176. #define D3D_SHADER_REQUIRES_WAVE_MMA 0x08000000
  177. #define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000
  178. #define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000
  179. #define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000
  180. typedef struct _D3D12_LIBRARY_DESC
  181. {
  182. LPCSTR Creator; // The name of the originator of the library.
  183. UINT Flags; // Compilation flags.
  184. UINT FunctionCount; // Number of functions exported from the library.
  185. } D3D12_LIBRARY_DESC;
  186. typedef struct _D3D12_FUNCTION_DESC
  187. {
  188. UINT Version; // Shader version
  189. LPCSTR Creator; // Creator string
  190. UINT Flags; // Shader compilation/parse flags
  191. UINT ConstantBuffers; // Number of constant buffers
  192. UINT BoundResources; // Number of bound resources
  193. UINT InstructionCount; // Number of emitted instructions
  194. UINT TempRegisterCount; // Number of temporary registers used
  195. UINT TempArrayCount; // Number of temporary arrays used
  196. UINT DefCount; // Number of constant defines
  197. UINT DclCount; // Number of declarations (input + output)
  198. UINT TextureNormalInstructions; // Number of non-categorized texture instructions
  199. UINT TextureLoadInstructions; // Number of texture load instructions
  200. UINT TextureCompInstructions; // Number of texture comparison instructions
  201. UINT TextureBiasInstructions; // Number of texture bias instructions
  202. UINT TextureGradientInstructions; // Number of texture gradient instructions
  203. UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
  204. UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
  205. UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
  206. UINT StaticFlowControlCount; // Number of static flow control instructions used
  207. UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
  208. UINT MacroInstructionCount; // Number of macro instructions used
  209. UINT ArrayInstructionCount; // Number of array instructions used
  210. UINT MovInstructionCount; // Number of mov instructions used
  211. UINT MovcInstructionCount; // Number of movc instructions used
  212. UINT ConversionInstructionCount; // Number of type conversion instructions used
  213. UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
  214. D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
  215. UINT64 RequiredFeatureFlags; // Required feature flags
  216. LPCSTR Name; // Function name
  217. INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
  218. BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
  219. BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
  220. BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
  221. } D3D12_FUNCTION_DESC;
  222. typedef struct _D3D12_PARAMETER_DESC
  223. {
  224. LPCSTR Name; // Parameter name.
  225. LPCSTR SemanticName; // Parameter semantic name (+index).
  226. D3D_SHADER_VARIABLE_TYPE Type; // Element type.
  227. D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
  228. UINT Rows; // Rows are for matrix parameters.
  229. UINT Columns; // Components or Columns in matrix.
  230. D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
  231. D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
  232. UINT FirstInRegister; // The first input register for this parameter.
  233. UINT FirstInComponent; // The first input register component for this parameter.
  234. UINT FirstOutRegister; // The first output register for this parameter.
  235. UINT FirstOutComponent; // The first output register component for this parameter.
  236. } D3D12_PARAMETER_DESC;
  237. //////////////////////////////////////////////////////////////////////////////
  238. // Interfaces ////////////////////////////////////////////////////////////////
  239. //////////////////////////////////////////////////////////////////////////////
  240. typedef interface ID3D12ShaderReflectionType ID3D12ShaderReflectionType;
  241. typedef interface ID3D12ShaderReflectionType *LPD3D12SHADERREFLECTIONTYPE;
  242. typedef interface ID3D12ShaderReflectionVariable ID3D12ShaderReflectionVariable;
  243. typedef interface ID3D12ShaderReflectionVariable *LPD3D12SHADERREFLECTIONVARIABLE;
  244. typedef interface ID3D12ShaderReflectionConstantBuffer ID3D12ShaderReflectionConstantBuffer;
  245. typedef interface ID3D12ShaderReflectionConstantBuffer *LPD3D12SHADERREFLECTIONCONSTANTBUFFER;
  246. typedef interface ID3D12ShaderReflection ID3D12ShaderReflection;
  247. typedef interface ID3D12ShaderReflection *LPD3D12SHADERREFLECTION;
  248. typedef interface ID3D12LibraryReflection ID3D12LibraryReflection;
  249. typedef interface ID3D12LibraryReflection *LPD3D12LIBRARYREFLECTION;
  250. typedef interface ID3D12FunctionReflection ID3D12FunctionReflection;
  251. typedef interface ID3D12FunctionReflection *LPD3D12FUNCTIONREFLECTION;
  252. typedef interface ID3D12FunctionParameterReflection ID3D12FunctionParameterReflection;
  253. typedef interface ID3D12FunctionParameterReflection *LPD3D12FUNCTIONPARAMETERREFLECTION;
  254. // {E913C351-783D-48CA-A1D1-4F306284AD56}
  255. interface DECLSPEC_UUID("E913C351-783D-48CA-A1D1-4F306284AD56") ID3D12ShaderReflectionType;
  256. DEFINE_GUID(IID_ID3D12ShaderReflectionType,
  257. 0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56);
  258. #undef INTERFACE
  259. #define INTERFACE ID3D12ShaderReflectionType
  260. DECLARE_INTERFACE(ID3D12ShaderReflectionType)
  261. {
  262. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_TYPE_DESC *pDesc) PURE;
  263. STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
  264. STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
  265. STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
  266. STDMETHOD(IsEqual)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
  267. STDMETHOD_(ID3D12ShaderReflectionType*, GetSubType)(THIS) PURE;
  268. STDMETHOD_(ID3D12ShaderReflectionType*, GetBaseClass)(THIS) PURE;
  269. STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
  270. STDMETHOD_(ID3D12ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
  271. STDMETHOD(IsOfType)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
  272. STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D12ShaderReflectionType* pBase) PURE;
  273. };
  274. // {8337A8A6-A216-444A-B2F4-314733A73AEA}
  275. interface DECLSPEC_UUID("8337A8A6-A216-444A-B2F4-314733A73AEA") ID3D12ShaderReflectionVariable;
  276. DEFINE_GUID(IID_ID3D12ShaderReflectionVariable,
  277. 0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea);
  278. #undef INTERFACE
  279. #define INTERFACE ID3D12ShaderReflectionVariable
  280. DECLARE_INTERFACE(ID3D12ShaderReflectionVariable)
  281. {
  282. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_VARIABLE_DESC *pDesc) PURE;
  283. STDMETHOD_(ID3D12ShaderReflectionType*, GetType)(THIS) PURE;
  284. STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
  285. STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
  286. };
  287. // {C59598B4-48B3-4869-B9B1-B1618B14A8B7}
  288. interface DECLSPEC_UUID("C59598B4-48B3-4869-B9B1-B1618B14A8B7") ID3D12ShaderReflectionConstantBuffer;
  289. DEFINE_GUID(IID_ID3D12ShaderReflectionConstantBuffer,
  290. 0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7);
  291. #undef INTERFACE
  292. #define INTERFACE ID3D12ShaderReflectionConstantBuffer
  293. DECLARE_INTERFACE(ID3D12ShaderReflectionConstantBuffer)
  294. {
  295. STDMETHOD(GetDesc)(THIS_ D3D12_SHADER_BUFFER_DESC *pDesc) PURE;
  296. STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
  297. STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  298. };
  299. // The ID3D12ShaderReflection IID may change from SDK version to SDK version
  300. // if the reflection API changes. This prevents new code with the new API
  301. // from working with an old binary. Recompiling with the new header
  302. // will pick up the new IID.
  303. // {5A58797D-A72C-478D-8BA2-EFC6B0EFE88E}
  304. interface DECLSPEC_UUID("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") ID3D12ShaderReflection;
  305. DEFINE_GUID(IID_ID3D12ShaderReflection,
  306. 0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e);
  307. #undef INTERFACE
  308. #define INTERFACE ID3D12ShaderReflection
  309. DECLARE_INTERFACE_(ID3D12ShaderReflection, IUnknown)
  310. {
  311. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
  312. _Out_ LPVOID *ppv) PURE;
  313. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  314. STDMETHOD_(ULONG, Release)(THIS) PURE;
  315. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_DESC *pDesc) PURE;
  316. STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
  317. STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
  318. STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
  319. _Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
  320. STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  321. _Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  322. STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  323. _Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  324. STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  325. _Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  326. STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  327. STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
  328. _Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
  329. STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
  330. STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
  331. STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
  332. STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
  333. STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
  334. STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
  335. STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
  336. STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
  337. STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
  338. _Out_opt_ UINT* pSizeX,
  339. _Out_opt_ UINT* pSizeY,
  340. _Out_opt_ UINT* pSizeZ) PURE;
  341. STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
  342. };
  343. // {8E349D19-54DB-4A56-9DC9-119D87BDB804}
  344. interface DECLSPEC_UUID("8E349D19-54DB-4A56-9DC9-119D87BDB804") ID3D12LibraryReflection;
  345. DEFINE_GUID(IID_ID3D12LibraryReflection,
  346. 0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x4);
  347. #undef INTERFACE
  348. #define INTERFACE ID3D12LibraryReflection
  349. DECLARE_INTERFACE_(ID3D12LibraryReflection, IUnknown)
  350. {
  351. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  352. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  353. STDMETHOD_(ULONG, Release)(THIS) PURE;
  354. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_LIBRARY_DESC * pDesc) PURE;
  355. STDMETHOD_(ID3D12FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
  356. };
  357. // {1108795C-2772-4BA9-B2A8-D464DC7E2799}
  358. interface DECLSPEC_UUID("1108795C-2772-4BA9-B2A8-D464DC7E2799") ID3D12FunctionReflection;
  359. DEFINE_GUID(IID_ID3D12FunctionReflection,
  360. 0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99);
  361. #undef INTERFACE
  362. #define INTERFACE ID3D12FunctionReflection
  363. DECLARE_INTERFACE(ID3D12FunctionReflection)
  364. {
  365. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_FUNCTION_DESC * pDesc) PURE;
  366. STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
  367. STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
  368. STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
  369. _Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
  370. STDMETHOD_(ID3D12ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  371. STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
  372. _Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
  373. // Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
  374. STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
  375. };
  376. // {EC25F42D-7006-4F2B-B33E-02CC3375733F}
  377. interface DECLSPEC_UUID("EC25F42D-7006-4F2B-B33E-02CC3375733F") ID3D12FunctionParameterReflection;
  378. DEFINE_GUID(IID_ID3D12FunctionParameterReflection,
  379. 0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x2, 0xcc, 0x33, 0x75, 0x73, 0x3f);
  380. #undef INTERFACE
  381. #define INTERFACE ID3D12FunctionParameterReflection
  382. DECLARE_INTERFACE(ID3D12FunctionParameterReflection)
  383. {
  384. STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_PARAMETER_DESC * pDesc) PURE;
  385. };
  386. //////////////////////////////////////////////////////////////////////////////
  387. // APIs //////////////////////////////////////////////////////////////////////
  388. //////////////////////////////////////////////////////////////////////////////
  389. #ifdef __cplusplus
  390. extern "C" {
  391. #endif //__cplusplus
  392. #ifdef __cplusplus
  393. }
  394. #endif //__cplusplus
  395. #endif //__D3D12SHADER_H__