d3d11shader.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. #undef INTERFACE
  2. /*
  3. * Copyright 2010 Matteo Bruni for CodeWeavers
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  18. */
  19. #ifndef __D3D11SHADER_H__
  20. #define __D3D11SHADER_H__
  21. #include "d3dcommon.h"
  22. /* If not defined set d3dcompiler_47 by default. */
  23. #ifndef D3D_COMPILER_VERSION
  24. #define D3D_COMPILER_VERSION 47
  25. #endif
  26. /* These are defined as version-neutral in d3dcommon.h */
  27. typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
  28. typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
  29. typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
  30. typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
  31. typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
  32. typedef struct _D3D11_SHADER_DESC
  33. {
  34. UINT Version;
  35. const char *Creator;
  36. UINT Flags;
  37. UINT ConstantBuffers;
  38. UINT BoundResources;
  39. UINT InputParameters;
  40. UINT OutputParameters;
  41. UINT InstructionCount;
  42. UINT TempRegisterCount;
  43. UINT TempArrayCount;
  44. UINT DefCount;
  45. UINT DclCount;
  46. UINT TextureNormalInstructions;
  47. UINT TextureLoadInstructions;
  48. UINT TextureCompInstructions;
  49. UINT TextureBiasInstructions;
  50. UINT TextureGradientInstructions;
  51. UINT FloatInstructionCount;
  52. UINT IntInstructionCount;
  53. UINT UintInstructionCount;
  54. UINT StaticFlowControlCount;
  55. UINT DynamicFlowControlCount;
  56. UINT MacroInstructionCount;
  57. UINT ArrayInstructionCount;
  58. UINT CutInstructionCount;
  59. UINT EmitInstructionCount;
  60. D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
  61. UINT GSMaxOutputVertexCount;
  62. D3D_PRIMITIVE InputPrimitive;
  63. UINT PatchConstantParameters;
  64. UINT cGSInstanceCount;
  65. UINT cControlPoints;
  66. D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
  67. D3D_TESSELLATOR_PARTITIONING HSPartitioning;
  68. D3D_TESSELLATOR_DOMAIN TessellatorDomain;
  69. UINT cBarrierInstructions;
  70. UINT cInterlockedInstructions;
  71. UINT cTextureStoreInstructions;
  72. } D3D11_SHADER_DESC;
  73. typedef struct _D3D11_SHADER_VARIABLE_DESC
  74. {
  75. const char *Name;
  76. UINT StartOffset;
  77. UINT Size;
  78. UINT uFlags;
  79. void *DefaultValue;
  80. UINT StartTexture;
  81. UINT TextureSize;
  82. UINT StartSampler;
  83. UINT SamplerSize;
  84. } D3D11_SHADER_VARIABLE_DESC;
  85. typedef struct _D3D11_SHADER_TYPE_DESC
  86. {
  87. D3D_SHADER_VARIABLE_CLASS Class;
  88. D3D_SHADER_VARIABLE_TYPE Type;
  89. UINT Rows;
  90. UINT Columns;
  91. UINT Elements;
  92. UINT Members;
  93. UINT Offset;
  94. const char *Name;
  95. } D3D11_SHADER_TYPE_DESC;
  96. typedef struct _D3D11_SHADER_BUFFER_DESC
  97. {
  98. const char *Name;
  99. D3D_CBUFFER_TYPE Type;
  100. UINT Variables;
  101. UINT Size;
  102. UINT uFlags;
  103. } D3D11_SHADER_BUFFER_DESC;
  104. typedef struct _D3D11_SHADER_INPUT_BIND_DESC
  105. {
  106. const char *Name;
  107. D3D_SHADER_INPUT_TYPE Type;
  108. UINT BindPoint;
  109. UINT BindCount;
  110. UINT uFlags;
  111. D3D_RESOURCE_RETURN_TYPE ReturnType;
  112. D3D_SRV_DIMENSION Dimension;
  113. UINT NumSamples;
  114. } D3D11_SHADER_INPUT_BIND_DESC;
  115. typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
  116. {
  117. const char *SemanticName;
  118. UINT SemanticIndex;
  119. UINT Register;
  120. D3D_NAME SystemValueType;
  121. D3D_REGISTER_COMPONENT_TYPE ComponentType;
  122. BYTE Mask;
  123. BYTE ReadWriteMask;
  124. UINT Stream;
  125. #if D3D_COMPILER_VERSION >= 46
  126. D3D_MIN_PRECISION MinPrecision;
  127. #endif
  128. } D3D11_SIGNATURE_PARAMETER_DESC;
  129. DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
  130. #define INTERFACE ID3D11ShaderReflectionType
  131. DECLARE_INTERFACE(ID3D11ShaderReflectionType)
  132. {
  133. STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *desc) PURE;
  134. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE;
  135. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByName)(THIS_ const char *name) PURE;
  136. STDMETHOD_(const char *, GetMemberTypeName)(THIS_ UINT index) PURE;
  137. STDMETHOD(IsEqual)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
  138. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetSubType)(THIS) PURE;
  139. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetBaseClass)(THIS) PURE;
  140. STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
  141. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetInterfaceByIndex)(THIS_ UINT index) PURE;
  142. STDMETHOD(IsOfType)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
  143. STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType *base) PURE;
  144. };
  145. #undef INTERFACE
  146. DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
  147. #define INTERFACE ID3D11ShaderReflectionVariable
  148. DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
  149. {
  150. STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *desc) PURE;
  151. STDMETHOD_(struct ID3D11ShaderReflectionType *, GetType)(THIS) PURE;
  152. STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetBuffer)(THIS) PURE;
  153. STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT index) PURE;
  154. };
  155. #undef INTERFACE
  156. DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
  157. #define INTERFACE ID3D11ShaderReflectionConstantBuffer
  158. DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
  159. {
  160. STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *desc) PURE;
  161. STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE;
  162. STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
  163. };
  164. #undef INTERFACE
  165. #if D3D_COMPILER_VERSION <= 42
  166. DEFINE_GUID(IID_ID3D11ShaderReflection, 0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70);
  167. #elif D3D_COMPILER_VERSION == 43
  168. DEFINE_GUID(IID_ID3D11ShaderReflection, 0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1);
  169. #else
  170. DEFINE_GUID(IID_ID3D11ShaderReflection, 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
  171. #endif
  172. #define INTERFACE ID3D11ShaderReflection
  173. DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
  174. {
  175. /* IUnknown methods */
  176. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE;
  177. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  178. STDMETHOD_(ULONG, Release)(THIS) PURE;
  179. /* ID3D11ShaderReflection methods */
  180. STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *desc) PURE;
  181. STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE;
  182. STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ const char *name) PURE;
  183. STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
  184. STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
  185. STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
  186. STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
  187. STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
  188. STDMETHOD(GetResourceBindingDescByName)(THIS_ const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
  189. STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
  190. STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
  191. STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
  192. STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
  193. STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
  194. STDMETHOD_(WINBOOL, IsSampleFrequencyShader)(THIS) PURE;
  195. STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
  196. STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL *level) PURE;
  197. STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ UINT *sizex, UINT *sizey, UINT *sizez) PURE;
  198. STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
  199. };
  200. #undef INTERFACE
  201. DEFINE_GUID(IID_ID3D11ModuleInstance, 0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
  202. #define INTERFACE ID3D11ModuleInstance
  203. DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
  204. {
  205. STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
  206. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  207. STDMETHOD_(ULONG, Release)(THIS) PURE;
  208. /* ID3D11ModuleInstance methods */
  209. STDMETHOD(BindConstantBuffer)(THIS_ UINT srcslot, UINT dstslot, UINT dstoffset) PURE;
  210. STDMETHOD(BindConstantBufferByName)(THIS_ const char *name, UINT dstslot, UINT dstoffset) PURE;
  211. STDMETHOD(BindResource)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
  212. STDMETHOD(BindResourceByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
  213. STDMETHOD(BindSampler)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
  214. STDMETHOD(BindSamplerByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
  215. STDMETHOD(BindUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
  216. STDMETHOD(BindUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
  217. STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
  218. STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
  219. };
  220. #undef INTERFACE
  221. DEFINE_GUID(IID_ID3D11Module, 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
  222. #define INTERFACE ID3D11Module
  223. DECLARE_INTERFACE_(ID3D11Module, IUnknown)
  224. {
  225. STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
  226. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  227. STDMETHOD_(ULONG, Release)(THIS) PURE;
  228. /* ID3D11Module methods */
  229. STDMETHOD(CreateInstance)(THIS_ const char *instnamespace, ID3D11ModuleInstance **moduleinstance) PURE;
  230. };
  231. #undef INTERFACE
  232. #endif