1 //////////////////////////////////////////////////////////////////////////////
2 //
3 //  Copyright (c) Microsoft Corporation.  All rights reserved.
4 //
5 //  File:       D3DCompiler.h
6 //  Content:    D3D Compilation Types and APIs
7 //
8 //////////////////////////////////////////////////////////////////////////////
9 
10 #ifndef __D3DCOMPILER_H__
11 #define __D3DCOMPILER_H__
12 
13 /*#include <winapifamily.h>*/
14 
15 // Current name of the DLL shipped in the same SDK as this header.
16 
17 #define D3DCOMPILER_DLL_W L"d3dcompiler_47.dll"
18 #define D3DCOMPILER_DLL_A "d3dcompiler_47.dll"
19 
20 // Current HLSL compiler version.
21 
22 #define D3D_COMPILER_VERSION 47
23 
24 #ifdef UNICODE
25     #define D3DCOMPILER_DLL D3DCOMPILER_DLL_W
26 #else
27     #define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
28 #endif
29 
30 #include "d3d11shader.h"
31 #include "d3d12shader.h"
32 
33 //////////////////////////////////////////////////////////////////////////////
34 // APIs //////////////////////////////////////////////////////////////////////
35 //////////////////////////////////////////////////////////////////////////////
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif //__cplusplus
40 
41 /*#pragma region Application Family*/
42 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)*/
43 
44 //----------------------------------------------------------------------------
45 // D3DReadFileToBlob:
46 // -----------------
47 // Simple helper routine to read a file on disk into memory
48 // for passing to other routines in this API.
49 //----------------------------------------------------------------------------
50 
51 HRESULT WINAPI
52 D3DReadFileToBlob(_In_ LPCWSTR pFileName,
53                   _Out_ ID3DBlob** ppContents);
54 
55 //----------------------------------------------------------------------------
56 // D3DWriteBlobToFile:
57 // ------------------
58 // Simple helper routine to write a memory blob to a file on disk.
59 //----------------------------------------------------------------------------
60 
61 HRESULT WINAPI
62 D3DWriteBlobToFile(_In_ ID3DBlob* pBlob,
63                    _In_ LPCWSTR pFileName,
64                    _In_ BOOL bOverwrite);
65 
66 //----------------------------------------------------------------------------
67 // D3DCOMPILE flags:
68 // -----------------
69 // D3DCOMPILE_DEBUG
70 //   Insert debug file/line/type/symbol information.
71 //
72 // D3DCOMPILE_SKIP_VALIDATION
73 //   Do not validate the generated code against known capabilities and
74 //   constraints.  This option is only recommended when compiling shaders
75 //   you KNOW will work.  (ie. have compiled before without this option.)
76 //   Shaders are always validated by D3D before they are set to the device.
77 //
78 // D3DCOMPILE_SKIP_OPTIMIZATION
79 //   Instructs the compiler to skip optimization steps during code generation.
80 //   Unless you are trying to isolate a problem in your code using this option
81 //   is not recommended.
82 //
83 // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
84 //   Unless explicitly specified, matrices will be packed in row-major order
85 //   on input and output from the shader.
86 //
87 // D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR
88 //   Unless explicitly specified, matrices will be packed in column-major
89 //   order on input and output from the shader.  This is generally more
90 //   efficient, since it allows vector-matrix multiplication to be performed
91 //   using a series of dot-products.
92 //
93 // D3DCOMPILE_PARTIAL_PRECISION
94 //   Force all computations in resulting shader to occur at partial precision.
95 //   This may result in faster evaluation of shaders on some hardware.
96 //
97 // D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT
98 //   Force compiler to compile against the next highest available software
99 //   target for vertex shaders.  This flag also turns optimizations off,
100 //   and debugging on.
101 //
102 // D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT
103 //   Force compiler to compile against the next highest available software
104 //   target for pixel shaders.  This flag also turns optimizations off,
105 //   and debugging on.
106 //
107 // D3DCOMPILE_NO_PRESHADER
108 //   Disables Preshaders. Using this flag will cause the compiler to not
109 //   pull out static expression for evaluation on the host cpu
110 //
111 // D3DCOMPILE_AVOID_FLOW_CONTROL
112 //   Hint compiler to avoid flow-control constructs where possible.
113 //
114 // D3DCOMPILE_PREFER_FLOW_CONTROL
115 //   Hint compiler to prefer flow-control constructs where possible.
116 //
117 // D3DCOMPILE_ENABLE_STRICTNESS
118 //   By default, the HLSL/Effect compilers are not strict on deprecated syntax.
119 //   Specifying this flag enables the strict mode. Deprecated syntax may be
120 //   removed in a future release, and enabling syntax is a good way to make
121 //   sure your shaders comply to the latest spec.
122 //
123 // D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
124 //   This enables older shaders to compile to 4_0 targets.
125 //
126 // D3DCOMPILE_DEBUG_NAME_FOR_SOURCE
127 //   This enables a debug name to be generated based on source information.
128 //   It requires D3DCOMPILE_DEBUG to be set, and is exclusive with
129 //   D3DCOMPILE_DEBUG_NAME_FOR_BINARY.
130 //
131 // D3DCOMPILE_DEBUG_NAME_FOR_BINARY
132 //   This enables a debug name to be generated based on compiled information.
133 //   It requires D3DCOMPILE_DEBUG to be set, and is exclusive with
134 //   D3DCOMPILE_DEBUG_NAME_FOR_SOURCE.
135 //
136 //----------------------------------------------------------------------------
137 
138 #define D3DCOMPILE_DEBUG                                (1 << 0)
139 #define D3DCOMPILE_SKIP_VALIDATION                      (1 << 1)
140 #define D3DCOMPILE_SKIP_OPTIMIZATION                    (1 << 2)
141 #define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR                (1 << 3)
142 #define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR             (1 << 4)
143 #define D3DCOMPILE_PARTIAL_PRECISION                    (1 << 5)
144 #define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT             (1 << 6)
145 #define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT             (1 << 7)
146 #define D3DCOMPILE_NO_PRESHADER                         (1 << 8)
147 #define D3DCOMPILE_AVOID_FLOW_CONTROL                   (1 << 9)
148 #define D3DCOMPILE_PREFER_FLOW_CONTROL                  (1 << 10)
149 #define D3DCOMPILE_ENABLE_STRICTNESS                    (1 << 11)
150 #define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY       (1 << 12)
151 #define D3DCOMPILE_IEEE_STRICTNESS                      (1 << 13)
152 #define D3DCOMPILE_OPTIMIZATION_LEVEL0                  (1 << 14)
153 #define D3DCOMPILE_OPTIMIZATION_LEVEL1                  0
154 #define D3DCOMPILE_OPTIMIZATION_LEVEL2                  ((1 << 14) | (1 << 15))
155 #define D3DCOMPILE_OPTIMIZATION_LEVEL3                  (1 << 15)
156 #define D3DCOMPILE_RESERVED16                           (1 << 16)
157 #define D3DCOMPILE_RESERVED17                           (1 << 17)
158 #define D3DCOMPILE_WARNINGS_ARE_ERRORS                  (1 << 18)
159 #define D3DCOMPILE_RESOURCES_MAY_ALIAS                  (1 << 19)
160 #define D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES   (1 << 20)
161 #define D3DCOMPILE_ALL_RESOURCES_BOUND                  (1 << 21)
162 #define D3DCOMPILE_DEBUG_NAME_FOR_SOURCE                (1 << 22)
163 #define D3DCOMPILE_DEBUG_NAME_FOR_BINARY                (1 << 23)
164 
165 //----------------------------------------------------------------------------
166 // D3DCOMPILE_EFFECT flags:
167 // -------------------------------------
168 // These flags are passed in when creating an effect, and affect
169 // either compilation behavior or runtime effect behavior
170 //
171 // D3DCOMPILE_EFFECT_CHILD_EFFECT
172 //   Compile this .fx file to a child effect. Child effects have no
173 //   initializers for any shared values as these are initialied in the
174 //   master effect (pool).
175 //
176 // D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS
177 //   By default, performance mode is enabled.  Performance mode
178 //   disallows mutable state objects by preventing non-literal
179 //   expressions from appearing in state object definitions.
180 //   Specifying this flag will disable the mode and allow for mutable
181 //   state objects.
182 //
183 //----------------------------------------------------------------------------
184 
185 #define D3DCOMPILE_EFFECT_CHILD_EFFECT              (1 << 0)
186 #define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS            (1 << 1)
187 
188 //----------------------------------------------------------------------------
189 // D3DCOMPILE Flags2:
190 // -----------------
191 // Root signature flags. (passed in Flags2)
192 #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST		0
193 #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0			(1 << 4)
194 #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1			(1 << 5)
195 
196 //----------------------------------------------------------------------------
197 // D3DCompile:
198 // ----------
199 // Compile source text into bytecode appropriate for the given target.
200 //----------------------------------------------------------------------------
201 
202 // D3D_COMPILE_STANDARD_FILE_INCLUDE can be passed for pInclude in any
203 // API and indicates that a simple default include handler should be
204 // used.  The include handler will include files relative to the
205 // current directory and files relative to the directory of the initial source
206 // file.  When used with APIs like D3DCompile pSourceName must be a
207 // file name and the initial relative directory will be derived from it.
208 #define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)
209 
210 HRESULT WINAPI
211 D3DCompile(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
212            _In_ SIZE_T SrcDataSize,
213            _In_opt_ LPCSTR pSourceName,
214            _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
215            _In_opt_ ID3DInclude* pInclude,
216            _In_opt_ LPCSTR pEntrypoint,
217            _In_ LPCSTR pTarget,
218            _In_ UINT Flags1,
219            _In_ UINT Flags2,
220            _Out_ ID3DBlob** ppCode,
221            _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
222 
223 typedef HRESULT (WINAPI *pD3DCompile)
224     (LPCVOID                         pSrcData,
225      SIZE_T                          SrcDataSize,
226      LPCSTR                          pFileName,
227      CONST D3D_SHADER_MACRO*         pDefines,
228      ID3DInclude*                    pInclude,
229      LPCSTR                          pEntrypoint,
230      LPCSTR                          pTarget,
231      UINT                            Flags1,
232      UINT                            Flags2,
233      ID3DBlob**                      ppCode,
234      ID3DBlob**                      ppErrorMsgs);
235 
236 #define D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS              0x00000001
237 #define D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS      0x00000002
238 #define D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH       0x00000004
239 
240 HRESULT WINAPI
241 D3DCompile2(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
242             _In_ SIZE_T SrcDataSize,
243             _In_opt_ LPCSTR pSourceName,
244             _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
245             _In_opt_ ID3DInclude* pInclude,
246             _In_ LPCSTR pEntrypoint,
247             _In_ LPCSTR pTarget,
248             _In_ UINT Flags1,
249             _In_ UINT Flags2,
250             _In_ UINT SecondaryDataFlags,
251             _In_reads_bytes_opt_(SecondaryDataSize) LPCVOID pSecondaryData,
252             _In_ SIZE_T SecondaryDataSize,
253             _Out_ ID3DBlob** ppCode,
254             _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
255 
256 HRESULT WINAPI
257 D3DCompileFromFile(_In_ LPCWSTR pFileName,
258                    _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
259                    _In_opt_ ID3DInclude* pInclude,
260                    _In_ LPCSTR pEntrypoint,
261                    _In_ LPCSTR pTarget,
262                    _In_ UINT Flags1,
263                    _In_ UINT Flags2,
264                    _Out_ ID3DBlob** ppCode,
265                    _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
266 
267 //----------------------------------------------------------------------------
268 // D3DPreprocess:
269 // -------------
270 // Process source text with the compiler's preprocessor and return
271 // the resulting text.
272 //----------------------------------------------------------------------------
273 
274 HRESULT WINAPI
275 D3DPreprocess(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
276               _In_ SIZE_T SrcDataSize,
277               _In_opt_ LPCSTR pSourceName,
278               _In_opt_ CONST D3D_SHADER_MACRO* pDefines,
279               _In_opt_ ID3DInclude* pInclude,
280               _Out_ ID3DBlob** ppCodeText,
281               _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
282 
283 typedef HRESULT (WINAPI *pD3DPreprocess)
284     (LPCVOID                      pSrcData,
285      SIZE_T                       SrcDataSize,
286      LPCSTR                       pFileName,
287      CONST D3D_SHADER_MACRO*      pDefines,
288      ID3DInclude*                 pInclude,
289      ID3DBlob**                   ppCodeText,
290      ID3DBlob**                   ppErrorMsgs);
291 
292 //----------------------------------------------------------------------------
293 // D3DGetDebugInfo:
294 // -----------------------
295 // Gets shader debug info.  Debug info is generated by D3DCompile and is
296 // embedded in the body of the shader.
297 //----------------------------------------------------------------------------
298 
299 HRESULT WINAPI
300 D3DGetDebugInfo(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
301                 _In_ SIZE_T SrcDataSize,
302                 _Out_ ID3DBlob** ppDebugInfo);
303 
304 //----------------------------------------------------------------------------
305 // D3DReflect:
306 // ----------
307 // Shader code contains metadata that can be inspected via the
308 // reflection APIs.
309 //----------------------------------------------------------------------------
310 
311 HRESULT WINAPI
312 D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
313            _In_ SIZE_T SrcDataSize,
314            _In_ REFIID pInterface,
315            _Out_ void** ppReflector);
316 
317 //----------------------------------------------------------------------------
318 // D3DReflectLibrary:
319 // ----------
320 // Library code contains metadata that can be inspected via the library
321 // reflection APIs.
322 //----------------------------------------------------------------------------
323 
324 HRESULT WINAPI
325 D3DReflectLibrary(__in_bcount(SrcDataSize) LPCVOID pSrcData,
326                   __in SIZE_T SrcDataSize,
327 	              __in REFIID riid,
328                   __out LPVOID * ppReflector);
329 
330 //----------------------------------------------------------------------------
331 // D3DDisassemble:
332 // ----------------------
333 // Takes a binary shader and returns a buffer containing text assembly.
334 //----------------------------------------------------------------------------
335 
336 #define D3D_DISASM_ENABLE_COLOR_CODE            0x00000001
337 #define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS  0x00000002
338 #define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
339 #define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE     0x00000008
340 #define D3D_DISASM_DISABLE_DEBUG_INFO           0x00000010
341 #define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET    0x00000020
342 #define D3D_DISASM_INSTRUCTION_ONLY             0x00000040
343 #define D3D_DISASM_PRINT_HEX_LITERALS           0x00000080
344 
345 HRESULT WINAPI
346 D3DDisassemble(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
347                _In_ SIZE_T SrcDataSize,
348                _In_ UINT Flags,
349                _In_opt_ LPCSTR szComments,
350                _Out_ ID3DBlob** ppDisassembly);
351 
352 typedef HRESULT (WINAPI *pD3DDisassemble)
353     (_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
354      _In_ SIZE_T SrcDataSize,
355      _In_ UINT Flags,
356      _In_opt_ LPCSTR szComments,
357      _Out_ ID3DBlob** ppDisassembly);
358 
359 HRESULT WINAPI
360 D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
361                      _In_ SIZE_T SrcDataSize,
362                      _In_ UINT Flags,
363                      _In_opt_ LPCSTR szComments,
364                      _In_ SIZE_T StartByteOffset,
365                      _In_ SIZE_T NumInsts,
366                      _Out_opt_ SIZE_T* pFinishByteOffset,
367                      _Out_ ID3DBlob** ppDisassembly);
368 
369 //----------------------------------------------------------------------------
370 // Shader linking and Function Linking Graph (FLG) APIs
371 //----------------------------------------------------------------------------
372 HRESULT WINAPI
373 D3DCreateLinker(__out interface ID3D11Linker ** ppLinker);
374 
375 HRESULT WINAPI
376 D3DLoadModule(_In_ LPCVOID pSrcData,
377               _In_ SIZE_T cbSrcDataSize,
378               _Out_ interface ID3D11Module ** ppModule);
379 
380 HRESULT WINAPI
381 D3DCreateFunctionLinkingGraph(_In_ UINT uFlags,
382                               _Out_ interface ID3D11FunctionLinkingGraph ** ppFunctionLinkingGraph);
383 
384 //----------------------------------------------------------------------------
385 // D3DGetTraceInstructionOffsets:
386 // -----------------------
387 // Determines byte offsets for instructions within a shader blob.
388 // This information is useful for going between trace instruction
389 // indices and byte offsets that are used in debug information.
390 //----------------------------------------------------------------------------
391 
392 #define D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE 0x00000001
393 
394 HRESULT WINAPI
395 D3DGetTraceInstructionOffsets(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
396                               _In_ SIZE_T SrcDataSize,
397                               _In_ UINT Flags,
398                               _In_ SIZE_T StartInstIndex,
399                               _In_ SIZE_T NumInsts,
400                               _Out_writes_to_opt_(NumInsts, min(NumInsts, *pTotalInsts)) SIZE_T* pOffsets,
401                               _Out_opt_ SIZE_T* pTotalInsts);
402 
403 //----------------------------------------------------------------------------
404 // D3DGetInputSignatureBlob:
405 // -----------------------
406 // Retrieve the input signature from a compilation result.
407 //----------------------------------------------------------------------------
408 
409 HRESULT WINAPI
410 D3DGetInputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
411                          _In_ SIZE_T SrcDataSize,
412                          _Out_ ID3DBlob** ppSignatureBlob);
413 
414 //----------------------------------------------------------------------------
415 // D3DGetOutputSignatureBlob:
416 // -----------------------
417 // Retrieve the output signature from a compilation result.
418 //----------------------------------------------------------------------------
419 
420 HRESULT WINAPI
421 D3DGetOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
422                           _In_ SIZE_T SrcDataSize,
423                           _Out_ ID3DBlob** ppSignatureBlob);
424 
425 //----------------------------------------------------------------------------
426 // D3DGetInputAndOutputSignatureBlob:
427 // -----------------------
428 // Retrieve the input and output signatures from a compilation result.
429 //----------------------------------------------------------------------------
430 
431 HRESULT WINAPI
432 D3DGetInputAndOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
433                                   _In_ SIZE_T SrcDataSize,
434                                   _Out_ ID3DBlob** ppSignatureBlob);
435 
436 //----------------------------------------------------------------------------
437 // D3DStripShader:
438 // -----------------------
439 // Removes unwanted blobs from a compilation result
440 //----------------------------------------------------------------------------
441 
442 typedef enum D3DCOMPILER_STRIP_FLAGS
443 {
444     D3DCOMPILER_STRIP_REFLECTION_DATA       = 0x00000001,
445     D3DCOMPILER_STRIP_DEBUG_INFO            = 0x00000002,
446     D3DCOMPILER_STRIP_TEST_BLOBS            = 0x00000004,
447     D3DCOMPILER_STRIP_PRIVATE_DATA          = 0x00000008,
448     D3DCOMPILER_STRIP_ROOT_SIGNATURE        = 0x00000010,
449     D3DCOMPILER_STRIP_FORCE_DWORD           = 0x7fffffff,
450 } D3DCOMPILER_STRIP_FLAGS;
451 
452 HRESULT WINAPI
453 D3DStripShader(_In_reads_bytes_(BytecodeLength) LPCVOID pShaderBytecode,
454                _In_ SIZE_T BytecodeLength,
455                _In_ UINT uStripFlags,
456                _Out_ ID3DBlob** ppStrippedBlob);
457 
458 //----------------------------------------------------------------------------
459 // D3DGetBlobPart:
460 // -----------------------
461 // Extracts information from a compilation result.
462 //----------------------------------------------------------------------------
463 
464 typedef enum D3D_BLOB_PART
465 {
466     D3D_BLOB_INPUT_SIGNATURE_BLOB,
467     D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
468     D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
469     D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
470     D3D_BLOB_ALL_SIGNATURE_BLOB,
471     D3D_BLOB_DEBUG_INFO,
472     D3D_BLOB_LEGACY_SHADER,
473     D3D_BLOB_XNA_PREPASS_SHADER,
474     D3D_BLOB_XNA_SHADER,
475     D3D_BLOB_PDB,
476     D3D_BLOB_PRIVATE_DATA,
477     D3D_BLOB_ROOT_SIGNATURE,
478     D3D_BLOB_DEBUG_NAME,
479 
480     // Test parts are only produced by special compiler versions and so
481     // are usually not present in shaders.
482     D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
483     D3D_BLOB_TEST_COMPILE_DETAILS,
484     D3D_BLOB_TEST_COMPILE_PERF,
485     D3D_BLOB_TEST_COMPILE_REPORT,
486 } D3D_BLOB_PART;
487 
488 HRESULT WINAPI
489 D3DGetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
490                _In_ SIZE_T SrcDataSize,
491                _In_ D3D_BLOB_PART Part,
492                _In_ UINT Flags,
493                _Out_ ID3DBlob** ppPart);
494 
495 //----------------------------------------------------------------------------
496 // D3DSetBlobPart:
497 // -----------------------
498 // Update information in a compilation result.
499 //----------------------------------------------------------------------------
500 
501 HRESULT WINAPI
502 D3DSetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
503                _In_ SIZE_T SrcDataSize,
504                _In_ D3D_BLOB_PART Part,
505                _In_ UINT Flags,
506                _In_reads_bytes_(PartSize) LPCVOID pPart,
507                _In_ SIZE_T PartSize,
508                _Out_ ID3DBlob** ppNewShader);
509 
510 //----------------------------------------------------------------------------
511 // D3DCreateBlob:
512 // -----------------------
513 // Create an ID3DBlob instance.
514 //----------------------------------------------------------------------------
515 
516 HRESULT WINAPI
517 D3DCreateBlob(_In_ SIZE_T Size,
518               _Out_ ID3DBlob** ppBlob);
519 
520 //----------------------------------------------------------------------------
521 // D3DCompressShaders:
522 // -----------------------
523 // Compresses a set of shaders into a more compact form.
524 //----------------------------------------------------------------------------
525 
526 typedef struct _D3D_SHADER_DATA
527 {
528     LPCVOID pBytecode;
529     SIZE_T BytecodeLength;
530 } D3D_SHADER_DATA;
531 
532 #define D3D_COMPRESS_SHADER_KEEP_ALL_PARTS 0x00000001
533 
534 HRESULT WINAPI
535 D3DCompressShaders(_In_ UINT uNumShaders,
536                    _In_reads_(uNumShaders) D3D_SHADER_DATA* pShaderData,
537                    _In_ UINT uFlags,
538                    _Out_ ID3DBlob** ppCompressedData);
539 
540 //----------------------------------------------------------------------------
541 // D3DDecompressShaders:
542 // -----------------------
543 // Decompresses one or more shaders from a compressed set.
544 //----------------------------------------------------------------------------
545 
546 HRESULT WINAPI
547 D3DDecompressShaders(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
548                      _In_ SIZE_T SrcDataSize,
549                      _In_ UINT uNumShaders,
550                      _In_ UINT uStartIndex,
551                      _In_reads_opt_(uNumShaders) UINT* pIndices,
552                      _In_ UINT uFlags,
553                      _Out_writes_(uNumShaders) ID3DBlob** ppShaders,
554                      _Out_opt_ UINT* pTotalShaders);
555 
556 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
557 /*#pragma endregion*/
558 
559 /*#pragma region Desktop Family*/
560 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)*/
561 
562 //----------------------------------------------------------------------------
563 // D3DDisassemble10Effect:
564 // -----------------------
565 // Takes a D3D10 effect interface and returns a
566 // buffer containing text assembly.
567 //----------------------------------------------------------------------------
568 
569 HRESULT WINAPI
570 D3DDisassemble10Effect(_In_ interface ID3D10Effect *pEffect,
571                        _In_ UINT Flags,
572                        _Out_ ID3DBlob** ppDisassembly);
573 
574 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
575 /*#pragma endregion*/
576 
577 #ifdef __cplusplus
578 }
579 #endif //__cplusplus
580 
581 #endif // #ifndef __D3DCOMPILER_H__
582