| 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 | |
| 20 | #ifndef __D3D11SHADER_H__ |
| 21 | #define __D3D11SHADER_H__ |
| 22 | |
| 23 | #include "d3dcommon.h" |
| 24 | |
| 25 | /* If not defined set d3dcompiler_47 by default. */ |
| 26 | #ifndef D3D_COMPILER_VERSION |
| 27 | #define D3D_COMPILER_VERSION 47 |
| 28 | #endif |
| 29 | |
| 30 | #define D3D_SHADER_REQUIRES_DOUBLES 0x00000001 |
| 31 | #define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002 |
| 32 | #define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004 |
| 33 | #define D3D_SHADER_REQUIRES_64_UAVS 0x00000008 |
| 34 | #define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010 |
| 35 | #define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020 |
| 36 | #define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040 |
| 37 | #define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080 |
| 38 | #define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100 |
| 39 | |
| 40 | /* These are defined as version-neutral in d3dcommon.h */ |
| 41 | typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE; |
| 42 | |
| 43 | typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE; |
| 44 | |
| 45 | typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN; |
| 46 | |
| 47 | typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING; |
| 48 | |
| 49 | typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE; |
| 50 | |
| 51 | typedef struct _D3D11_SHADER_DESC |
| 52 | { |
| 53 | UINT Version; |
| 54 | const char *Creator; |
| 55 | UINT Flags; |
| 56 | UINT ConstantBuffers; |
| 57 | UINT BoundResources; |
| 58 | UINT InputParameters; |
| 59 | UINT OutputParameters; |
| 60 | UINT InstructionCount; |
| 61 | UINT TempRegisterCount; |
| 62 | UINT TempArrayCount; |
| 63 | UINT DefCount; |
| 64 | UINT DclCount; |
| 65 | UINT TextureNormalInstructions; |
| 66 | UINT TextureLoadInstructions; |
| 67 | UINT TextureCompInstructions; |
| 68 | UINT TextureBiasInstructions; |
| 69 | UINT TextureGradientInstructions; |
| 70 | UINT FloatInstructionCount; |
| 71 | UINT IntInstructionCount; |
| 72 | UINT UintInstructionCount; |
| 73 | UINT StaticFlowControlCount; |
| 74 | UINT DynamicFlowControlCount; |
| 75 | UINT MacroInstructionCount; |
| 76 | UINT ArrayInstructionCount; |
| 77 | UINT CutInstructionCount; |
| 78 | UINT EmitInstructionCount; |
| 79 | D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; |
| 80 | UINT GSMaxOutputVertexCount; |
| 81 | D3D_PRIMITIVE InputPrimitive; |
| 82 | UINT PatchConstantParameters; |
| 83 | UINT cGSInstanceCount; |
| 84 | UINT cControlPoints; |
| 85 | D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; |
| 86 | D3D_TESSELLATOR_PARTITIONING HSPartitioning; |
| 87 | D3D_TESSELLATOR_DOMAIN TessellatorDomain; |
| 88 | UINT cBarrierInstructions; |
| 89 | UINT cInterlockedInstructions; |
| 90 | UINT cTextureStoreInstructions; |
| 91 | } D3D11_SHADER_DESC; |
| 92 | |
| 93 | typedef struct _D3D11_SHADER_VARIABLE_DESC |
| 94 | { |
| 95 | const char *Name; |
| 96 | UINT StartOffset; |
| 97 | UINT Size; |
| 98 | UINT uFlags; |
| 99 | void *DefaultValue; |
| 100 | UINT StartTexture; |
| 101 | UINT TextureSize; |
| 102 | UINT StartSampler; |
| 103 | UINT SamplerSize; |
| 104 | } D3D11_SHADER_VARIABLE_DESC; |
| 105 | |
| 106 | typedef struct _D3D11_SHADER_TYPE_DESC |
| 107 | { |
| 108 | D3D_SHADER_VARIABLE_CLASS Class; |
| 109 | D3D_SHADER_VARIABLE_TYPE Type; |
| 110 | UINT Rows; |
| 111 | UINT Columns; |
| 112 | UINT Elements; |
| 113 | UINT Members; |
| 114 | UINT Offset; |
| 115 | const char *Name; |
| 116 | } D3D11_SHADER_TYPE_DESC; |
| 117 | |
| 118 | typedef struct _D3D11_SHADER_BUFFER_DESC |
| 119 | { |
| 120 | const char *Name; |
| 121 | D3D_CBUFFER_TYPE Type; |
| 122 | UINT Variables; |
| 123 | UINT Size; |
| 124 | UINT uFlags; |
| 125 | } D3D11_SHADER_BUFFER_DESC; |
| 126 | |
| 127 | typedef struct _D3D11_SHADER_INPUT_BIND_DESC |
| 128 | { |
| 129 | const char *Name; |
| 130 | D3D_SHADER_INPUT_TYPE Type; |
| 131 | UINT BindPoint; |
| 132 | UINT BindCount; |
| 133 | UINT uFlags; |
| 134 | D3D_RESOURCE_RETURN_TYPE ReturnType; |
| 135 | D3D_SRV_DIMENSION Dimension; |
| 136 | UINT NumSamples; |
| 137 | } D3D11_SHADER_INPUT_BIND_DESC; |
| 138 | |
| 139 | typedef struct _D3D11_SIGNATURE_PARAMETER_DESC |
| 140 | { |
| 141 | const char *SemanticName; |
| 142 | UINT SemanticIndex; |
| 143 | UINT Register; |
| 144 | D3D_NAME SystemValueType; |
| 145 | D3D_REGISTER_COMPONENT_TYPE ComponentType; |
| 146 | BYTE Mask; |
| 147 | BYTE ReadWriteMask; |
| 148 | UINT Stream; |
| 149 | #if D3D_COMPILER_VERSION >= 46 |
| 150 | D3D_MIN_PRECISION MinPrecision; |
| 151 | #endif |
| 152 | } D3D11_SIGNATURE_PARAMETER_DESC; |
| 153 | |
| 154 | typedef struct _D3D11_PARAMETER_DESC |
| 155 | { |
| 156 | LPCSTR Name; |
| 157 | LPCSTR SemanticName; |
| 158 | D3D_SHADER_VARIABLE_TYPE Type; |
| 159 | D3D_SHADER_VARIABLE_CLASS Class; |
| 160 | UINT Rows; |
| 161 | UINT Columns; |
| 162 | D3D_INTERPOLATION_MODE InterpolationMode; |
| 163 | D3D_PARAMETER_FLAGS Flags; |
| 164 | UINT FirstInRegister; |
| 165 | UINT FirstInComponent; |
| 166 | UINT FirstOutRegister; |
| 167 | UINT FirstOutComponent; |
| 168 | } D3D11_PARAMETER_DESC; |
| 169 | |
| 170 | DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21); |
| 171 | |
| 172 | #define INTERFACE ID3D11ShaderReflectionType |
| 173 | DECLARE_INTERFACE(ID3D11ShaderReflectionType) |
| 174 | { |
| 175 | STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *desc) PURE; |
| 176 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE; |
| 177 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByName)(THIS_ const char *name) PURE; |
| 178 | STDMETHOD_(const char *, GetMemberTypeName)(THIS_ UINT index) PURE; |
| 179 | STDMETHOD(IsEqual)(THIS_ struct ID3D11ShaderReflectionType *type) PURE; |
| 180 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetSubType)(THIS) PURE; |
| 181 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetBaseClass)(THIS) PURE; |
| 182 | STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE; |
| 183 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetInterfaceByIndex)(THIS_ UINT index) PURE; |
| 184 | STDMETHOD(IsOfType)(THIS_ struct ID3D11ShaderReflectionType *type) PURE; |
| 185 | STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType *base) PURE; |
| 186 | }; |
| 187 | #undef INTERFACE |
| 188 | |
| 189 | DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c); |
| 190 | |
| 191 | #define INTERFACE ID3D11ShaderReflectionVariable |
| 192 | DECLARE_INTERFACE(ID3D11ShaderReflectionVariable) |
| 193 | { |
| 194 | STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *desc) PURE; |
| 195 | STDMETHOD_(struct ID3D11ShaderReflectionType *, GetType)(THIS) PURE; |
| 196 | STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetBuffer)(THIS) PURE; |
| 197 | STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT index) PURE; |
| 198 | }; |
| 199 | #undef INTERFACE |
| 200 | |
| 201 | DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8); |
| 202 | |
| 203 | #define INTERFACE ID3D11ShaderReflectionConstantBuffer |
| 204 | DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer) |
| 205 | { |
| 206 | STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *desc) PURE; |
| 207 | STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE; |
| 208 | STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE; |
| 209 | }; |
| 210 | #undef INTERFACE |
| 211 | |
| 212 | #if D3D_COMPILER_VERSION <= 42 |
| 213 | DEFINE_GUID(IID_ID3D11ShaderReflection, 0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70); |
| 214 | #elif D3D_COMPILER_VERSION == 43 |
| 215 | DEFINE_GUID(IID_ID3D11ShaderReflection, 0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1); |
| 216 | #else |
| 217 | DEFINE_GUID(IID_ID3D11ShaderReflection, 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84); |
| 218 | #endif |
| 219 | |
| 220 | #define INTERFACE ID3D11ShaderReflection |
| 221 | DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown) |
| 222 | { |
| 223 | /* IUnknown methods */ |
| 224 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; |
| 225 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 226 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 227 | /* ID3D11ShaderReflection methods */ |
| 228 | STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *desc) PURE; |
| 229 | STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE; |
| 230 | STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ const char *name) PURE; |
| 231 | STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE; |
| 232 | STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE; |
| 233 | STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE; |
| 234 | STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE; |
| 235 | STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE; |
| 236 | STDMETHOD(GetResourceBindingDescByName)(THIS_ const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE; |
| 237 | STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE; |
| 238 | STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE; |
| 239 | STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE; |
| 240 | STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE; |
| 241 | STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE; |
| 242 | STDMETHOD_(WINBOOL, IsSampleFrequencyShader)(THIS) PURE; |
| 243 | STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE; |
| 244 | STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL *level) PURE; |
| 245 | STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ UINT *sizex, UINT *sizey, UINT *sizez) PURE; |
| 246 | STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE; |
| 247 | }; |
| 248 | #undef INTERFACE |
| 249 | |
| 250 | DEFINE_GUID(IID_ID3D11ModuleInstance, 0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d); |
| 251 | |
| 252 | #define INTERFACE ID3D11ModuleInstance |
| 253 | DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown) |
| 254 | { |
| 255 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 256 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 257 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 258 | |
| 259 | /* ID3D11ModuleInstance methods */ |
| 260 | STDMETHOD(BindConstantBuffer)(THIS_ UINT srcslot, UINT dstslot, UINT dstoffset) PURE; |
| 261 | STDMETHOD(BindConstantBufferByName)(THIS_ const char *name, UINT dstslot, UINT dstoffset) PURE; |
| 262 | |
| 263 | STDMETHOD(BindResource)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE; |
| 264 | STDMETHOD(BindResourceByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE; |
| 265 | |
| 266 | STDMETHOD(BindSampler)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE; |
| 267 | STDMETHOD(BindSamplerByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE; |
| 268 | |
| 269 | STDMETHOD(BindUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE; |
| 270 | STDMETHOD(BindUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE; |
| 271 | |
| 272 | STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE; |
| 273 | STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE; |
| 274 | }; |
| 275 | #undef INTERFACE |
| 276 | |
| 277 | DEFINE_GUID(IID_ID3D11Module, 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34); |
| 278 | |
| 279 | #define INTERFACE ID3D11Module |
| 280 | DECLARE_INTERFACE_(ID3D11Module, IUnknown) |
| 281 | { |
| 282 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 283 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 284 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 285 | |
| 286 | /* ID3D11Module methods */ |
| 287 | STDMETHOD(CreateInstance)(THIS_ const char *instnamespace, ID3D11ModuleInstance **moduleinstance) PURE; |
| 288 | }; |
| 289 | #undef INTERFACE |
| 290 | |
| 291 | DEFINE_GUID(IID_ID3D11Linker, 0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0x0e); |
| 292 | |
| 293 | #define INTERFACE ID3D11Linker |
| 294 | DECLARE_INTERFACE_(ID3D11Linker, IUnknown) |
| 295 | { |
| 296 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 297 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 298 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 299 | |
| 300 | /* ID3D11Linker methods */ |
| 301 | STDMETHOD(Link)(THIS_ ID3D11ModuleInstance *instance, LPCSTR instname, LPCSTR targetname, UINT flags, ID3DBlob **shader, ID3DBlob **error) PURE; |
| 302 | STDMETHOD(UseLibrary)(THIS_ ID3D11ModuleInstance *libinstance) PURE; |
| 303 | STDMETHOD(AddClipPlaneFromCBuffer)(THIS_ UINT bufferslot, UINT bufferentry) PURE; |
| 304 | }; |
| 305 | #undef INTERFACE |
| 306 | |
| 307 | DEFINE_GUID(IID_ID3D11LinkingNode, 0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x3, 0xc7, 0x9b, 0x35, 0x56, 0xdb); |
| 308 | |
| 309 | #define INTERFACE ID3D11LinkingNode |
| 310 | DECLARE_INTERFACE_(ID3D11LinkingNode, IUnknown) |
| 311 | { |
| 312 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 313 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 314 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 315 | }; |
| 316 | #undef INTERFACE |
| 317 | |
| 318 | DEFINE_GUID(IID_ID3D11FunctionLinkingGraph, 0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff); |
| 319 | |
| 320 | #define INTERFACE ID3D11FunctionLinkingGraph |
| 321 | DECLARE_INTERFACE_(ID3D11FunctionLinkingGraph, IUnknown) |
| 322 | { |
| 323 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 324 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 325 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 326 | |
| 327 | /* ID3D11FunctionLinkingGraph methods */ |
| 328 | STDMETHOD(CreateModuleInstance)(THIS_ ID3D11ModuleInstance **instance, ID3DBlob **error) PURE; |
| 329 | STDMETHOD(SetInputSignature)(THIS_ const D3D11_PARAMETER_DESC *parameter_desc, UINT parameter_count, ID3D11LinkingNode **input_node) PURE; |
| 330 | STDMETHOD(SetOutputSignature)(THIS_ const D3D11_PARAMETER_DESC *parameter_desc, UINT parameter_count, ID3D11LinkingNode **output_node) PURE; |
| 331 | STDMETHOD(CallFunction)(THIS_ LPCSTR _namespace, ID3D11Module *module, LPCSTR function_name, ID3D11LinkingNode **call_node) PURE; |
| 332 | STDMETHOD(PassValue)(THIS_ ID3D11LinkingNode *src_node, INT src_parameter_index, ID3D11LinkingNode *dst_node, INT dst_parameter_index) PURE; |
| 333 | STDMETHOD(PassValueWithSwizzle)(THIS_ ID3D11LinkingNode *src_node, INT src_parameter_index, LPCSTR src_swizzle, ID3D11LinkingNode *dst_node, INT dst_parameter_index,LPCSTR dst_swizzle) PURE; |
| 334 | STDMETHOD(GetLastError)(THIS_ ID3DBlob **error) PURE; |
| 335 | STDMETHOD(GenerateHlsl)(THIS_ UINT flags, ID3DBlob **buffer) PURE; |
| 336 | }; |
| 337 | #undef INTERFACE |
| 338 | |
| 339 | #endif |