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 /* These are defined as version-neutral in d3dcommon.h */
31 typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
32 
33 typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
34 
35 typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
36 
37 typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
38 
39 typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
40 
41 typedef struct _D3D11_SHADER_DESC
42 {
43     UINT Version;
44     const char *Creator;
45     UINT Flags;
46     UINT ConstantBuffers;
47     UINT BoundResources;
48     UINT InputParameters;
49     UINT OutputParameters;
50     UINT InstructionCount;
51     UINT TempRegisterCount;
52     UINT TempArrayCount;
53     UINT DefCount;
54     UINT DclCount;
55     UINT TextureNormalInstructions;
56     UINT TextureLoadInstructions;
57     UINT TextureCompInstructions;
58     UINT TextureBiasInstructions;
59     UINT TextureGradientInstructions;
60     UINT FloatInstructionCount;
61     UINT IntInstructionCount;
62     UINT UintInstructionCount;
63     UINT StaticFlowControlCount;
64     UINT DynamicFlowControlCount;
65     UINT MacroInstructionCount;
66     UINT ArrayInstructionCount;
67     UINT CutInstructionCount;
68     UINT EmitInstructionCount;
69     D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
70     UINT GSMaxOutputVertexCount;
71     D3D_PRIMITIVE InputPrimitive;
72     UINT PatchConstantParameters;
73     UINT cGSInstanceCount;
74     UINT cControlPoints;
75     D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
76     D3D_TESSELLATOR_PARTITIONING HSPartitioning;
77     D3D_TESSELLATOR_DOMAIN TessellatorDomain;
78     UINT cBarrierInstructions;
79     UINT cInterlockedInstructions;
80     UINT cTextureStoreInstructions;
81 } D3D11_SHADER_DESC;
82 
83 typedef struct _D3D11_SHADER_VARIABLE_DESC
84 {
85     const char *Name;
86     UINT StartOffset;
87     UINT Size;
88     UINT uFlags;
89     void *DefaultValue;
90     UINT StartTexture;
91     UINT TextureSize;
92     UINT StartSampler;
93     UINT SamplerSize;
94 } D3D11_SHADER_VARIABLE_DESC;
95 
96 typedef struct _D3D11_SHADER_TYPE_DESC
97 {
98     D3D_SHADER_VARIABLE_CLASS Class;
99     D3D_SHADER_VARIABLE_TYPE Type;
100     UINT Rows;
101     UINT Columns;
102     UINT Elements;
103     UINT Members;
104     UINT Offset;
105     const char *Name;
106 } D3D11_SHADER_TYPE_DESC;
107 
108 typedef struct _D3D11_SHADER_BUFFER_DESC
109 {
110     const char *Name;
111     D3D_CBUFFER_TYPE Type;
112     UINT Variables;
113     UINT Size;
114     UINT uFlags;
115 } D3D11_SHADER_BUFFER_DESC;
116 
117 typedef struct _D3D11_SHADER_INPUT_BIND_DESC
118 {
119     const char *Name;
120     D3D_SHADER_INPUT_TYPE Type;
121     UINT BindPoint;
122     UINT BindCount;
123     UINT uFlags;
124     D3D_RESOURCE_RETURN_TYPE ReturnType;
125     D3D_SRV_DIMENSION Dimension;
126     UINT NumSamples;
127 } D3D11_SHADER_INPUT_BIND_DESC;
128 
129 typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
130 {
131     const char *SemanticName;
132     UINT SemanticIndex;
133     UINT Register;
134     D3D_NAME SystemValueType;
135     D3D_REGISTER_COMPONENT_TYPE ComponentType;
136     BYTE Mask;
137     BYTE ReadWriteMask;
138     UINT Stream;
139 #if D3D_COMPILER_VERSION >= 46
140     D3D_MIN_PRECISION MinPrecision;
141 #endif
142 } D3D11_SIGNATURE_PARAMETER_DESC;
143 
144 DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
145 
146 #define INTERFACE ID3D11ShaderReflectionType
DECLARE_INTERFACE(ID3D11ShaderReflectionType)147 DECLARE_INTERFACE(ID3D11ShaderReflectionType)
148 {
149     STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *desc) PURE;
150     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE;
151     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByName)(THIS_ const char *name) PURE;
152     STDMETHOD_(const char *, GetMemberTypeName)(THIS_ UINT index) PURE;
153     STDMETHOD(IsEqual)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
154     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetSubType)(THIS) PURE;
155     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetBaseClass)(THIS) PURE;
156     STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
157     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetInterfaceByIndex)(THIS_ UINT index) PURE;
158     STDMETHOD(IsOfType)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
159     STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType *base) PURE;
160 };
161 #undef INTERFACE
162 
163 DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
164 
165 #define INTERFACE ID3D11ShaderReflectionVariable
DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)166 DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
167 {
168     STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *desc) PURE;
169     STDMETHOD_(struct ID3D11ShaderReflectionType *, GetType)(THIS) PURE;
170     STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetBuffer)(THIS) PURE;
171     STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT index) PURE;
172 };
173 #undef INTERFACE
174 
175 DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
176 
177 #define INTERFACE ID3D11ShaderReflectionConstantBuffer
DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)178 DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
179 {
180     STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *desc) PURE;
181     STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE;
182     STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
183 };
184 #undef INTERFACE
185 
186 #if D3D_COMPILER_VERSION <= 42
187 DEFINE_GUID(IID_ID3D11ShaderReflection, 0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70);
188 #elif D3D_COMPILER_VERSION == 43
189 DEFINE_GUID(IID_ID3D11ShaderReflection, 0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1);
190 #else
191 DEFINE_GUID(IID_ID3D11ShaderReflection, 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
192 #endif
193 
194 #define INTERFACE ID3D11ShaderReflection
DECLARE_INTERFACE_(ID3D11ShaderReflection,IUnknown)195 DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
196 {
197     /* IUnknown methods */
198     STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE;
199     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
200     STDMETHOD_(ULONG, Release)(THIS) PURE;
201     /* ID3D11ShaderReflection methods */
202     STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *desc) PURE;
203     STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE;
204     STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ const char *name) PURE;
205     STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
206     STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
207     STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
208     STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
209     STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ const char *name) PURE;
210     STDMETHOD(GetResourceBindingDescByName)(THIS_ const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
211     STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
212     STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
213     STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
214     STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
215     STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
216     STDMETHOD_(WINBOOL, IsSampleFrequencyShader)(THIS) PURE;
217     STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
218     STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL *level) PURE;
219     STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ UINT *sizex, UINT *sizey, UINT *sizez) PURE;
220     STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
221 };
222 #undef INTERFACE
223 
224 DEFINE_GUID(IID_ID3D11ModuleInstance, 0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
225 
226 #define INTERFACE ID3D11ModuleInstance
DECLARE_INTERFACE_(ID3D11ModuleInstance,IUnknown)227 DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
228 {
229     STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
230     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
231     STDMETHOD_(ULONG, Release)(THIS) PURE;
232 
233     /* ID3D11ModuleInstance methods */
234     STDMETHOD(BindConstantBuffer)(THIS_ UINT srcslot, UINT dstslot, UINT dstoffset) PURE;
235     STDMETHOD(BindConstantBufferByName)(THIS_ const char *name, UINT dstslot, UINT dstoffset) PURE;
236 
237     STDMETHOD(BindResource)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
238     STDMETHOD(BindResourceByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
239 
240     STDMETHOD(BindSampler)(THIS_ UINT srcslot,  UINT dstslot,  UINT count) PURE;
241     STDMETHOD(BindSamplerByName)(THIS_ const char *name,  UINT dstslot, UINT count) PURE;
242 
243     STDMETHOD(BindUnorderedAccessView)(THIS_ UINT srcslot,  UINT dstslot, UINT count) PURE;
244     STDMETHOD(BindUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
245 
246     STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ UINT srcslot, UINT dstslot, UINT count) PURE;
247     STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ const char *name, UINT dstslot, UINT count) PURE;
248 };
249 #undef INTERFACE
250 
251 DEFINE_GUID(IID_ID3D11Module, 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
252 
253 #define INTERFACE ID3D11Module
DECLARE_INTERFACE_(ID3D11Module,IUnknown)254 DECLARE_INTERFACE_(ID3D11Module, IUnknown)
255 {
256     STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE;
257     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
258     STDMETHOD_(ULONG, Release)(THIS) PURE;
259 
260     /* ID3D11Module methods */
261     STDMETHOD(CreateInstance)(THIS_ const char *instnamespace, ID3D11ModuleInstance **moduleinstance) PURE;
262 };
263 #undef INTERFACE
264 
265 #endif
266