d3d11shader.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. // File: D3D11Shader.h
  6. // Content: D3D11 Shader Types and APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. #ifndef __D3D11SHADER_H__
  10. #define __D3D11SHADER_H__
  11. #include "d3dcommon.h"
  12. typedef enum D3D11_SHADER_VERSION_TYPE
  13. {
  14. D3D11_SHVER_PIXEL_SHADER = 0,
  15. D3D11_SHVER_VERTEX_SHADER = 1,
  16. D3D11_SHVER_GEOMETRY_SHADER = 2,
  17. // D3D11 Shaders
  18. D3D11_SHVER_HULL_SHADER = 3,
  19. D3D11_SHVER_DOMAIN_SHADER = 4,
  20. D3D11_SHVER_COMPUTE_SHADER = 5,
  21. D3D11_SHVER_RESERVED0 = 0xFFF0,
  22. } D3D11_SHADER_VERSION_TYPE;
  23. #define D3D11_SHVER_GET_TYPE(_Version) \
  24. (((_Version) >> 16) & 0xffff)
  25. #define D3D11_SHVER_GET_MAJOR(_Version) \
  26. (((_Version) >> 4) & 0xf)
  27. #define D3D11_SHVER_GET_MINOR(_Version) \
  28. (((_Version) >> 0) & 0xf)
  29. // Slot ID for library function return
  30. #define D3D_RETURN_PARAMETER_INDEX (-1)
  31. typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
  32. typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
  33. typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
  34. {
  35. LPCSTR SemanticName; // Name of the semantic
  36. UINT SemanticIndex; // Index of the semantic
  37. UINT Register; // Number of member variables
  38. D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
  39. D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
  40. BYTE Mask; // Mask to indicate which components of the register
  41. // are used (combination of D3D10_COMPONENT_MASK values)
  42. BYTE ReadWriteMask; // Mask to indicate whether a given component is
  43. // never written (if this is an output signature) or
  44. // always read (if this is an input signature).
  45. // (combination of D3D_MASK_* values)
  46. UINT Stream; // Stream index
  47. D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
  48. } D3D11_SIGNATURE_PARAMETER_DESC;
  49. typedef struct _D3D11_SHADER_BUFFER_DESC
  50. {
  51. LPCSTR Name; // Name of the constant buffer
  52. D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
  53. UINT Variables; // Number of member variables
  54. UINT Size; // Size of CB (in bytes)
  55. UINT uFlags; // Buffer description flags
  56. } D3D11_SHADER_BUFFER_DESC;
  57. typedef struct _D3D11_SHADER_VARIABLE_DESC
  58. {
  59. LPCSTR Name; // Name of the variable
  60. UINT StartOffset; // Offset in constant buffer's backing store
  61. UINT Size; // Size of variable (in bytes)
  62. UINT uFlags; // Variable flags
  63. LPVOID DefaultValue; // Raw pointer to default value
  64. UINT StartTexture; // First texture index (or -1 if no textures used)
  65. UINT TextureSize; // Number of texture slots possibly used.
  66. UINT StartSampler; // First sampler index (or -1 if no textures used)
  67. UINT SamplerSize; // Number of sampler slots possibly used.
  68. } D3D11_SHADER_VARIABLE_DESC;
  69. typedef struct _D3D11_SHADER_TYPE_DESC
  70. {
  71. D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
  72. D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
  73. UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
  74. UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
  75. UINT Elements; // Number of elements (0 if not an array)
  76. UINT Members; // Number of members (0 if not a structure)
  77. UINT Offset; // Offset from the start of structure (0 if not a structure member)
  78. LPCSTR Name; // Name of type, can be NULL
  79. } D3D11_SHADER_TYPE_DESC;
  80. typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
  81. typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
  82. typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
  83. typedef struct _D3D11_SHADER_DESC
  84. {
  85. UINT Version; // Shader version
  86. LPCSTR Creator; // Creator string
  87. UINT Flags; // Shader compilation/parse flags
  88. UINT ConstantBuffers; // Number of constant buffers
  89. UINT BoundResources; // Number of bound resources
  90. UINT InputParameters; // Number of parameters in the input signature
  91. UINT OutputParameters; // Number of parameters in the output signature
  92. UINT InstructionCount; // Number of emitted instructions
  93. UINT TempRegisterCount; // Number of temporary registers used
  94. UINT TempArrayCount; // Number of temporary arrays used
  95. UINT DefCount; // Number of constant defines
  96. UINT DclCount; // Number of declarations (input + output)
  97. UINT TextureNormalInstructions; // Number of non-categorized texture instructions
  98. UINT TextureLoadInstructions; // Number of texture load instructions
  99. UINT TextureCompInstructions; // Number of texture comparison instructions
  100. UINT TextureBiasInstructions; // Number of texture bias instructions
  101. UINT TextureGradientInstructions; // Number of texture gradient instructions
  102. UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
  103. UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
  104. UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
  105. UINT StaticFlowControlCount; // Number of static flow control instructions used
  106. UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
  107. UINT MacroInstructionCount; // Number of macro instructions used
  108. UINT ArrayInstructionCount; // Number of array instructions used
  109. UINT CutInstructionCount; // Number of cut instructions used
  110. UINT EmitInstructionCount; // Number of emit instructions used
  111. D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
  112. UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
  113. D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
  114. UINT PatchConstantParameters; // Number of parameters in the patch constant signature
  115. UINT cGSInstanceCount; // Number of Geometry shader instances
  116. UINT cControlPoints; // Number of control points in the HS->DS stage
  117. D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
  118. D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
  119. D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
  120. // instruction counts
  121. UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
  122. UINT cInterlockedInstructions; // Number of interlocked instructions
  123. UINT cTextureStoreInstructions; // Number of texture writes
  124. } D3D11_SHADER_DESC;
  125. typedef struct _D3D11_SHADER_INPUT_BIND_DESC
  126. {
  127. LPCSTR Name; // Name of the resource
  128. D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
  129. UINT BindPoint; // Starting bind point
  130. UINT BindCount; // Number of contiguous bind points (for arrays)
  131. UINT uFlags; // Input binding flags
  132. D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
  133. D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
  134. UINT NumSamples; // Number of samples (0 if not MS texture)
  135. } D3D11_SHADER_INPUT_BIND_DESC;
  136. #define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
  137. #define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
  138. #define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
  139. #define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
  140. #define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
  141. #define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
  142. #define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
  143. #define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
  144. #define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
  145. typedef struct _D3D11_LIBRARY_DESC
  146. {
  147. LPCSTR Creator; // The name of the originator of the library.
  148. UINT Flags; // Compilation flags.
  149. UINT FunctionCount; // Number of functions exported from the library.
  150. } D3D11_LIBRARY_DESC;
  151. typedef struct _D3D11_FUNCTION_DESC
  152. {
  153. UINT Version; // Shader version
  154. LPCSTR Creator; // Creator string
  155. UINT Flags; // Shader compilation/parse flags
  156. UINT ConstantBuffers; // Number of constant buffers
  157. UINT BoundResources; // Number of bound resources
  158. UINT InstructionCount; // Number of emitted instructions
  159. UINT TempRegisterCount; // Number of temporary registers used
  160. UINT TempArrayCount; // Number of temporary arrays used
  161. UINT DefCount; // Number of constant defines
  162. UINT DclCount; // Number of declarations (input + output)
  163. UINT TextureNormalInstructions; // Number of non-categorized texture instructions
  164. UINT TextureLoadInstructions; // Number of texture load instructions
  165. UINT TextureCompInstructions; // Number of texture comparison instructions
  166. UINT TextureBiasInstructions; // Number of texture bias instructions
  167. UINT TextureGradientInstructions; // Number of texture gradient instructions
  168. UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
  169. UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
  170. UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
  171. UINT StaticFlowControlCount; // Number of static flow control instructions used
  172. UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
  173. UINT MacroInstructionCount; // Number of macro instructions used
  174. UINT ArrayInstructionCount; // Number of array instructions used
  175. UINT MovInstructionCount; // Number of mov instructions used
  176. UINT MovcInstructionCount; // Number of movc instructions used
  177. UINT ConversionInstructionCount; // Number of type conversion instructions used
  178. UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
  179. D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
  180. UINT64 RequiredFeatureFlags; // Required feature flags
  181. LPCSTR Name; // Function name
  182. INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
  183. BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
  184. BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
  185. BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
  186. } D3D11_FUNCTION_DESC;
  187. typedef struct _D3D11_PARAMETER_DESC
  188. {
  189. LPCSTR Name; // Parameter name.
  190. LPCSTR SemanticName; // Parameter semantic name (+index).
  191. D3D_SHADER_VARIABLE_TYPE Type; // Element type.
  192. D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
  193. UINT Rows; // Rows are for matrix parameters.
  194. UINT Columns; // Components or Columns in matrix.
  195. D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
  196. D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
  197. UINT FirstInRegister; // The first input register for this parameter.
  198. UINT FirstInComponent; // The first input register component for this parameter.
  199. UINT FirstOutRegister; // The first output register for this parameter.
  200. UINT FirstOutComponent; // The first output register component for this parameter.
  201. } D3D11_PARAMETER_DESC;
  202. //////////////////////////////////////////////////////////////////////////////
  203. // Interfaces ////////////////////////////////////////////////////////////////
  204. //////////////////////////////////////////////////////////////////////////////
  205. typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType;
  206. typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE;
  207. typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable;
  208. typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE;
  209. typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer;
  210. typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER;
  211. typedef interface ID3D11ShaderReflection ID3D11ShaderReflection;
  212. typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION;
  213. typedef interface ID3D11LibraryReflection ID3D11LibraryReflection;
  214. typedef interface ID3D11LibraryReflection *LPD3D11LIBRARYREFLECTION;
  215. typedef interface ID3D11FunctionReflection ID3D11FunctionReflection;
  216. typedef interface ID3D11FunctionReflection *LPD3D11FUNCTIONREFLECTION;
  217. typedef interface ID3D11FunctionParameterReflection ID3D11FunctionParameterReflection;
  218. typedef interface ID3D11FunctionParameterReflection *LPD3D11FUNCTIONPARAMETERREFLECTION;
  219. // {6E6FFA6A-9BAE-4613-A51E-91652D508C21}
  220. interface DECLSPEC_UUID("6E6FFA6A-9BAE-4613-A51E-91652D508C21") ID3D11ShaderReflectionType;
  221. DEFINE_GUID(IID_ID3D11ShaderReflectionType,
  222. 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
  223. #undef INTERFACE
  224. #define INTERFACE ID3D11ShaderReflectionType
  225. DECLARE_INTERFACE(ID3D11ShaderReflectionType)
  226. {
  227. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_TYPE_DESC *pDesc) PURE;
  228. STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
  229. STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
  230. STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
  231. STDMETHOD(IsEqual)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
  232. STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE;
  233. STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE;
  234. STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
  235. STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
  236. STDMETHOD(IsOfType)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
  237. STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D11ShaderReflectionType* pBase) PURE;
  238. };
  239. // {51F23923-F3E5-4BD1-91CB-606177D8DB4C}
  240. interface DECLSPEC_UUID("51F23923-F3E5-4BD1-91CB-606177D8DB4C") ID3D11ShaderReflectionVariable;
  241. DEFINE_GUID(IID_ID3D11ShaderReflectionVariable,
  242. 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
  243. #undef INTERFACE
  244. #define INTERFACE ID3D11ShaderReflectionVariable
  245. DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
  246. {
  247. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_VARIABLE_DESC *pDesc) PURE;
  248. STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE;
  249. STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
  250. STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
  251. };
  252. // {EB62D63D-93DD-4318-8AE8-C6F83AD371B8}
  253. interface DECLSPEC_UUID("EB62D63D-93DD-4318-8AE8-C6F83AD371B8") ID3D11ShaderReflectionConstantBuffer;
  254. DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer,
  255. 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
  256. #undef INTERFACE
  257. #define INTERFACE ID3D11ShaderReflectionConstantBuffer
  258. DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
  259. {
  260. STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE;
  261. STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
  262. STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  263. };
  264. // The ID3D11ShaderReflection IID may change from SDK version to SDK version
  265. // if the reflection API changes. This prevents new code with the new API
  266. // from working with an old binary. Recompiling with the new header
  267. // will pick up the new IID.
  268. // 8d536ca1-0cca-4956-a837-786963755584
  269. interface DECLSPEC_UUID("8d536ca1-0cca-4956-a837-786963755584") ID3D11ShaderReflection;
  270. DEFINE_GUID(IID_ID3D11ShaderReflection,
  271. 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
  272. #undef INTERFACE
  273. #define INTERFACE ID3D11ShaderReflection
  274. DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
  275. {
  276. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
  277. _Out_ LPVOID *ppv) PURE;
  278. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  279. STDMETHOD_(ULONG, Release)(THIS) PURE;
  280. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_DESC *pDesc) PURE;
  281. STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
  282. STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
  283. STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
  284. _Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
  285. STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  286. _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  287. STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  288. _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  289. STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
  290. _Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
  291. STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  292. STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
  293. _Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
  294. STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
  295. STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
  296. STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
  297. STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
  298. STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
  299. STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
  300. STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
  301. STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
  302. STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
  303. _Out_opt_ UINT* pSizeX,
  304. _Out_opt_ UINT* pSizeY,
  305. _Out_opt_ UINT* pSizeZ) PURE;
  306. STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
  307. };
  308. // {54384F1B-5B3E-4BB7-AE01-60BA3097CBB6}
  309. interface DECLSPEC_UUID("54384F1B-5B3E-4BB7-AE01-60BA3097CBB6") ID3D11LibraryReflection;
  310. DEFINE_GUID(IID_ID3D11LibraryReflection,
  311. 0x54384f1b, 0x5b3e, 0x4bb7, 0xae, 0x1, 0x60, 0xba, 0x30, 0x97, 0xcb, 0xb6);
  312. #undef INTERFACE
  313. #define INTERFACE ID3D11LibraryReflection
  314. DECLARE_INTERFACE_(ID3D11LibraryReflection, IUnknown)
  315. {
  316. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  317. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  318. STDMETHOD_(ULONG, Release)(THIS) PURE;
  319. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_LIBRARY_DESC * pDesc) PURE;
  320. STDMETHOD_(ID3D11FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
  321. };
  322. // {207BCECB-D683-4A06-A8A3-9B149B9F73A4}
  323. interface DECLSPEC_UUID("207BCECB-D683-4A06-A8A3-9B149B9F73A4") ID3D11FunctionReflection;
  324. DEFINE_GUID(IID_ID3D11FunctionReflection,
  325. 0x207bcecb, 0xd683, 0x4a06, 0xa8, 0xa3, 0x9b, 0x14, 0x9b, 0x9f, 0x73, 0xa4);
  326. #undef INTERFACE
  327. #define INTERFACE ID3D11FunctionReflection
  328. DECLARE_INTERFACE(ID3D11FunctionReflection)
  329. {
  330. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_FUNCTION_DESC * pDesc) PURE;
  331. STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
  332. STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
  333. STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
  334. _Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
  335. STDMETHOD_(ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
  336. STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
  337. _Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
  338. // Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
  339. STDMETHOD_(ID3D11FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
  340. };
  341. // {42757488-334F-47FE-982E-1A65D08CC462}
  342. interface DECLSPEC_UUID("42757488-334F-47FE-982E-1A65D08CC462") ID3D11FunctionParameterReflection;
  343. DEFINE_GUID(IID_ID3D11FunctionParameterReflection,
  344. 0x42757488, 0x334f, 0x47fe, 0x98, 0x2e, 0x1a, 0x65, 0xd0, 0x8c, 0xc4, 0x62);
  345. #undef INTERFACE
  346. #define INTERFACE ID3D11FunctionParameterReflection
  347. DECLARE_INTERFACE(ID3D11FunctionParameterReflection)
  348. {
  349. STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_PARAMETER_DESC * pDesc) PURE;
  350. };
  351. // {CAC701EE-80FC-4122-8242-10B39C8CEC34}
  352. interface DECLSPEC_UUID("CAC701EE-80FC-4122-8242-10B39C8CEC34") ID3D11Module;
  353. DEFINE_GUID(IID_ID3D11Module,
  354. 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
  355. #undef INTERFACE
  356. #define INTERFACE ID3D11Module
  357. DECLARE_INTERFACE_(ID3D11Module, IUnknown)
  358. {
  359. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  360. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  361. STDMETHOD_(ULONG, Release)(THIS) PURE;
  362. // Create an instance of a module for resource re-binding.
  363. STDMETHOD(CreateInstance)(THIS_ _In_opt_ LPCSTR pNamespace,
  364. _COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance) PURE;
  365. };
  366. // {469E07F7-045A-48D5-AA12-68A478CDF75D}
  367. interface DECLSPEC_UUID("469E07F7-045A-48D5-AA12-68A478CDF75D") ID3D11ModuleInstance;
  368. DEFINE_GUID(IID_ID3D11ModuleInstance,
  369. 0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
  370. #undef INTERFACE
  371. #define INTERFACE ID3D11ModuleInstance
  372. DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
  373. {
  374. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  375. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  376. STDMETHOD_(ULONG, Release)(THIS) PURE;
  377. //
  378. // Resource binding API.
  379. //
  380. STDMETHOD(BindConstantBuffer)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
  381. STDMETHOD(BindConstantBufferByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
  382. STDMETHOD(BindResource)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  383. STDMETHOD(BindResourceByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  384. STDMETHOD(BindSampler)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  385. STDMETHOD(BindSamplerByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  386. STDMETHOD(BindUnorderedAccessView)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  387. STDMETHOD(BindUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
  388. STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ _In_ UINT uSrcSrvSlot, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
  389. STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pSrvName, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
  390. };
  391. // {59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E}
  392. interface DECLSPEC_UUID("59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E") ID3D11Linker;
  393. DEFINE_GUID(IID_ID3D11Linker,
  394. 0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0xe);
  395. #undef INTERFACE
  396. #define INTERFACE ID3D11Linker
  397. DECLARE_INTERFACE_(ID3D11Linker, IUnknown)
  398. {
  399. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  400. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  401. STDMETHOD_(ULONG, Release)(THIS) PURE;
  402. // Link the shader and produce a shader blob suitable to D3D runtime.
  403. STDMETHOD(Link)(THIS_ _In_ interface ID3D11ModuleInstance * pEntry,
  404. _In_ LPCSTR pEntryName,
  405. _In_ LPCSTR pTargetName,
  406. _In_ UINT uFlags,
  407. _COM_Outptr_ ID3DBlob ** ppShaderBlob,
  408. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
  409. // Add an instance of a library module to be used for linking.
  410. STDMETHOD(UseLibrary)(THIS_ _In_ interface ID3D11ModuleInstance * pLibraryMI) PURE;
  411. // Add a clip plane with the plane coefficients taken from a cbuffer entry for 10L9 shaders.
  412. STDMETHOD(AddClipPlaneFromCBuffer)(THIS_ _In_ UINT uCBufferSlot, _In_ UINT uCBufferEntry) PURE;
  413. };
  414. // {D80DD70C-8D2F-4751-94A1-03C79B3556DB}
  415. interface DECLSPEC_UUID("D80DD70C-8D2F-4751-94A1-03C79B3556DB") ID3D11LinkingNode;
  416. DEFINE_GUID(IID_ID3D11LinkingNode,
  417. 0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x3, 0xc7, 0x9b, 0x35, 0x56, 0xdb);
  418. #undef INTERFACE
  419. #define INTERFACE ID3D11LinkingNode
  420. DECLARE_INTERFACE_(ID3D11LinkingNode, IUnknown)
  421. {
  422. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  423. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  424. STDMETHOD_(ULONG, Release)(THIS) PURE;
  425. };
  426. // {54133220-1CE8-43D3-8236-9855C5CEECFF}
  427. interface DECLSPEC_UUID("54133220-1CE8-43D3-8236-9855C5CEECFF") ID3D11FunctionLinkingGraph;
  428. DEFINE_GUID(IID_ID3D11FunctionLinkingGraph,
  429. 0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff);
  430. #undef INTERFACE
  431. #define INTERFACE ID3D11FunctionLinkingGraph
  432. DECLARE_INTERFACE_(ID3D11FunctionLinkingGraph, IUnknown)
  433. {
  434. STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
  435. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  436. STDMETHOD_(ULONG, Release)(THIS) PURE;
  437. // Create a shader module out of FLG description.
  438. STDMETHOD(CreateModuleInstance)(THIS_ _COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance,
  439. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
  440. STDMETHOD(SetInputSignature)(THIS_ __in_ecount(cInputParameters) const D3D11_PARAMETER_DESC * pInputParameters,
  441. _In_ UINT cInputParameters,
  442. _COM_Outptr_ interface ID3D11LinkingNode ** ppInputNode) PURE;
  443. STDMETHOD(SetOutputSignature)(THIS_ __in_ecount(cOutputParameters) const D3D11_PARAMETER_DESC * pOutputParameters,
  444. _In_ UINT cOutputParameters,
  445. _COM_Outptr_ interface ID3D11LinkingNode ** ppOutputNode) PURE;
  446. STDMETHOD(CallFunction)(THIS_ _In_opt_ LPCSTR pModuleInstanceNamespace,
  447. _In_ interface ID3D11Module * pModuleWithFunctionPrototype,
  448. _In_ LPCSTR pFunctionName,
  449. _COM_Outptr_ interface ID3D11LinkingNode ** ppCallNode) PURE;
  450. STDMETHOD(PassValue)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
  451. _In_ INT SrcParameterIndex,
  452. _In_ interface ID3D11LinkingNode * pDstNode,
  453. _In_ INT DstParameterIndex) PURE;
  454. STDMETHOD(PassValueWithSwizzle)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
  455. _In_ INT SrcParameterIndex,
  456. _In_ LPCSTR pSrcSwizzle,
  457. _In_ interface ID3D11LinkingNode * pDstNode,
  458. _In_ INT DstParameterIndex,
  459. _In_ LPCSTR pDstSwizzle) PURE;
  460. STDMETHOD(GetLastError)(THIS_ _Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
  461. STDMETHOD(GenerateHlsl)(THIS_ _In_ UINT uFlags, // uFlags is reserved for future use.
  462. _COM_Outptr_ ID3DBlob ** ppBuffer) PURE;
  463. };
  464. //////////////////////////////////////////////////////////////////////////////
  465. // APIs //////////////////////////////////////////////////////////////////////
  466. //////////////////////////////////////////////////////////////////////////////
  467. #ifdef __cplusplus
  468. extern "C" {
  469. #endif //__cplusplus
  470. #ifdef __cplusplus
  471. }
  472. #endif //__cplusplus
  473. #endif //__D3D11SHADER_H__