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 | |
14 | #include "d3d10.h" |
15 | |
16 | |
17 | |
18 | |
19 | //--------------------------------------------------------------------------- |
20 | // D3D10_TX_VERSION: |
21 | // -------------- |
22 | // Version token used to create a procedural texture filler in effects |
23 | // Used by D3D10Fill[]TX functions |
24 | //--------------------------------------------------------------------------- |
25 | #define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) |
26 | |
27 | |
28 | //---------------------------------------------------------------------------- |
29 | // D3D10SHADER flags: |
30 | // ----------------- |
31 | // D3D10_SHADER_DEBUG |
32 | // Insert debug file/line/type/symbol information. |
33 | // |
34 | // D3D10_SHADER_SKIP_VALIDATION |
35 | // Do not validate the generated code against known capabilities and |
36 | // constraints. This option is only recommended when compiling shaders |
37 | // you KNOW will work. (ie. have compiled before without this option.) |
38 | // Shaders are always validated by D3D before they are set to the device. |
39 | // |
40 | // D3D10_SHADER_SKIP_OPTIMIZATION |
41 | // Instructs the compiler to skip optimization steps during code generation. |
42 | // Unless you are trying to isolate a problem in your code using this option |
43 | // is not recommended. |
44 | // |
45 | // D3D10_SHADER_PACK_MATRIX_ROW_MAJOR |
46 | // Unless explicitly specified, matrices will be packed in row-major order |
47 | // on input and output from the shader. |
48 | // |
49 | // D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR |
50 | // Unless explicitly specified, matrices will be packed in column-major |
51 | // order on input and output from the shader. This is generally more |
52 | // efficient, since it allows vector-matrix multiplication to be performed |
53 | // using a series of dot-products. |
54 | // |
55 | // D3D10_SHADER_PARTIAL_PRECISION |
56 | // Force all computations in resulting shader to occur at partial precision. |
57 | // This may result in faster evaluation of shaders on some hardware. |
58 | // |
59 | // D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT |
60 | // Force compiler to compile against the next highest available software |
61 | // target for vertex shaders. This flag also turns optimizations off, |
62 | // and debugging on. |
63 | // |
64 | // D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT |
65 | // Force compiler to compile against the next highest available software |
66 | // target for pixel shaders. This flag also turns optimizations off, |
67 | // and debugging on. |
68 | // |
69 | // D3D10_SHADER_NO_PRESHADER |
70 | // Disables Preshaders. Using this flag will cause the compiler to not |
71 | // pull out static expression for evaluation on the host cpu |
72 | // |
73 | // D3D10_SHADER_AVOID_FLOW_CONTROL |
74 | // Hint compiler to avoid flow-control constructs where possible. |
75 | // |
76 | // D3D10_SHADER_PREFER_FLOW_CONTROL |
77 | // Hint compiler to prefer flow-control constructs where possible. |
78 | // |
79 | // D3D10_SHADER_ENABLE_STRICTNESS |
80 | // By default, the HLSL/Effect compilers are not strict on deprecated syntax. |
81 | // Specifying this flag enables the strict mode. Deprecated syntax may be |
82 | // removed in a future release, and enabling syntax is a good way to make sure |
83 | // your shaders comply to the latest spec. |
84 | // |
85 | // D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY |
86 | // This enables older shaders to compile to 4_0 targets. |
87 | // |
88 | //---------------------------------------------------------------------------- |
89 | |
90 | #define D3D10_SHADER_DEBUG (1 << 0) |
91 | #define D3D10_SHADER_SKIP_VALIDATION (1 << 1) |
92 | #define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) |
93 | #define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) |
94 | #define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) |
95 | #define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) |
96 | #define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) |
97 | #define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) |
98 | #define D3D10_SHADER_NO_PRESHADER (1 << 8) |
99 | #define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) |
100 | #define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) |
101 | #define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) |
102 | #define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) |
103 | #define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) |
104 | #define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18) |
105 | #define D3D10_SHADER_RESOURCES_MAY_ALIAS (1 << 19) |
106 | #define D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20) |
107 | #define D3D10_ALL_RESOURCES_BOUND (1 << 21) |
108 | #define D3D10_SHADER_DEBUG_NAME_FOR_SOURCE (1 << 22) |
109 | #define D3D10_SHADER_DEBUG_NAME_FOR_BINARY (1 << 23) |
110 | |
111 | |
112 | // optimization level flags |
113 | #define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) |
114 | #define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 |
115 | #define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) |
116 | #define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) |
117 | |
118 | |
119 | // Force root signature flags. (Passed in Flags2) |
120 | #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0 |
121 | #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 (1 << 4) |
122 | #define D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 (1 << 5) |
123 | |
124 | |
125 | |
126 | |
127 | typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; |
128 | typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO; |
129 | |
130 | |
131 | typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; |
132 | typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS; |
133 | |
134 | typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS; |
135 | typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS; |
136 | |
137 | typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; |
138 | typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE; |
139 | |
140 | typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS; |
141 | typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS; |
142 | |
143 | typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; |
144 | typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE; |
145 | |
146 | typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS; |
147 | typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS; |
148 | |
149 | typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; |
150 | typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE; |
151 | |
152 | typedef D3D_NAME D3D10_NAME; |
153 | |
154 | typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; |
155 | |
156 | typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; |
157 | |
158 | typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; |
159 | |
160 | // ID3D10Include has been made version-neutral and moved to d3dcommon.h. |
161 | typedef interface ID3DInclude ID3D10Include; |
162 | typedef interface ID3DInclude* LPD3D10INCLUDE; |
163 | #define IID_ID3D10Include IID_ID3DInclude |
164 | |
165 | |
166 | //---------------------------------------------------------------------------- |
167 | // ID3D10ShaderReflection: |
168 | //---------------------------------------------------------------------------- |
169 | |
170 | // |
171 | // Structure definitions |
172 | // |
173 | |
174 | typedef struct _D3D10_SHADER_DESC |
175 | { |
176 | UINT Version; // Shader version |
177 | LPCSTR Creator; // Creator string |
178 | UINT Flags; // Shader compilation/parse flags |
179 | |
180 | UINT ConstantBuffers; // Number of constant buffers |
181 | UINT BoundResources; // Number of bound resources |
182 | UINT InputParameters; // Number of parameters in the input signature |
183 | UINT OutputParameters; // Number of parameters in the output signature |
184 | |
185 | UINT InstructionCount; // Number of emitted instructions |
186 | UINT TempRegisterCount; // Number of temporary registers used |
187 | UINT TempArrayCount; // Number of temporary arrays used |
188 | UINT DefCount; // Number of constant defines |
189 | UINT DclCount; // Number of declarations (input + output) |
190 | UINT TextureNormalInstructions; // Number of non-categorized texture instructions |
191 | UINT TextureLoadInstructions; // Number of texture load instructions |
192 | UINT TextureCompInstructions; // Number of texture comparison instructions |
193 | UINT TextureBiasInstructions; // Number of texture bias instructions |
194 | UINT TextureGradientInstructions; // Number of texture gradient instructions |
195 | UINT FloatInstructionCount; // Number of floating point arithmetic instructions used |
196 | UINT IntInstructionCount; // Number of signed integer arithmetic instructions used |
197 | UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used |
198 | UINT StaticFlowControlCount; // Number of static flow control instructions used |
199 | UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used |
200 | UINT MacroInstructionCount; // Number of macro instructions used |
201 | UINT ArrayInstructionCount; // Number of array instructions used |
202 | UINT CutInstructionCount; // Number of cut instructions used |
203 | UINT EmitInstructionCount; // Number of emit instructions used |
204 | D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology |
205 | UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count |
206 | } D3D10_SHADER_DESC; |
207 | |
208 | typedef struct _D3D10_SHADER_BUFFER_DESC |
209 | { |
210 | LPCSTR Name; // Name of the constant buffer |
211 | D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer |
212 | UINT Variables; // Number of member variables |
213 | UINT Size; // Size of CB (in bytes) |
214 | UINT uFlags; // Buffer description flags |
215 | } D3D10_SHADER_BUFFER_DESC; |
216 | |
217 | typedef struct _D3D10_SHADER_VARIABLE_DESC |
218 | { |
219 | LPCSTR Name; // Name of the variable |
220 | UINT StartOffset; // Offset in constant buffer's backing store |
221 | UINT Size; // Size of variable (in bytes) |
222 | UINT uFlags; // Variable flags |
223 | LPVOID DefaultValue; // Raw pointer to default value |
224 | } D3D10_SHADER_VARIABLE_DESC; |
225 | |
226 | typedef struct _D3D10_SHADER_TYPE_DESC |
227 | { |
228 | D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) |
229 | D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) |
230 | UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) |
231 | UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) |
232 | UINT Elements; // Number of elements (0 if not an array) |
233 | UINT Members; // Number of members (0 if not a structure) |
234 | UINT Offset; // Offset from the start of structure (0 if not a structure member) |
235 | } D3D10_SHADER_TYPE_DESC; |
236 | |
237 | typedef struct _D3D10_SHADER_INPUT_BIND_DESC |
238 | { |
239 | LPCSTR Name; // Name of the resource |
240 | D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) |
241 | UINT BindPoint; // Starting bind point |
242 | UINT BindCount; // Number of contiguous bind points (for arrays) |
243 | |
244 | UINT uFlags; // Input binding flags |
245 | D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) |
246 | D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) |
247 | UINT NumSamples; // Number of samples (0 if not MS texture) |
248 | } D3D10_SHADER_INPUT_BIND_DESC; |
249 | |
250 | typedef struct _D3D10_SIGNATURE_PARAMETER_DESC |
251 | { |
252 | LPCSTR SemanticName; // Name of the semantic |
253 | UINT SemanticIndex; // Index of the semantic |
254 | UINT Register; // Number of member variables |
255 | D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable |
256 | D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) |
257 | BYTE Mask; // Mask to indicate which components of the register |
258 | // are used (combination of D3D10_COMPONENT_MASK values) |
259 | BYTE ReadWriteMask; // Mask to indicate whether a given component is |
260 | // never written (if this is an output signature) or |
261 | // always read (if this is an input signature). |
262 | // (combination of D3D10_COMPONENT_MASK values) |
263 | |
264 | } D3D10_SIGNATURE_PARAMETER_DESC; |
265 | |
266 | |
267 | // |
268 | // Interface definitions |
269 | // |
270 | |
271 | |
272 | |
273 | |
274 | typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; |
275 | typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; |
276 | |
277 | // {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} |
278 | interface DECLSPEC_UUID("C530AD7D-9B16-4395-A979-BA2ECFF83ADD") ID3D10ShaderReflectionType; |
279 | DEFINE_GUID(IID_ID3D10ShaderReflectionType, |
280 | 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); |
281 | |
282 | #undef INTERFACE |
283 | #define INTERFACE ID3D10ShaderReflectionType |
284 | |
285 | DECLARE_INTERFACE(ID3D10ShaderReflectionType) |
286 | { |
287 | STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; |
288 | |
289 | STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; |
290 | STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; |
291 | STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; |
292 | }; |
293 | |
294 | typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; |
295 | typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; |
296 | |
297 | // {1BF63C95-2650-405d-99C1-3636BD1DA0A1} |
298 | interface DECLSPEC_UUID("1BF63C95-2650-405d-99C1-3636BD1DA0A1") ID3D10ShaderReflectionVariable; |
299 | DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, |
300 | 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); |
301 | |
302 | #undef INTERFACE |
303 | #define INTERFACE ID3D10ShaderReflectionVariable |
304 | |
305 | DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) |
306 | { |
307 | STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; |
308 | |
309 | STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; |
310 | }; |
311 | |
312 | typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; |
313 | typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; |
314 | |
315 | // {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} |
316 | interface DECLSPEC_UUID("66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0") ID3D10ShaderReflectionConstantBuffer; |
317 | DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, |
318 | 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); |
319 | |
320 | #undef INTERFACE |
321 | #define INTERFACE ID3D10ShaderReflectionConstantBuffer |
322 | |
323 | DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) |
324 | { |
325 | STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; |
326 | |
327 | STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; |
328 | STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; |
329 | }; |
330 | |
331 | typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; |
332 | typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; |
333 | |
334 | // {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} |
335 | interface DECLSPEC_UUID("D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA") ID3D10ShaderReflection; |
336 | DEFINE_GUID(IID_ID3D10ShaderReflection, |
337 | 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); |
338 | |
339 | #undef INTERFACE |
340 | #define INTERFACE ID3D10ShaderReflection |
341 | |
342 | DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) |
343 | { |
344 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; |
345 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
346 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
347 | |
348 | STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE; |
349 | |
350 | STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; |
351 | STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; |
352 | |
353 | STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; |
354 | |
355 | STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; |
356 | STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; |
357 | |
358 | }; |
359 | |
360 | ////////////////////////////////////////////////////////////////////////////// |
361 | // APIs ////////////////////////////////////////////////////////////////////// |
362 | ////////////////////////////////////////////////////////////////////////////// |
363 | |
364 | #ifdef __cplusplus |
365 | extern "C"{ |
366 | #endif //__cplusplus |
367 | |
368 | //---------------------------------------------------------------------------- |
369 | // D3D10CompileShader: |
370 | // ------------------ |
371 | // Compiles a shader. |
372 | // |
373 | // Parameters: |
374 | // pSrcFile |
375 | // Source file name. |
376 | // hSrcModule |
377 | // Module handle. if NULL, current module will be used. |
378 | // pSrcResource |
379 | // Resource name in module. |
380 | // pSrcData |
381 | // Pointer to source code. |
382 | // SrcDataSize |
383 | // Size of source code, in bytes. |
384 | // pDefines |
385 | // Optional NULL-terminated array of preprocessor macro definitions. |
386 | // pInclude |
387 | // Optional interface pointer to use for handling #include directives. |
388 | // If this parameter is NULL, #includes will be honored when compiling |
389 | // from file, and will error when compiling from resource or memory. |
390 | // pFunctionName |
391 | // Name of the entrypoint function where execution should begin. |
392 | // pProfile |
393 | // Instruction set to be used when generating code. The D3D10 entry |
394 | // point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". |
395 | // Flags |
396 | // See D3D10_SHADER_xxx flags. |
397 | // ppShader |
398 | // Returns a buffer containing the created shader. This buffer contains |
399 | // the compiled shader code, as well as any embedded debug and symbol |
400 | // table info. (See D3D10GetShaderConstantTable) |
401 | // ppErrorMsgs |
402 | // Returns a buffer containing a listing of errors and warnings that were |
403 | // encountered during the compile. If you are running in a debugger, |
404 | // these are the same messages you will see in your debug output. |
405 | //---------------------------------------------------------------------------- |
406 | |
407 | HRESULT WINAPI D3D10CompileShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines, _In_opt_ LPD3D10INCLUDE pInclude, |
408 | LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, _Out_ ID3D10Blob** ppShader, _Out_opt_ ID3D10Blob** ppErrorMsgs); |
409 | |
410 | //---------------------------------------------------------------------------- |
411 | // D3D10DisassembleShader: |
412 | // ---------------------- |
413 | // Takes a binary shader, and returns a buffer containing text assembly. |
414 | // |
415 | // Parameters: |
416 | // pShader |
417 | // Pointer to the shader byte code. |
418 | // BytecodeLength |
419 | // Size of the shader byte code in bytes. |
420 | // EnableColorCode |
421 | // Emit HTML tags for color coding the output? |
422 | // pComments |
423 | // Pointer to a comment string to include at the top of the shader. |
424 | // ppDisassembly |
425 | // Returns a buffer containing the disassembled shader. |
426 | //---------------------------------------------------------------------------- |
427 | |
428 | HRESULT WINAPI D3D10DisassembleShader(_In_reads_bytes_(BytecodeLength) CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, _In_opt_ LPCSTR pComments, _Out_ ID3D10Blob** ppDisassembly); |
429 | |
430 | |
431 | //---------------------------------------------------------------------------- |
432 | // D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: |
433 | // ----------------------------------------------------- |
434 | // Returns the name of the HLSL profile best suited to a given device. |
435 | // |
436 | // Parameters: |
437 | // pDevice |
438 | // Pointer to the device in question |
439 | //---------------------------------------------------------------------------- |
440 | |
441 | LPCSTR WINAPI D3D10GetPixelShaderProfile(_In_ ID3D10Device *pDevice); |
442 | |
443 | LPCSTR WINAPI D3D10GetVertexShaderProfile(_In_ ID3D10Device *pDevice); |
444 | |
445 | LPCSTR WINAPI D3D10GetGeometryShaderProfile(_In_ ID3D10Device *pDevice); |
446 | |
447 | //---------------------------------------------------------------------------- |
448 | // D3D10ReflectShader: |
449 | // ------------------ |
450 | // Creates a shader reflection object that can be used to retrieve information |
451 | // about a compiled shader |
452 | // |
453 | // Parameters: |
454 | // pShaderBytecode |
455 | // Pointer to a compiled shader (same pointer that is passed into |
456 | // ID3D10Device::CreateShader) |
457 | // BytecodeLength |
458 | // Length of the shader bytecode buffer |
459 | // ppReflector |
460 | // [out] Returns a ID3D10ShaderReflection object that can be used to |
461 | // retrieve shader resource and constant buffer information |
462 | // |
463 | //---------------------------------------------------------------------------- |
464 | |
465 | HRESULT WINAPI D3D10ReflectShader(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10ShaderReflection **ppReflector); |
466 | |
467 | //---------------------------------------------------------------------------- |
468 | // D3D10PreprocessShader |
469 | // --------------------- |
470 | // Creates a shader reflection object that can be used to retrieve information |
471 | // about a compiled shader |
472 | // |
473 | // Parameters: |
474 | // pSrcData |
475 | // Pointer to source code |
476 | // SrcDataSize |
477 | // Size of source code, in bytes |
478 | // pFileName |
479 | // Source file name (used for error output) |
480 | // pDefines |
481 | // Optional NULL-terminated array of preprocessor macro definitions. |
482 | // pInclude |
483 | // Optional interface pointer to use for handling #include directives. |
484 | // If this parameter is NULL, #includes will be honored when assembling |
485 | // from file, and will error when assembling from resource or memory. |
486 | // ppShaderText |
487 | // Returns a buffer containing a single large string that represents |
488 | // the resulting formatted token stream |
489 | // ppErrorMsgs |
490 | // Returns a buffer containing a listing of errors and warnings that were |
491 | // encountered during assembly. If you are running in a debugger, |
492 | // these are the same messages you will see in your debug output. |
493 | //---------------------------------------------------------------------------- |
494 | |
495 | HRESULT WINAPI D3D10PreprocessShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines, |
496 | _In_opt_ LPD3D10INCLUDE pInclude, _Out_ ID3D10Blob** ppShaderText, _Out_opt_ ID3D10Blob** ppErrorMsgs); |
497 | |
498 | ////////////////////////////////////////////////////////////////////////// |
499 | // |
500 | // Shader blob manipulation routines |
501 | // --------------------------------- |
502 | // |
503 | // void *pShaderBytecode - a buffer containing the result of an HLSL |
504 | // compilation. Typically this opaque buffer contains several |
505 | // discrete sections including the shader executable code, the input |
506 | // signature, and the output signature. This can typically be retrieved |
507 | // by calling ID3D10Blob::GetBufferPointer() on the returned blob |
508 | // from HLSL's compile APIs. |
509 | // |
510 | // UINT BytecodeLength - the length of pShaderBytecode. This can |
511 | // typically be retrieved by calling ID3D10Blob::GetBufferSize() |
512 | // on the returned blob from HLSL's compile APIs. |
513 | // |
514 | // ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that |
515 | // contains only the signature portions of the original bytecode. |
516 | // This is a copy; the original bytecode is not modified. You may |
517 | // specify NULL for this parameter to have the bytecode validated |
518 | // for the presence of the corresponding signatures without actually |
519 | // copying them and creating a new blob. |
520 | // |
521 | // Returns E_INVALIDARG if any required parameters are NULL |
522 | // Returns E_FAIL is the bytecode is corrupt or missing signatures |
523 | // Returns S_OK on success |
524 | // |
525 | ////////////////////////////////////////////////////////////////////////// |
526 | |
527 | HRESULT WINAPI D3D10GetInputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); |
528 | HRESULT WINAPI D3D10GetOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); |
529 | HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); |
530 | |
531 | //---------------------------------------------------------------------------- |
532 | // D3D10GetShaderDebugInfo: |
533 | // ----------------------- |
534 | // Gets shader debug info. Debug info is generated by D3D10CompileShader and is |
535 | // embedded in the body of the shader. |
536 | // |
537 | // Parameters: |
538 | // pShaderBytecode |
539 | // Pointer to the function bytecode |
540 | // BytecodeLength |
541 | // Length of the shader bytecode buffer |
542 | // ppDebugInfo |
543 | // Buffer used to return debug info. For information about the layout |
544 | // of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. |
545 | //---------------------------------------------------------------------------- |
546 | |
547 | HRESULT WINAPI D3D10GetShaderDebugInfo(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob** ppDebugInfo); |
548 | |
549 | #ifdef __cplusplus |
550 | } |
551 | #endif //__cplusplus |
552 | |
553 | |
554 | #endif //__D3D10SHADER_H__ |
555 | |
556 |
Definitions
- _D3D10_SHADER_DESC
- _D3D10_SHADER_BUFFER_DESC
- _D3D10_SHADER_VARIABLE_DESC
- _D3D10_SHADER_TYPE_DESC
- _D3D10_SHADER_INPUT_BIND_DESC
- _D3D10_SIGNATURE_PARAMETER_DESC
- DECLSPEC_UUID
- DEFINE_GUID
- ID3D10ShaderReflectionType
- DECLSPEC_UUID
- DEFINE_GUID
- ID3D10ShaderReflectionVariable
- DECLSPEC_UUID
- DEFINE_GUID
- ID3D10ShaderReflectionConstantBuffer
- DECLSPEC_UUID
- DEFINE_GUID
- DECLARE_INTERFACE_
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
- WINAPI
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more