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: D3D10Shader.h |
||
6 | // Content: D3D10 Shader Types and APIs |
||
7 | // |
||
8 | ////////////////////////////////////////////////////////////////////////////// |
||
9 | |||
10 | #ifndef __D3D10SHADER_H__ |
||
11 | #define __D3D10SHADER_H__ |
||
12 | |||
13 | #include "d3d10.h" |
||
14 | |||
15 | |||
16 | //--------------------------------------------------------------------------- |
||
17 | // D3D10_TX_VERSION: |
||
18 | // -------------- |
||
19 | // Version token used to create a procedural texture filler in effects |
||
20 | // Used by D3D10Fill[]TX functions |
||
21 | //--------------------------------------------------------------------------- |
||
22 | #define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) |
||
23 | |||
24 | |||
25 | //---------------------------------------------------------------------------- |
||
26 | // D3D10SHADER flags: |
||
27 | // ----------------- |
||
28 | // D3D10_SHADER_DEBUG |
||
29 | // Insert debug file/line/type/symbol information. |
||
30 | // |
||
31 | // D3D10_SHADER_SKIP_VALIDATION |
||
32 | // Do not validate the generated code against known capabilities and |
||
33 | // constraints. This option is only recommended when compiling shaders |
||
34 | // you KNOW will work. (ie. have compiled before without this option.) |
||
35 | // Shaders are always validated by D3D before they are set to the device. |
||
36 | // |
||
37 | // D3D10_SHADER_SKIP_OPTIMIZATION |
||
38 | // Instructs the compiler to skip optimization steps during code generation. |
||
39 | // Unless you are trying to isolate a problem in your code using this option |
||
40 | // is not recommended. |
||
41 | // |
||
42 | // D3D10_SHADER_PACK_MATRIX_ROW_MAJOR |
||
43 | // Unless explicitly specified, matrices will be packed in row-major order |
||
44 | // on input and output from the shader. |
||
45 | // |
||
46 | // D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR |
||
47 | // Unless explicitly specified, matrices will be packed in column-major |
||
48 | // order on input and output from the shader. This is generally more |
||
49 | // efficient, since it allows vector-matrix multiplication to be performed |
||
50 | // using a series of dot-products. |
||
51 | // |
||
52 | // D3D10_SHADER_PARTIAL_PRECISION |
||
53 | // Force all computations in resulting shader to occur at partial precision. |
||
54 | // This may result in faster evaluation of shaders on some hardware. |
||
55 | // |
||
56 | // D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT |
||
57 | // Force compiler to compile against the next highest available software |
||
58 | // target for vertex shaders. This flag also turns optimizations off, |
||
59 | // and debugging on. |
||
60 | // |
||
61 | // D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT |
||
62 | // Force compiler to compile against the next highest available software |
||
63 | // target for pixel shaders. This flag also turns optimizations off, |
||
64 | // and debugging on. |
||
65 | // |
||
66 | // D3D10_SHADER_NO_PRESHADER |
||
67 | // Disables Preshaders. Using this flag will cause the compiler to not |
||
68 | // pull out static expression for evaluation on the host cpu |
||
69 | // |
||
70 | // D3D10_SHADER_AVOID_FLOW_CONTROL |
||
71 | // Hint compiler to avoid flow-control constructs where possible. |
||
72 | // |
||
73 | // D3D10_SHADER_PREFER_FLOW_CONTROL |
||
74 | // Hint compiler to prefer flow-control constructs where possible. |
||
75 | // |
||
76 | // D3D10_SHADER_ENABLE_STRICTNESS |
||
77 | // By default, the HLSL/Effect compilers are not strict on deprecated syntax. |
||
78 | // Specifying this flag enables the strict mode. Deprecated syntax may be |
||
79 | // removed in a future release, and enabling syntax is a good way to make sure |
||
80 | // your shaders comply to the latest spec. |
||
81 | // |
||
82 | // D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY |
||
83 | // This enables older shaders to compile to 4_0 targets. |
||
84 | // |
||
85 | //---------------------------------------------------------------------------- |
||
86 | |||
87 | #define D3D10_SHADER_DEBUG (1 << 0) |
||
88 | #define D3D10_SHADER_SKIP_VALIDATION (1 << 1) |
||
89 | #define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) |
||
90 | #define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) |
||
91 | #define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) |
||
92 | #define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) |
||
93 | #define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) |
||
94 | #define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) |
||
95 | #define D3D10_SHADER_NO_PRESHADER (1 << 8) |
||
96 | #define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) |
||
97 | #define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) |
||
98 | #define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) |
||
99 | #define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) |
||
100 | #define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) |
||
101 | #define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18) |
||
102 | |||
103 | |||
104 | // optimization level flags |
||
105 | #define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) |
||
106 | #define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 |
||
107 | #define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) |
||
108 | #define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) |
||
109 | |||
110 | |||
111 | |||
112 | |||
113 | //---------------------------------------------------------------------------- |
||
114 | // D3D10_SHADER_MACRO: |
||
115 | // ---------- |
||
116 | // Preprocessor macro definition. The application pass in a NULL-terminated |
||
117 | // array of this structure to various D3D10 APIs. This enables the application |
||
118 | // to #define tokens at runtime, before the file is parsed. |
||
119 | //---------------------------------------------------------------------------- |
||
120 | |||
121 | typedef struct _D3D10_SHADER_MACRO |
||
122 | { |
||
123 | LPCSTR Name; |
||
124 | LPCSTR Definition; |
||
125 | |||
126 | } D3D10_SHADER_MACRO, *LPD3D10_SHADER_MACRO; |
||
127 | |||
128 | |||
129 | //---------------------------------------------------------------------------- |
||
130 | // D3D10_SHADER_VARIABLE_CLASS: |
||
131 | //---------------------------------------------------------------------------- |
||
132 | |||
133 | typedef enum _D3D10_SHADER_VARIABLE_CLASS |
||
134 | { |
||
135 | D3D10_SVC_SCALAR, |
||
136 | D3D10_SVC_VECTOR, |
||
137 | D3D10_SVC_MATRIX_ROWS, |
||
138 | D3D10_SVC_MATRIX_COLUMNS, |
||
139 | D3D10_SVC_OBJECT, |
||
140 | D3D10_SVC_STRUCT, |
||
141 | |||
142 | D3D11_SVC_INTERFACE_CLASS, |
||
143 | D3D11_SVC_INTERFACE_POINTER, |
||
144 | |||
145 | // force 32-bit size enum |
||
146 | D3D10_SVC_FORCE_DWORD = 0x7fffffff |
||
147 | |||
148 | } D3D10_SHADER_VARIABLE_CLASS, *LPD3D10_SHADER_VARIABLE_CLASS; |
||
149 | |||
150 | typedef enum _D3D10_SHADER_VARIABLE_FLAGS |
||
151 | { |
||
152 | D3D10_SVF_USERPACKED = 1, |
||
153 | D3D10_SVF_USED = 2, |
||
154 | |||
155 | D3D11_SVF_INTERFACE_POINTER = 4, |
||
156 | D3D11_SVF_INTERFACE_PARAMETER = 8, |
||
157 | |||
158 | // force 32-bit size enum |
||
159 | D3D10_SVF_FORCE_DWORD = 0x7fffffff |
||
160 | |||
161 | } D3D10_SHADER_VARIABLE_FLAGS, *LPD3D10_SHADER_VARIABLE_FLAGS; |
||
162 | |||
163 | //---------------------------------------------------------------------------- |
||
164 | // D3D10_SHADER_VARIABLE_TYPE: |
||
165 | //---------------------------------------------------------------------------- |
||
166 | typedef enum _D3D10_SHADER_VARIABLE_TYPE |
||
167 | { |
||
168 | D3D10_SVT_VOID = 0, |
||
169 | D3D10_SVT_BOOL = 1, |
||
170 | D3D10_SVT_INT = 2, |
||
171 | D3D10_SVT_FLOAT = 3, |
||
172 | D3D10_SVT_STRING = 4, |
||
173 | D3D10_SVT_TEXTURE = 5, |
||
174 | D3D10_SVT_TEXTURE1D = 6, |
||
175 | D3D10_SVT_TEXTURE2D = 7, |
||
176 | D3D10_SVT_TEXTURE3D = 8, |
||
177 | D3D10_SVT_TEXTURECUBE = 9, |
||
178 | D3D10_SVT_SAMPLER = 10, |
||
179 | D3D10_SVT_PIXELSHADER = 15, |
||
180 | D3D10_SVT_VERTEXSHADER = 16, |
||
181 | D3D10_SVT_UINT = 19, |
||
182 | D3D10_SVT_UINT8 = 20, |
||
183 | D3D10_SVT_GEOMETRYSHADER = 21, |
||
184 | D3D10_SVT_RASTERIZER = 22, |
||
185 | D3D10_SVT_DEPTHSTENCIL = 23, |
||
186 | D3D10_SVT_BLEND = 24, |
||
187 | D3D10_SVT_BUFFER = 25, |
||
188 | D3D10_SVT_CBUFFER = 26, |
||
189 | D3D10_SVT_TBUFFER = 27, |
||
190 | D3D10_SVT_TEXTURE1DARRAY = 28, |
||
191 | D3D10_SVT_TEXTURE2DARRAY = 29, |
||
192 | D3D10_SVT_RENDERTARGETVIEW = 30, |
||
193 | D3D10_SVT_DEPTHSTENCILVIEW = 31, |
||
194 | |||
195 | D3D10_SVT_TEXTURE2DMS = 32, |
||
196 | D3D10_SVT_TEXTURE2DMSARRAY = 33, |
||
197 | |||
198 | D3D10_SVT_TEXTURECUBEARRAY = 34, |
||
199 | |||
200 | D3D11_SVT_HULLSHADER = 35, |
||
201 | D3D11_SVT_DOMAINSHADER = 36, |
||
202 | |||
203 | D3D11_SVT_INTERFACE_POINTER = 37, |
||
204 | D3D11_SVT_COMPUTESHADER = 38, |
||
205 | |||
206 | D3D11_SVT_DOUBLE = 39, |
||
207 | |||
208 | D3D11_SVT_RWTEXTURE1D, |
||
209 | D3D11_SVT_RWTEXTURE1DARRAY, |
||
210 | D3D11_SVT_RWTEXTURE2D, |
||
211 | D3D11_SVT_RWTEXTURE2DARRAY, |
||
212 | D3D11_SVT_RWTEXTURE3D, |
||
213 | D3D11_SVT_RWBUFFER, |
||
214 | |||
215 | D3D11_SVT_BYTEADDRESS_BUFFER, |
||
216 | D3D11_SVT_RWBYTEADDRESS_BUFFER, |
||
217 | D3D11_SVT_STRUCTURED_BUFFER, |
||
218 | D3D11_SVT_RWSTRUCTURED_BUFFER, |
||
219 | D3D11_SVT_APPEND_STRUCTURED_BUFFER, |
||
220 | D3D11_SVT_CONSUME_STRUCTURED_BUFFER, |
||
221 | |||
222 | // force 32-bit size enum |
||
223 | D3D10_SVT_FORCE_DWORD = 0x7fffffff |
||
224 | |||
225 | } D3D10_SHADER_VARIABLE_TYPE, *LPD3D10_SHADER_VARIABLE_TYPE; |
||
226 | |||
227 | typedef enum _D3D10_SHADER_INPUT_FLAGS |
||
228 | { |
||
229 | D3D10_SIF_USERPACKED = 1, |
||
230 | D3D10_SIF_COMPARISON_SAMPLER = 2, // is this a comparison sampler? |
||
231 | D3D10_SIF_TEXTURE_COMPONENT_0 = 4, // this 2-bit value encodes c - 1, where c |
||
232 | D3D10_SIF_TEXTURE_COMPONENT_1 = 8, // is the number of components in the texture |
||
233 | D3D10_SIF_TEXTURE_COMPONENTS = 12, |
||
234 | |||
235 | // force 32-bit size enum |
||
236 | D3D10_SIF_FORCE_DWORD = 0x7fffffff |
||
237 | } D3D10_SHADER_INPUT_FLAGS, *LPD3D10_SHADER_INPUT_FLAGS; |
||
238 | |||
239 | //---------------------------------------------------------------------------- |
||
240 | // D3D10_SHADER_INPUT_TYPE |
||
241 | //---------------------------------------------------------------------------- |
||
242 | typedef enum _D3D10_SHADER_INPUT_TYPE |
||
243 | { |
||
244 | D3D10_SIT_CBUFFER, |
||
245 | D3D10_SIT_TBUFFER, |
||
246 | D3D10_SIT_TEXTURE, |
||
247 | D3D10_SIT_SAMPLER, |
||
248 | D3D11_SIT_UAV_RWTYPED, |
||
249 | D3D11_SIT_STRUCTURED, |
||
250 | D3D11_SIT_UAV_RWSTRUCTURED, |
||
251 | D3D11_SIT_BYTEADDRESS, |
||
252 | D3D11_SIT_UAV_RWBYTEADDRESS, |
||
253 | D3D11_SIT_UAV_APPEND_STRUCTURED, |
||
254 | D3D11_SIT_UAV_CONSUME_STRUCTURED, |
||
255 | D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, |
||
256 | } D3D10_SHADER_INPUT_TYPE, *LPD3D10_SHADER_INPUT_TYPE; |
||
257 | |||
258 | typedef enum _D3D10_SHADER_CBUFFER_FLAGS |
||
259 | { |
||
260 | D3D10_CBF_USERPACKED = 1, |
||
261 | |||
262 | // force 32-bit size enum |
||
263 | D3D10_CBF_FORCE_DWORD = 0x7fffffff |
||
264 | } D3D10_SHADER_CBUFFER_FLAGS, *LPD3D10_SHADER_CBUFFER_FLAGS; |
||
265 | |||
266 | typedef enum _D3D10_CBUFFER_TYPE |
||
267 | { |
||
268 | D3D10_CT_CBUFFER, |
||
269 | D3D10_CT_TBUFFER, |
||
270 | } D3D10_CBUFFER_TYPE, *LPD3D10_CBUFFER_TYPE; |
||
271 | |||
272 | typedef enum D3D10_NAME |
||
273 | { |
||
274 | D3D10_NAME_UNDEFINED = 0, |
||
275 | |||
276 | // Names meaningful to both HLSL and hardware |
||
277 | D3D10_NAME_POSITION = 1, |
||
278 | D3D10_NAME_CLIP_DISTANCE = 2, |
||
279 | D3D10_NAME_CULL_DISTANCE = 3, |
||
280 | D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = 4, |
||
281 | D3D10_NAME_VIEWPORT_ARRAY_INDEX = 5, |
||
282 | D3D10_NAME_VERTEX_ID = 6, |
||
283 | D3D10_NAME_PRIMITIVE_ID = 7, |
||
284 | D3D10_NAME_INSTANCE_ID = 8, |
||
285 | D3D10_NAME_IS_FRONT_FACE = 9, |
||
286 | D3D10_NAME_SAMPLE_INDEX = 10, |
||
287 | D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, |
||
288 | D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, |
||
289 | D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, |
||
290 | D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, |
||
291 | D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, |
||
292 | D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, |
||
293 | |||
294 | // Names meaningful to HLSL only |
||
295 | D3D10_NAME_TARGET = 64, |
||
296 | D3D10_NAME_DEPTH = 65, |
||
297 | D3D10_NAME_COVERAGE = 66, |
||
298 | D3D11_NAME_DEPTH_GREATER_EQUAL = 67, |
||
299 | D3D11_NAME_DEPTH_LESS_EQUAL = 68, |
||
300 | |||
301 | } D3D10_NAME; |
||
302 | |||
303 | typedef enum D3D10_RESOURCE_RETURN_TYPE |
||
304 | { |
||
305 | D3D10_RETURN_TYPE_UNORM = 1, |
||
306 | D3D10_RETURN_TYPE_SNORM = 2, |
||
307 | D3D10_RETURN_TYPE_SINT = 3, |
||
308 | D3D10_RETURN_TYPE_UINT = 4, |
||
309 | D3D10_RETURN_TYPE_FLOAT = 5, |
||
310 | D3D10_RETURN_TYPE_MIXED = 6, |
||
311 | } D3D10_RESOURCE_RETURN_TYPE; |
||
312 | |||
313 | typedef enum D3D10_REGISTER_COMPONENT_TYPE |
||
314 | { |
||
315 | D3D10_REGISTER_COMPONENT_UNKNOWN = 0, |
||
316 | D3D10_REGISTER_COMPONENT_UINT32 = 1, |
||
317 | D3D10_REGISTER_COMPONENT_SINT32 = 2, |
||
318 | D3D10_REGISTER_COMPONENT_FLOAT32 = 3 |
||
319 | } D3D10_REGISTER_COMPONENT_TYPE; |
||
320 | |||
321 | |||
322 | //---------------------------------------------------------------------------- |
||
323 | // D3D10_INCLUDE_TYPE: |
||
324 | //---------------------------------------------------------------------------- |
||
325 | |||
326 | typedef enum _D3D10_INCLUDE_TYPE |
||
327 | { |
||
328 | D3D10_INCLUDE_LOCAL, |
||
329 | D3D10_INCLUDE_SYSTEM, |
||
330 | |||
331 | // force 32-bit size enum |
||
332 | D3D10_INCLUDE_FORCE_DWORD = 0x7fffffff |
||
333 | |||
334 | } D3D10_INCLUDE_TYPE, *LPD3D10_INCLUDE_TYPE; |
||
335 | |||
336 | |||
337 | //---------------------------------------------------------------------------- |
||
338 | // ID3D10Include: |
||
339 | // ------------- |
||
340 | // This interface is intended to be implemented by the application, and can |
||
341 | // be used by various D3D10 APIs. This enables application-specific handling |
||
342 | // of #include directives in source files. |
||
343 | // |
||
344 | // Open() |
||
345 | // Opens an include file. If successful, it should fill in ppData and |
||
346 | // pBytes. The data pointer returned must remain valid until Close is |
||
347 | // subsequently called. The name of the file is encoded in UTF-8 format. |
||
348 | // Close() |
||
349 | // Closes an include file. If Open was successful, Close is guaranteed |
||
350 | // to be called before the API using this interface returns. |
||
351 | //---------------------------------------------------------------------------- |
||
352 | |||
353 | typedef interface ID3D10Include ID3D10Include; |
||
354 | typedef interface ID3D10Include *LPD3D10INCLUDE; |
||
355 | |||
356 | #undef INTERFACE |
||
357 | #define INTERFACE ID3D10Include |
||
358 | |||
359 | DECLARE_INTERFACE(ID3D10Include) |
||
360 | { |
||
361 | STDMETHOD(Open)(THIS_ D3D10_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; |
||
362 | STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; |
||
363 | }; |
||
364 | |||
365 | |||
366 | //---------------------------------------------------------------------------- |
||
367 | // ID3D10ShaderReflection: |
||
368 | //---------------------------------------------------------------------------- |
||
369 | |||
370 | // |
||
371 | // Structure definitions |
||
372 | // |
||
373 | |||
374 | typedef struct _D3D10_SHADER_DESC |
||
375 | { |
||
376 | UINT Version; // Shader version |
||
377 | LPCSTR Creator; // Creator string |
||
378 | UINT Flags; // Shader compilation/parse flags |
||
379 | |||
380 | UINT ConstantBuffers; // Number of constant buffers |
||
381 | UINT BoundResources; // Number of bound resources |
||
382 | UINT InputParameters; // Number of parameters in the input signature |
||
383 | UINT OutputParameters; // Number of parameters in the output signature |
||
384 | |||
385 | UINT InstructionCount; // Number of emitted instructions |
||
386 | UINT TempRegisterCount; // Number of temporary registers used |
||
387 | UINT TempArrayCount; // Number of temporary arrays used |
||
388 | UINT DefCount; // Number of constant defines |
||
389 | UINT DclCount; // Number of declarations (input + output) |
||
390 | UINT TextureNormalInstructions; // Number of non-categorized texture instructions |
||
391 | UINT TextureLoadInstructions; // Number of texture load instructions |
||
392 | UINT TextureCompInstructions; // Number of texture comparison instructions |
||
393 | UINT TextureBiasInstructions; // Number of texture bias instructions |
||
394 | UINT TextureGradientInstructions; // Number of texture gradient instructions |
||
395 | UINT FloatInstructionCount; // Number of floating point arithmetic instructions used |
||
396 | UINT IntInstructionCount; // Number of signed integer arithmetic instructions used |
||
397 | UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used |
||
398 | UINT StaticFlowControlCount; // Number of static flow control instructions used |
||
399 | UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used |
||
400 | UINT MacroInstructionCount; // Number of macro instructions used |
||
401 | UINT ArrayInstructionCount; // Number of array instructions used |
||
402 | UINT CutInstructionCount; // Number of cut instructions used |
||
403 | UINT EmitInstructionCount; // Number of emit instructions used |
||
404 | D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology |
||
405 | UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count |
||
406 | } D3D10_SHADER_DESC; |
||
407 | |||
408 | typedef struct _D3D10_SHADER_BUFFER_DESC |
||
409 | { |
||
410 | LPCSTR Name; // Name of the constant buffer |
||
411 | D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer |
||
412 | UINT Variables; // Number of member variables |
||
413 | UINT Size; // Size of CB (in bytes) |
||
414 | UINT uFlags; // Buffer description flags |
||
415 | } D3D10_SHADER_BUFFER_DESC; |
||
416 | |||
417 | typedef struct _D3D10_SHADER_VARIABLE_DESC |
||
418 | { |
||
419 | LPCSTR Name; // Name of the variable |
||
420 | UINT StartOffset; // Offset in constant buffer's backing store |
||
421 | UINT Size; // Size of variable (in bytes) |
||
422 | UINT uFlags; // Variable flags |
||
423 | LPVOID DefaultValue; // Raw pointer to default value |
||
424 | } D3D10_SHADER_VARIABLE_DESC; |
||
425 | |||
426 | typedef struct _D3D10_SHADER_TYPE_DESC |
||
427 | { |
||
428 | D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) |
||
429 | D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) |
||
430 | UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) |
||
431 | UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) |
||
432 | UINT Elements; // Number of elements (0 if not an array) |
||
433 | UINT Members; // Number of members (0 if not a structure) |
||
434 | UINT Offset; // Offset from the start of structure (0 if not a structure member) |
||
435 | } D3D10_SHADER_TYPE_DESC; |
||
436 | |||
437 | typedef struct _D3D10_SHADER_INPUT_BIND_DESC |
||
438 | { |
||
439 | LPCSTR Name; // Name of the resource |
||
440 | D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) |
||
441 | UINT BindPoint; // Starting bind point |
||
442 | UINT BindCount; // Number of contiguous bind points (for arrays) |
||
443 | |||
444 | UINT uFlags; // Input binding flags |
||
445 | D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) |
||
446 | D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) |
||
447 | UINT NumSamples; // Number of samples (0 if not MS texture) |
||
448 | } D3D10_SHADER_INPUT_BIND_DESC; |
||
449 | |||
450 | typedef struct _D3D10_SIGNATURE_PARAMETER_DESC |
||
451 | { |
||
452 | LPCSTR SemanticName; // Name of the semantic |
||
453 | UINT SemanticIndex; // Index of the semantic |
||
454 | UINT Register; // Number of member variables |
||
455 | D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable |
||
456 | D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) |
||
457 | BYTE Mask; // Mask to indicate which components of the register |
||
458 | // are used (combination of D3D10_COMPONENT_MASK values) |
||
459 | BYTE ReadWriteMask; // Mask to indicate whether a given component is |
||
460 | // never written (if this is an output signature) or |
||
461 | // always read (if this is an input signature). |
||
462 | // (combination of D3D10_COMPONENT_MASK values) |
||
463 | |||
464 | } D3D10_SIGNATURE_PARAMETER_DESC; |
||
465 | |||
466 | |||
467 | // |
||
468 | // Interface definitions |
||
469 | // |
||
470 | |||
471 | typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; |
||
472 | typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; |
||
473 | |||
474 | // {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} |
||
475 | DEFINE_GUID(IID_ID3D10ShaderReflectionType, |
||
476 | 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); |
||
477 | |||
478 | #undef INTERFACE |
||
479 | #define INTERFACE ID3D10ShaderReflectionType |
||
480 | |||
481 | DECLARE_INTERFACE(ID3D10ShaderReflectionType) |
||
482 | { |
||
483 | STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; |
||
484 | |||
485 | STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; |
||
486 | STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; |
||
487 | STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; |
||
488 | }; |
||
489 | |||
490 | typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; |
||
491 | typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; |
||
492 | |||
493 | // {1BF63C95-2650-405d-99C1-3636BD1DA0A1} |
||
494 | DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, |
||
495 | 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); |
||
496 | |||
497 | #undef INTERFACE |
||
498 | #define INTERFACE ID3D10ShaderReflectionVariable |
||
499 | |||
500 | DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) |
||
501 | { |
||
502 | STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; |
||
503 | |||
504 | STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; |
||
505 | }; |
||
506 | |||
507 | typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; |
||
508 | typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; |
||
509 | |||
510 | // {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} |
||
511 | DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, |
||
512 | 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); |
||
513 | |||
514 | #undef INTERFACE |
||
515 | #define INTERFACE ID3D10ShaderReflectionConstantBuffer |
||
516 | |||
517 | DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) |
||
518 | { |
||
519 | STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; |
||
520 | |||
521 | STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; |
||
522 | STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; |
||
523 | }; |
||
524 | |||
525 | typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; |
||
526 | typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; |
||
527 | |||
528 | // {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} |
||
529 | DEFINE_GUID(IID_ID3D10ShaderReflection, |
||
530 | 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); |
||
531 | |||
532 | #undef INTERFACE |
||
533 | #define INTERFACE ID3D10ShaderReflection |
||
534 | |||
535 | DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) |
||
536 | { |
||
537 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; |
||
538 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
||
539 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
||
540 | |||
541 | STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; |
||
542 | |||
543 | STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; |
||
544 | STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; |
||
545 | |||
546 | STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; |
||
547 | |||
548 | STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; |
||
549 | STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; |
||
550 | |||
551 | }; |
||
552 | |||
553 | ////////////////////////////////////////////////////////////////////////////// |
||
554 | // APIs ////////////////////////////////////////////////////////////////////// |
||
555 | ////////////////////////////////////////////////////////////////////////////// |
||
556 | |||
557 | #ifdef __cplusplus |
||
558 | extern "C" { |
||
559 | #endif //__cplusplus |
||
560 | |||
561 | |||
562 | //---------------------------------------------------------------------------- |
||
563 | // D3D10CompileShader: |
||
564 | // ------------------ |
||
565 | // Compiles a shader. |
||
566 | // |
||
567 | // Parameters: |
||
568 | // pSrcFile |
||
569 | // Source file name. |
||
570 | // hSrcModule |
||
571 | // Module handle. if NULL, current module will be used. |
||
572 | // pSrcResource |
||
573 | // Resource name in module. |
||
574 | // pSrcData |
||
575 | // Pointer to source code. |
||
576 | // SrcDataLen |
||
577 | // Size of source code, in bytes. |
||
578 | // pDefines |
||
579 | // Optional NULL-terminated array of preprocessor macro definitions. |
||
580 | // pInclude |
||
581 | // Optional interface pointer to use for handling #include directives. |
||
582 | // If this parameter is NULL, #includes will be honored when compiling |
||
583 | // from file, and will error when compiling from resource or memory. |
||
584 | // pFunctionName |
||
585 | // Name of the entrypoint function where execution should begin. |
||
586 | // pProfile |
||
587 | // Instruction set to be used when generating code. The D3D10 entry |
||
588 | // point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". |
||
589 | // Flags |
||
590 | // See D3D10_SHADER_xxx flags. |
||
591 | // ppShader |
||
592 | // Returns a buffer containing the created shader. This buffer contains |
||
593 | // the compiled shader code, as well as any embedded debug and symbol |
||
594 | // table info. (See D3D10GetShaderConstantTable) |
||
595 | // ppErrorMsgs |
||
596 | // Returns a buffer containing a listing of errors and warnings that were |
||
597 | // encountered during the compile. If you are running in a debugger, |
||
598 | // these are the same messages you will see in your debug output. |
||
599 | //---------------------------------------------------------------------------- |
||
600 | |||
601 | HRESULT WINAPI D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, |
||
602 | LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs); |
||
603 | |||
604 | //---------------------------------------------------------------------------- |
||
605 | // D3D10DisassembleShader: |
||
606 | // ---------------------- |
||
607 | // Takes a binary shader, and returns a buffer containing text assembly. |
||
608 | // |
||
609 | // Parameters: |
||
610 | // pShader |
||
611 | // Pointer to the shader byte code. |
||
612 | // BytecodeLength |
||
613 | // Size of the shader byte code in bytes. |
||
614 | // EnableColorCode |
||
615 | // Emit HTML tags for color coding the output? |
||
616 | // pComments |
||
617 | // Pointer to a comment string to include at the top of the shader. |
||
618 | // ppDisassembly |
||
619 | // Returns a buffer containing the disassembled shader. |
||
620 | //---------------------------------------------------------------------------- |
||
621 | |||
622 | HRESULT WINAPI D3D10DisassembleShader(CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly); |
||
623 | |||
624 | |||
625 | //---------------------------------------------------------------------------- |
||
626 | // D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: |
||
627 | // ----------------------------------------------------- |
||
628 | // Returns the name of the HLSL profile best suited to a given device. |
||
629 | // |
||
630 | // Parameters: |
||
631 | // pDevice |
||
632 | // Pointer to the device in question |
||
633 | //---------------------------------------------------------------------------- |
||
634 | |||
635 | LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *pDevice); |
||
636 | |||
637 | LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *pDevice); |
||
638 | |||
639 | LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *pDevice); |
||
640 | |||
641 | //---------------------------------------------------------------------------- |
||
642 | // D3D10ReflectShader: |
||
643 | // ------------------ |
||
644 | // Creates a shader reflection object that can be used to retrieve information |
||
645 | // about a compiled shader |
||
646 | // |
||
647 | // Parameters: |
||
648 | // pShaderBytecode |
||
649 | // Pointer to a compiled shader (same pointer that is passed into |
||
650 | // ID3D10Device::CreateShader) |
||
651 | // BytecodeLength |
||
652 | // Length of the shader bytecode buffer |
||
653 | // ppReflector |
||
654 | // [out] Returns a ID3D10ShaderReflection object that can be used to |
||
655 | // retrieve shader resource and constant buffer information |
||
656 | // |
||
657 | //---------------------------------------------------------------------------- |
||
658 | |||
659 | HRESULT WINAPI D3D10ReflectShader(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector); |
||
660 | |||
661 | //---------------------------------------------------------------------------- |
||
662 | // D3D10PreprocessShader |
||
663 | // --------------------- |
||
664 | // Creates a shader reflection object that can be used to retrieve information |
||
665 | // about a compiled shader |
||
666 | // |
||
667 | // Parameters: |
||
668 | // pSrcData |
||
669 | // Pointer to source code |
||
670 | // SrcDataLen |
||
671 | // Size of source code, in bytes |
||
672 | // pFileName |
||
673 | // Source file name (used for error output) |
||
674 | // pDefines |
||
675 | // Optional NULL-terminated array of preprocessor macro definitions. |
||
676 | // pInclude |
||
677 | // Optional interface pointer to use for handling #include directives. |
||
678 | // If this parameter is NULL, #includes will be honored when assembling |
||
679 | // from file, and will error when assembling from resource or memory. |
||
680 | // ppShaderText |
||
681 | // Returns a buffer containing a single large string that represents |
||
682 | // the resulting formatted token stream |
||
683 | // ppErrorMsgs |
||
684 | // Returns a buffer containing a listing of errors and warnings that were |
||
685 | // encountered during assembly. If you are running in a debugger, |
||
686 | // these are the same messages you will see in your debug output. |
||
687 | //---------------------------------------------------------------------------- |
||
688 | |||
689 | HRESULT WINAPI D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, |
||
690 | LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs); |
||
691 | |||
692 | ////////////////////////////////////////////////////////////////////////// |
||
693 | // |
||
694 | // Shader blob manipulation routines |
||
695 | // --------------------------------- |
||
696 | // |
||
697 | // void *pShaderBytecode - a buffer containing the result of an HLSL |
||
698 | // compilation. Typically this opaque buffer contains several |
||
699 | // discrete sections including the shader executable code, the input |
||
700 | // signature, and the output signature. This can typically be retrieved |
||
701 | // by calling ID3D10Blob::GetBufferPointer() on the returned blob |
||
702 | // from HLSL's compile APIs. |
||
703 | // |
||
704 | // UINT BytecodeLength - the length of pShaderBytecode. This can |
||
705 | // typically be retrieved by calling ID3D10Blob::GetBufferSize() |
||
706 | // on the returned blob from HLSL's compile APIs. |
||
707 | // |
||
708 | // ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that |
||
709 | // contains only the signature portions of the original bytecode. |
||
710 | // This is a copy; the original bytecode is not modified. You may |
||
711 | // specify NULL for this parameter to have the bytecode validated |
||
712 | // for the presence of the corresponding signatures without actually |
||
713 | // copying them and creating a new blob. |
||
714 | // |
||
715 | // Returns E_INVALIDARG if any required parameters are NULL |
||
716 | // Returns E_FAIL is the bytecode is corrupt or missing signatures |
||
717 | // Returns S_OK on success |
||
718 | // |
||
719 | ////////////////////////////////////////////////////////////////////////// |
||
720 | |||
721 | HRESULT WINAPI D3D10GetInputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); |
||
722 | HRESULT WINAPI D3D10GetOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); |
||
723 | HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); |
||
724 | |||
725 | //---------------------------------------------------------------------------- |
||
726 | // D3D10GetShaderDebugInfo: |
||
727 | // ----------------------- |
||
728 | // Gets shader debug info. Debug info is generated by D3D10CompileShader and is |
||
729 | // embedded in the body of the shader. |
||
730 | // |
||
731 | // Parameters: |
||
732 | // pShaderBytecode |
||
733 | // Pointer to the function bytecode |
||
734 | // BytecodeLength |
||
735 | // Length of the shader bytecode buffer |
||
736 | // ppDebugInfo |
||
737 | // Buffer used to return debug info. For information about the layout |
||
738 | // of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. |
||
739 | //---------------------------------------------------------------------------- |
||
740 | |||
741 | HRESULT WINAPI D3D10GetShaderDebugInfo(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo); |
||
742 | |||
743 | #ifdef __cplusplus |
||
744 | } |
||
745 | #endif //__cplusplus |
||
746 | |||
747 | #endif //__D3D10SHADER_H__ |
||
748 |