master
  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 */
 41typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
 42
 43typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
 44
 45typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
 46
 47typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
 48
 49typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
 50
 51typedef 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
 93typedef 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
106typedef 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
118typedef 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
127typedef 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
139typedef 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
154DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
155
156#define INTERFACE ID3D11ShaderReflectionType
157DECLARE_INTERFACE(ID3D11ShaderReflectionType)
158{
159    STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *desc) PURE;
160    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE;
161    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByName)(THIS_ const char *name) PURE;
162    STDMETHOD_(const char *, GetMemberTypeName)(THIS_ UINT index) PURE;
163    STDMETHOD(IsEqual)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
164    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetSubType)(THIS) PURE;
165    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetBaseClass)(THIS) PURE;
166    STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
167    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetInterfaceByIndex)(THIS_ UINT index) PURE;
168    STDMETHOD(IsOfType)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
169    STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType *base) PURE;
170};
171#undef INTERFACE
172
173DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
174
175#define INTERFACE ID3D11ShaderReflectionVariable
176DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
177{
178    STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *desc) PURE;
179    STDMETHOD_(struct ID3D11ShaderReflectionType *, GetType)(THIS) PURE;
180    STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetBuffer)(THIS) PURE;
181    STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT index) PURE;
182};
183#undef INTERFACE
184
185DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
186
187#define INTERFACE ID3D11ShaderReflectionConstantBuffer
188DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
189{
190    STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *desc) PURE;
191    STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE;
192    STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
193};
194#undef INTERFACE
195
196#if D3D_COMPILER_VERSION <= 42
197DEFINE_GUID(IID_ID3D11ShaderReflection, 0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70);
198#elif D3D_COMPILER_VERSION == 43
199DEFINE_GUID(IID_ID3D11ShaderReflection, 0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1);
200#else
201DEFINE_GUID(IID_ID3D11ShaderReflection, 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
202#endif
203
204#define INTERFACE ID3D11ShaderReflection
205DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
206{
207    /* IUnknown methods */
208    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE;
209    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
210    STDMETHOD_(ULONG, Release)(THIS) PURE;
211    /* ID3D11ShaderReflection methods */
212    STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *desc) PURE;
213    STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE;
214    STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ const char *name) PURE;
215    STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
216    STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
217    STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
218    STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
219    STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
220    STDMETHOD(GetResourceBindingDescByName)(THIS_ const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
221    STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
222    STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
223    STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
224    STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
225    STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
226    STDMETHOD_(WINBOOL, IsSampleFrequencyShader)(THIS) PURE;
227    STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
228    STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL *level) PURE;
229    STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ UINT *sizex, UINT *sizey, UINT *sizez) PURE;
230    STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
231};
232#undef INTERFACE
233
234DEFINE_GUID(IID_ID3D11ModuleInstance, 0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
235
236#define INTERFACE ID3D11ModuleInstance
237DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
238{
239    STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
240    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
241    STDMETHOD_(ULONG, Release)(THIS) PURE;
242
243    /* ID3D11ModuleInstance methods */
244    STDMETHOD(BindConstantBuffer)(THIS_ UINT srcslot, UINT dstslot, UINT dstoffset) PURE;
245    STDMETHOD(BindConstantBufferByName)(THIS_ const char *name, UINT dstslot, UINT dstoffset) PURE;
246
247    STDMETHOD(BindResource)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
248    STDMETHOD(BindResourceByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
249
250    STDMETHOD(BindSampler)(THIS_ UINT srcslot,  UINT dstslot,  UINT count) PURE;
251    STDMETHOD(BindSamplerByName)(THIS_ const char *name,  UINT dstslot, UINT count) PURE;
252
253    STDMETHOD(BindUnorderedAccessView)(THIS_ UINT srcslot,  UINT dstslot, UINT count) PURE;
254    STDMETHOD(BindUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
255
256    STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
257    STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
258};
259#undef INTERFACE
260
261DEFINE_GUID(IID_ID3D11Module, 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
262
263#define INTERFACE ID3D11Module
264DECLARE_INTERFACE_(ID3D11Module, IUnknown)
265{
266    STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
267    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
268    STDMETHOD_(ULONG, Release)(THIS) PURE;
269
270    /* ID3D11Module methods */
271    STDMETHOD(CreateInstance)(THIS_ const char *instnamespace, ID3D11ModuleInstance **moduleinstance) PURE;
272};
273#undef INTERFACE
274
275DEFINE_GUID(IID_ID3D11Linker, 0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0x0e);
276
277#define INTERFACE ID3D11Linker
278DECLARE_INTERFACE_(ID3D11Linker, IUnknown)
279{
280    STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
281    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
282    STDMETHOD_(ULONG, Release)(THIS) PURE;
283
284    /* ID3D11Linker methods */
285    STDMETHOD(Link)(THIS_ ID3D11ModuleInstance *instance, LPCSTR instname, LPCSTR targetname, UINT flags, ID3DBlob **shader, ID3DBlob **error) PURE;
286    STDMETHOD(UseLibrary)(THIS_ ID3D11ModuleInstance *libinstance) PURE;
287    STDMETHOD(AddClipPlaneFromCBuffer)(THIS_ UINT bufferslot, UINT bufferentry) PURE;
288};
289#undef INTERFACE
290
291#endif