Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 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 | |||
10 | #ifndef __D3D11SHADER_H__ |
||
11 | #define __D3D11SHADER_H__ |
||
12 | |||
13 | #include "d3d10_1shader.h" |
||
14 | |||
15 | |||
16 | typedef enum D3D11_SHADER_VERSION_TYPE |
||
17 | { |
||
18 | D3D11_SHVER_PIXEL_SHADER = 0, |
||
19 | D3D11_SHVER_VERTEX_SHADER = 1, |
||
20 | D3D11_SHVER_GEOMETRY_SHADER = 2, |
||
21 | |||
22 | // D3D11 Shaders |
||
23 | D3D11_SHVER_HULL_SHADER = 3, |
||
24 | D3D11_SHVER_DOMAIN_SHADER = 4, |
||
25 | D3D11_SHVER_COMPUTE_SHADER = 5, |
||
26 | } D3D11_SHADER_VERSION_TYPE; |
||
27 | |||
28 | #define D3D11_SHVER_GET_TYPE(_Version) \ |
||
29 | (((_Version) >> 16) & 0xffff) |
||
30 | #define D3D11_SHVER_GET_MAJOR(_Version) \ |
||
31 | (((_Version) >> 4) & 0xf) |
||
32 | #define D3D11_SHVER_GET_MINOR(_Version) \ |
||
33 | (((_Version) >> 0) & 0xf) |
||
34 | |||
35 | typedef enum D3D11_RESOURCE_RETURN_TYPE |
||
36 | { |
||
37 | D3D11_RETURN_TYPE_UNORM = 1, |
||
38 | D3D11_RETURN_TYPE_SNORM = 2, |
||
39 | D3D11_RETURN_TYPE_SINT = 3, |
||
40 | D3D11_RETURN_TYPE_UINT = 4, |
||
41 | D3D11_RETURN_TYPE_FLOAT = 5, |
||
42 | D3D11_RETURN_TYPE_MIXED = 6, |
||
43 | D3D11_RETURN_TYPE_DOUBLE = 7, |
||
44 | D3D11_RETURN_TYPE_CONTINUED = 8, |
||
45 | } D3D11_RESOURCE_RETURN_TYPE; |
||
46 | |||
47 | typedef enum _D3D11_CBUFFER_TYPE |
||
48 | { |
||
49 | D3D11_CT_CBUFFER, |
||
50 | D3D11_CT_TBUFFER, |
||
51 | D3D11_CT_INTERFACE_POINTERS, |
||
52 | D3D11_CT_RESOURCE_BIND_INFO, |
||
53 | } D3D11_CBUFFER_TYPE, *LPD3D11_CBUFFER_TYPE; |
||
54 | |||
55 | |||
56 | typedef struct _D3D11_SIGNATURE_PARAMETER_DESC |
||
57 | { |
||
58 | LPCSTR SemanticName; // Name of the semantic |
||
59 | UINT SemanticIndex; // Index of the semantic |
||
60 | UINT Register; // Number of member variables |
||
61 | D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable |
||
62 | D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) |
||
63 | BYTE Mask; // Mask to indicate which components of the register |
||
64 | // are used (combination of D3D10_COMPONENT_MASK values) |
||
65 | BYTE ReadWriteMask; // Mask to indicate whether a given component is |
||
66 | // never written (if this is an output signature) or |
||
67 | // always read (if this is an input signature). |
||
68 | // (combination of D3D10_COMPONENT_MASK values) |
||
69 | UINT Stream; // Stream index |
||
70 | } D3D11_SIGNATURE_PARAMETER_DESC; |
||
71 | |||
72 | typedef struct _D3D11_SHADER_BUFFER_DESC |
||
73 | { |
||
74 | LPCSTR Name; // Name of the constant buffer |
||
75 | D3D11_CBUFFER_TYPE Type; // Indicates type of buffer content |
||
76 | UINT Variables; // Number of member variables |
||
77 | UINT Size; // Size of CB (in bytes) |
||
78 | UINT uFlags; // Buffer description flags |
||
79 | } D3D11_SHADER_BUFFER_DESC; |
||
80 | |||
81 | typedef struct _D3D11_SHADER_VARIABLE_DESC |
||
82 | { |
||
83 | LPCSTR Name; // Name of the variable |
||
84 | UINT StartOffset; // Offset in constant buffer's backing store |
||
85 | UINT Size; // Size of variable (in bytes) |
||
86 | UINT uFlags; // Variable flags |
||
87 | LPVOID DefaultValue; // Raw pointer to default value |
||
88 | UINT StartTexture; // First texture index (or -1 if no textures used) |
||
89 | UINT TextureSize; // Number of texture slots possibly used. |
||
90 | UINT StartSampler; // First sampler index (or -1 if no textures used) |
||
91 | UINT SamplerSize; // Number of sampler slots possibly used. |
||
92 | } D3D11_SHADER_VARIABLE_DESC; |
||
93 | |||
94 | typedef struct _D3D11_SHADER_TYPE_DESC |
||
95 | { |
||
96 | D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) |
||
97 | D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) |
||
98 | UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) |
||
99 | UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) |
||
100 | UINT Elements; // Number of elements (0 if not an array) |
||
101 | UINT Members; // Number of members (0 if not a structure) |
||
102 | UINT Offset; // Offset from the start of structure (0 if not a structure member) |
||
103 | LPCSTR Name; // Name of type, can be NULL |
||
104 | } D3D11_SHADER_TYPE_DESC; |
||
105 | |||
106 | typedef enum D3D11_TESSELLATOR_DOMAIN |
||
107 | { |
||
108 | D3D11_TESSELLATOR_DOMAIN_UNDEFINED = 0, |
||
109 | D3D11_TESSELLATOR_DOMAIN_ISOLINE = 1, |
||
110 | D3D11_TESSELLATOR_DOMAIN_TRI = 2, |
||
111 | D3D11_TESSELLATOR_DOMAIN_QUAD = 3 |
||
112 | } D3D11_TESSELLATOR_DOMAIN; |
||
113 | |||
114 | typedef enum D3D11_TESSELLATOR_PARTITIONING |
||
115 | { |
||
116 | D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = 0, |
||
117 | D3D11_TESSELLATOR_PARTITIONING_INTEGER = 1, |
||
118 | D3D11_TESSELLATOR_PARTITIONING_POW2 = 2, |
||
119 | D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3, |
||
120 | D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4 |
||
121 | } D3D11_TESSELLATOR_PARTITIONING; |
||
122 | |||
123 | typedef enum D3D11_TESSELLATOR_OUTPUT_PRIMITIVE |
||
124 | { |
||
125 | D3D11_TESSELLATOR_OUTPUT_UNDEFINED = 0, |
||
126 | D3D11_TESSELLATOR_OUTPUT_POINT = 1, |
||
127 | D3D11_TESSELLATOR_OUTPUT_LINE = 2, |
||
128 | D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, |
||
129 | D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4 |
||
130 | } D3D11_TESSELLATOR_OUTPUT_PRIMITIVE; |
||
131 | |||
132 | typedef struct _D3D11_SHADER_DESC |
||
133 | { |
||
134 | UINT Version; // Shader version |
||
135 | LPCSTR Creator; // Creator string |
||
136 | UINT Flags; // Shader compilation/parse flags |
||
137 | |||
138 | UINT ConstantBuffers; // Number of constant buffers |
||
139 | UINT BoundResources; // Number of bound resources |
||
140 | UINT InputParameters; // Number of parameters in the input signature |
||
141 | UINT OutputParameters; // Number of parameters in the output signature |
||
142 | |||
143 | UINT InstructionCount; // Number of emitted instructions |
||
144 | UINT TempRegisterCount; // Number of temporary registers used |
||
145 | UINT TempArrayCount; // Number of temporary arrays used |
||
146 | UINT DefCount; // Number of constant defines |
||
147 | UINT DclCount; // Number of declarations (input + output) |
||
148 | UINT TextureNormalInstructions; // Number of non-categorized texture instructions |
||
149 | UINT TextureLoadInstructions; // Number of texture load instructions |
||
150 | UINT TextureCompInstructions; // Number of texture comparison instructions |
||
151 | UINT TextureBiasInstructions; // Number of texture bias instructions |
||
152 | UINT TextureGradientInstructions; // Number of texture gradient instructions |
||
153 | UINT FloatInstructionCount; // Number of floating point arithmetic instructions used |
||
154 | UINT IntInstructionCount; // Number of signed integer arithmetic instructions used |
||
155 | UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used |
||
156 | UINT StaticFlowControlCount; // Number of static flow control instructions used |
||
157 | UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used |
||
158 | UINT MacroInstructionCount; // Number of macro instructions used |
||
159 | UINT ArrayInstructionCount; // Number of array instructions used |
||
160 | UINT CutInstructionCount; // Number of cut instructions used |
||
161 | UINT EmitInstructionCount; // Number of emit instructions used |
||
162 | D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology |
||
163 | UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count |
||
164 | D3D11_PRIMITIVE InputPrimitive; // GS/HS input primitive |
||
165 | UINT PatchConstantParameters; // Number of parameters in the patch constant signature |
||
166 | UINT cGSInstanceCount; // Number of Geometry shader instances |
||
167 | UINT cControlPoints; // Number of control points in the HS->DS stage |
||
168 | D3D11_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator |
||
169 | D3D11_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator |
||
170 | D3D11_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline) |
||
171 | // instruction counts |
||
172 | UINT cBarrierInstructions; // Number of barrier instructions in a compute shader |
||
173 | UINT cInterlockedInstructions; // Number of interlocked instructions |
||
174 | UINT cTextureStoreInstructions; // Number of texture writes |
||
175 | } D3D11_SHADER_DESC; |
||
176 | |||
177 | typedef struct _D3D11_SHADER_INPUT_BIND_DESC |
||
178 | { |
||
179 | LPCSTR Name; // Name of the resource |
||
180 | D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) |
||
181 | UINT BindPoint; // Starting bind point |
||
182 | UINT BindCount; // Number of contiguous bind points (for arrays) |
||
183 | |||
184 | UINT uFlags; // Input binding flags |
||
185 | D3D11_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) |
||
186 | D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) |
||
187 | UINT NumSamples; // Number of samples (0 if not MS texture) |
||
188 | } D3D11_SHADER_INPUT_BIND_DESC; |
||
189 | |||
190 | |||
191 | ////////////////////////////////////////////////////////////////////////////// |
||
192 | // Interfaces //////////////////////////////////////////////////////////////// |
||
193 | ////////////////////////////////////////////////////////////////////////////// |
||
194 | |||
195 | typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType; |
||
196 | typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE; |
||
197 | |||
198 | typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable; |
||
199 | typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE; |
||
200 | |||
201 | typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer; |
||
202 | typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER; |
||
203 | |||
204 | typedef interface ID3D11ShaderReflection ID3D11ShaderReflection; |
||
205 | typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION; |
||
206 | |||
207 | // {6E6FFA6A-9BAE-4613-A51E-91652D508C21} |
||
208 | DEFINE_GUID(IID_ID3D11ShaderReflectionType, |
||
209 | 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21); |
||
210 | |||
211 | #undef INTERFACE |
||
212 | #define INTERFACE ID3D11ShaderReflectionType |
||
213 | |||
214 | DECLARE_INTERFACE(ID3D11ShaderReflectionType) |
||
215 | { |
||
216 | STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_TYPE_DESC *pDesc) PURE; |
||
217 | |||
218 | STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ __in UINT Index) PURE; |
||
219 | STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ __in LPCSTR Name) PURE; |
||
220 | STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ __in UINT Index) PURE; |
||
221 | |||
222 | STDMETHOD(IsEqual)(THIS_ __in ID3D11ShaderReflectionType* pType) PURE; |
||
223 | STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE; |
||
224 | STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE; |
||
225 | STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE; |
||
226 | STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ __in UINT uIndex) PURE; |
||
227 | STDMETHOD(IsOfType)(THIS_ __in ID3D11ShaderReflectionType* pType) PURE; |
||
228 | STDMETHOD(ImplementsInterface)(THIS_ __in ID3D11ShaderReflectionType* pBase) PURE; |
||
229 | }; |
||
230 | |||
231 | // {51F23923-F3E5-4BD1-91CB-606177D8DB4C} |
||
232 | DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, |
||
233 | 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c); |
||
234 | |||
235 | #undef INTERFACE |
||
236 | #define INTERFACE ID3D11ShaderReflectionVariable |
||
237 | |||
238 | DECLARE_INTERFACE(ID3D11ShaderReflectionVariable) |
||
239 | { |
||
240 | STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_VARIABLE_DESC *pDesc) PURE; |
||
241 | |||
242 | STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE; |
||
243 | STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE; |
||
244 | |||
245 | STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ __in UINT uArrayIndex) PURE; |
||
246 | }; |
||
247 | |||
248 | // {EB62D63D-93DD-4318-8AE8-C6F83AD371B8} |
||
249 | DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, |
||
250 | 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8); |
||
251 | |||
252 | #undef INTERFACE |
||
253 | #define INTERFACE ID3D11ShaderReflectionConstantBuffer |
||
254 | |||
255 | DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer) |
||
256 | { |
||
257 | STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE; |
||
258 | |||
259 | STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ __in UINT Index) PURE; |
||
260 | STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ __in LPCSTR Name) PURE; |
||
261 | }; |
||
262 | |||
263 | // {17F27486-A342-4D10-8842-AB0874E7F670} |
||
264 | DEFINE_GUID(IID_ID3D11ShaderReflection, |
||
265 | 0x17f27486, 0xa342, 0x4d10, 0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70); |
||
266 | |||
267 | #undef INTERFACE |
||
268 | #define INTERFACE ID3D11ShaderReflection |
||
269 | |||
270 | DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown) |
||
271 | { |
||
272 | STDMETHOD(QueryInterface)(THIS_ __in REFIID iid, |
||
273 | __out LPVOID *ppv) PURE; |
||
274 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
||
275 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
||
276 | |||
277 | STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_DESC *pDesc) PURE; |
||
278 | |||
279 | STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ __in UINT Index) PURE; |
||
280 | STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ __in LPCSTR Name) PURE; |
||
281 | |||
282 | STDMETHOD(GetResourceBindingDesc)(THIS_ __in UINT ResourceIndex, |
||
283 | __out D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE; |
||
284 | |||
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 | |||
292 | STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ __in LPCSTR Name) PURE; |
||
293 | |||
294 | STDMETHOD(GetResourceBindingDescByName)(THIS_ __in LPCSTR Name, |
||
295 | __out D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE; |
||
296 | |||
297 | STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE; |
||
298 | STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE; |
||
299 | STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE; |
||
300 | STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE; |
||
301 | |||
302 | STDMETHOD_(D3D10_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE; |
||
303 | STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE; |
||
304 | |||
305 | STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE; |
||
306 | STDMETHOD(GetMinFeatureLevel)(THIS_ __out enum D3D_FEATURE_LEVEL* pLevel) PURE; |
||
307 | }; |
||
308 | |||
309 | ////////////////////////////////////////////////////////////////////////////// |
||
310 | // APIs ////////////////////////////////////////////////////////////////////// |
||
311 | ////////////////////////////////////////////////////////////////////////////// |
||
312 | |||
313 | #ifdef __cplusplus |
||
314 | extern "C" { |
||
315 | #endif //__cplusplus |
||
316 | |||
317 | #ifdef __cplusplus |
||
318 | } |
||
319 | #endif //__cplusplus |
||
320 | |||
321 | #endif //__D3D11SHADER_H__ |
||
322 |