d3dcompiler.h 23 KB

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