d3dcompiler.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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. // BK - 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. // D3DCOMPILE_DEBUG_NAME_FOR_SOURCE
  111. // This enables a debug name to be generated based on source information.
  112. // It requires D3DCOMPILE_DEBUG to be set, and is exclusive with
  113. // D3DCOMPILE_DEBUG_NAME_FOR_BINARY.
  114. //
  115. // D3DCOMPILE_DEBUG_NAME_FOR_BINARY
  116. // This enables a debug name to be generated based on compiled information.
  117. // It requires D3DCOMPILE_DEBUG to be set, and is exclusive with
  118. // D3DCOMPILE_DEBUG_NAME_FOR_SOURCE.
  119. //
  120. //----------------------------------------------------------------------------
  121. #define D3DCOMPILE_DEBUG (1 << 0)
  122. #define D3DCOMPILE_SKIP_VALIDATION (1 << 1)
  123. #define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
  124. #define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR (1 << 3)
  125. #define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR (1 << 4)
  126. #define D3DCOMPILE_PARTIAL_PRECISION (1 << 5)
  127. #define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT (1 << 6)
  128. #define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT (1 << 7)
  129. #define D3DCOMPILE_NO_PRESHADER (1 << 8)
  130. #define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
  131. #define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
  132. #define D3DCOMPILE_ENABLE_STRICTNESS (1 << 11)
  133. #define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)
  134. #define D3DCOMPILE_IEEE_STRICTNESS (1 << 13)
  135. #define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
  136. #define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
  137. #define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
  138. #define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
  139. #define D3DCOMPILE_RESERVED16 (1 << 16)
  140. #define D3DCOMPILE_RESERVED17 (1 << 17)
  141. #define D3DCOMPILE_WARNINGS_ARE_ERRORS (1 << 18)
  142. #define D3DCOMPILE_RESOURCES_MAY_ALIAS (1 << 19)
  143. #define D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20)
  144. #define D3DCOMPILE_ALL_RESOURCES_BOUND (1 << 21)
  145. #define D3DCOMPILE_DEBUG_NAME_FOR_SOURCE (1 << 22)
  146. #define D3DCOMPILE_DEBUG_NAME_FOR_BINARY (1 << 23)
  147. //----------------------------------------------------------------------------
  148. // D3DCOMPILE_EFFECT flags:
  149. // -------------------------------------
  150. // These flags are passed in when creating an effect, and affect
  151. // either compilation behavior or runtime effect behavior
  152. //
  153. // D3DCOMPILE_EFFECT_CHILD_EFFECT
  154. // Compile this .fx file to a child effect. Child effects have no
  155. // initializers for any shared values as these are initialied in the
  156. // master effect (pool).
  157. //
  158. // D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS
  159. // By default, performance mode is enabled. Performance mode
  160. // disallows mutable state objects by preventing non-literal
  161. // expressions from appearing in state object definitions.
  162. // Specifying this flag will disable the mode and allow for mutable
  163. // state objects.
  164. //
  165. //----------------------------------------------------------------------------
  166. #define D3DCOMPILE_EFFECT_CHILD_EFFECT (1 << 0)
  167. #define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS (1 << 1)
  168. //----------------------------------------------------------------------------
  169. // D3DCOMPILE Flags2:
  170. // -----------------
  171. // Root signature flags. (passed in Flags2)
  172. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0
  173. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 (1 << 4)
  174. #define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 (1 << 5)
  175. //----------------------------------------------------------------------------
  176. // D3DCompile:
  177. // ----------
  178. // Compile source text into bytecode appropriate for the given target.
  179. //----------------------------------------------------------------------------
  180. // D3D_COMPILE_STANDARD_FILE_INCLUDE can be passed for pInclude in any
  181. // API and indicates that a simple default include handler should be
  182. // used. The include handler will include files relative to the
  183. // current directory and files relative to the directory of the initial source
  184. // file. When used with APIs like D3DCompile pSourceName must be a
  185. // file name and the initial relative directory will be derived from it.
  186. #define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)
  187. HRESULT WINAPI
  188. D3DCompile(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  189. _In_ SIZE_T SrcDataSize,
  190. _In_opt_ LPCSTR pSourceName,
  191. _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
  192. _In_opt_ ID3DInclude* pInclude,
  193. _In_opt_ LPCSTR pEntrypoint,
  194. _In_ LPCSTR pTarget,
  195. _In_ UINT Flags1,
  196. _In_ UINT Flags2,
  197. _Out_ ID3DBlob** ppCode,
  198. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
  199. typedef HRESULT (WINAPI *pD3DCompile)
  200. (LPCVOID pSrcData,
  201. SIZE_T SrcDataSize,
  202. LPCSTR pFileName,
  203. CONST D3D_SHADER_MACRO* pDefines,
  204. ID3DInclude* pInclude,
  205. LPCSTR pEntrypoint,
  206. LPCSTR pTarget,
  207. UINT Flags1,
  208. UINT Flags2,
  209. ID3DBlob** ppCode,
  210. ID3DBlob** ppErrorMsgs);
  211. #define D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS 0x00000001
  212. #define D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS 0x00000002
  213. #define D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH 0x00000004
  214. HRESULT WINAPI
  215. D3DCompile2(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  216. _In_ SIZE_T SrcDataSize,
  217. _In_opt_ LPCSTR pSourceName,
  218. _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
  219. _In_opt_ ID3DInclude* pInclude,
  220. _In_ LPCSTR pEntrypoint,
  221. _In_ LPCSTR pTarget,
  222. _In_ UINT Flags1,
  223. _In_ UINT Flags2,
  224. _In_ UINT SecondaryDataFlags,
  225. _In_reads_bytes_opt_(SecondaryDataSize) LPCVOID pSecondaryData,
  226. _In_ SIZE_T SecondaryDataSize,
  227. _Out_ ID3DBlob** ppCode,
  228. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
  229. HRESULT WINAPI
  230. D3DCompileFromFile(_In_ LPCWSTR pFileName,
  231. _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
  232. _In_opt_ ID3DInclude* pInclude,
  233. _In_ LPCSTR pEntrypoint,
  234. _In_ LPCSTR pTarget,
  235. _In_ UINT Flags1,
  236. _In_ UINT Flags2,
  237. _Out_ ID3DBlob** ppCode,
  238. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
  239. //----------------------------------------------------------------------------
  240. // D3DPreprocess:
  241. // -------------
  242. // Process source text with the compiler's preprocessor and return
  243. // the resulting text.
  244. //----------------------------------------------------------------------------
  245. HRESULT WINAPI
  246. D3DPreprocess(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  247. _In_ SIZE_T SrcDataSize,
  248. _In_opt_ LPCSTR pSourceName,
  249. _In_opt_ CONST D3D_SHADER_MACRO* pDefines,
  250. _In_opt_ ID3DInclude* pInclude,
  251. _Out_ ID3DBlob** ppCodeText,
  252. _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs);
  253. typedef HRESULT (WINAPI *pD3DPreprocess)
  254. (LPCVOID pSrcData,
  255. SIZE_T SrcDataSize,
  256. LPCSTR pFileName,
  257. CONST D3D_SHADER_MACRO* pDefines,
  258. ID3DInclude* pInclude,
  259. ID3DBlob** ppCodeText,
  260. ID3DBlob** ppErrorMsgs);
  261. //----------------------------------------------------------------------------
  262. // D3DGetDebugInfo:
  263. // -----------------------
  264. // Gets shader debug info. Debug info is generated by D3DCompile and is
  265. // embedded in the body of the shader.
  266. //----------------------------------------------------------------------------
  267. HRESULT WINAPI
  268. D3DGetDebugInfo(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  269. _In_ SIZE_T SrcDataSize,
  270. _Out_ ID3DBlob** ppDebugInfo);
  271. //----------------------------------------------------------------------------
  272. // D3DReflect:
  273. // ----------
  274. // Shader code contains metadata that can be inspected via the
  275. // reflection APIs.
  276. //----------------------------------------------------------------------------
  277. HRESULT WINAPI
  278. D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  279. _In_ SIZE_T SrcDataSize,
  280. _In_ REFIID pInterface,
  281. _Out_ void** ppReflector);
  282. //----------------------------------------------------------------------------
  283. // D3DReflectLibrary:
  284. // ----------
  285. // Library code contains metadata that can be inspected via the library
  286. // reflection APIs.
  287. //----------------------------------------------------------------------------
  288. HRESULT WINAPI
  289. D3DReflectLibrary(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  290. __in SIZE_T SrcDataSize,
  291. __in REFIID riid,
  292. __out LPVOID * ppReflector);
  293. //----------------------------------------------------------------------------
  294. // D3DDisassemble:
  295. // ----------------------
  296. // Takes a binary shader and returns a buffer containing text assembly.
  297. //----------------------------------------------------------------------------
  298. #define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
  299. #define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
  300. #define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
  301. #define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE 0x00000008
  302. #define D3D_DISASM_DISABLE_DEBUG_INFO 0x00000010
  303. #define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET 0x00000020
  304. #define D3D_DISASM_INSTRUCTION_ONLY 0x00000040
  305. #define D3D_DISASM_PRINT_HEX_LITERALS 0x00000080
  306. HRESULT WINAPI
  307. D3DDisassemble(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  308. _In_ SIZE_T SrcDataSize,
  309. _In_ UINT Flags,
  310. _In_opt_ LPCSTR szComments,
  311. _Out_ ID3DBlob** ppDisassembly);
  312. typedef HRESULT (WINAPI *pD3DDisassemble)
  313. (_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  314. _In_ SIZE_T SrcDataSize,
  315. _In_ UINT Flags,
  316. _In_opt_ LPCSTR szComments,
  317. _Out_ ID3DBlob** ppDisassembly);
  318. HRESULT WINAPI
  319. D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  320. _In_ SIZE_T SrcDataSize,
  321. _In_ UINT Flags,
  322. _In_opt_ LPCSTR szComments,
  323. _In_ SIZE_T StartByteOffset,
  324. _In_ SIZE_T NumInsts,
  325. _Out_opt_ SIZE_T* pFinishByteOffset,
  326. _Out_ ID3DBlob** ppDisassembly);
  327. //----------------------------------------------------------------------------
  328. // Shader linking and Function Linking Graph (FLG) APIs
  329. //----------------------------------------------------------------------------
  330. HRESULT WINAPI
  331. D3DCreateLinker(__out interface ID3D11Linker ** ppLinker);
  332. HRESULT WINAPI
  333. D3DLoadModule(_In_ LPCVOID pSrcData,
  334. _In_ SIZE_T cbSrcDataSize,
  335. _Out_ interface ID3D11Module ** ppModule);
  336. HRESULT WINAPI
  337. D3DCreateFunctionLinkingGraph(_In_ UINT uFlags,
  338. _Out_ interface ID3D11FunctionLinkingGraph ** ppFunctionLinkingGraph);
  339. //----------------------------------------------------------------------------
  340. // D3DGetTraceInstructionOffsets:
  341. // -----------------------
  342. // Determines byte offsets for instructions within a shader blob.
  343. // This information is useful for going between trace instruction
  344. // indices and byte offsets that are used in debug information.
  345. //----------------------------------------------------------------------------
  346. #define D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE 0x00000001
  347. HRESULT WINAPI
  348. D3DGetTraceInstructionOffsets(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  349. _In_ SIZE_T SrcDataSize,
  350. _In_ UINT Flags,
  351. _In_ SIZE_T StartInstIndex,
  352. _In_ SIZE_T NumInsts,
  353. _Out_writes_to_opt_(NumInsts, min(NumInsts, *pTotalInsts)) SIZE_T* pOffsets,
  354. _Out_opt_ SIZE_T* pTotalInsts);
  355. //----------------------------------------------------------------------------
  356. // D3DGetInputSignatureBlob:
  357. // -----------------------
  358. // Retrieve the input signature from a compilation result.
  359. //----------------------------------------------------------------------------
  360. HRESULT WINAPI
  361. D3DGetInputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  362. _In_ SIZE_T SrcDataSize,
  363. _Out_ ID3DBlob** ppSignatureBlob);
  364. //----------------------------------------------------------------------------
  365. // D3DGetOutputSignatureBlob:
  366. // -----------------------
  367. // Retrieve the output signature from a compilation result.
  368. //----------------------------------------------------------------------------
  369. HRESULT WINAPI
  370. D3DGetOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  371. _In_ SIZE_T SrcDataSize,
  372. _Out_ ID3DBlob** ppSignatureBlob);
  373. //----------------------------------------------------------------------------
  374. // D3DGetInputAndOutputSignatureBlob:
  375. // -----------------------
  376. // Retrieve the input and output signatures from a compilation result.
  377. //----------------------------------------------------------------------------
  378. HRESULT WINAPI
  379. D3DGetInputAndOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  380. _In_ SIZE_T SrcDataSize,
  381. _Out_ ID3DBlob** ppSignatureBlob);
  382. //----------------------------------------------------------------------------
  383. // D3DStripShader:
  384. // -----------------------
  385. // Removes unwanted blobs from a compilation result
  386. //----------------------------------------------------------------------------
  387. typedef enum D3DCOMPILER_STRIP_FLAGS
  388. {
  389. D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001,
  390. D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002,
  391. D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004,
  392. D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008,
  393. D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010,
  394. D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff,
  395. } D3DCOMPILER_STRIP_FLAGS;
  396. HRESULT WINAPI
  397. D3DStripShader(_In_reads_bytes_(BytecodeLength) LPCVOID pShaderBytecode,
  398. _In_ SIZE_T BytecodeLength,
  399. _In_ UINT uStripFlags,
  400. _Out_ ID3DBlob** ppStrippedBlob);
  401. //----------------------------------------------------------------------------
  402. // D3DGetBlobPart:
  403. // -----------------------
  404. // Extracts information from a compilation result.
  405. //----------------------------------------------------------------------------
  406. typedef enum D3D_BLOB_PART
  407. {
  408. D3D_BLOB_INPUT_SIGNATURE_BLOB,
  409. D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
  410. D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
  411. D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
  412. D3D_BLOB_ALL_SIGNATURE_BLOB,
  413. D3D_BLOB_DEBUG_INFO,
  414. D3D_BLOB_LEGACY_SHADER,
  415. D3D_BLOB_XNA_PREPASS_SHADER,
  416. D3D_BLOB_XNA_SHADER,
  417. D3D_BLOB_PDB,
  418. D3D_BLOB_PRIVATE_DATA,
  419. D3D_BLOB_ROOT_SIGNATURE,
  420. D3D_BLOB_DEBUG_NAME,
  421. // Test parts are only produced by special compiler versions and so
  422. // are usually not present in shaders.
  423. D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
  424. D3D_BLOB_TEST_COMPILE_DETAILS,
  425. D3D_BLOB_TEST_COMPILE_PERF,
  426. D3D_BLOB_TEST_COMPILE_REPORT,
  427. } D3D_BLOB_PART;
  428. HRESULT WINAPI
  429. D3DGetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  430. _In_ SIZE_T SrcDataSize,
  431. _In_ D3D_BLOB_PART Part,
  432. _In_ UINT Flags,
  433. _Out_ ID3DBlob** ppPart);
  434. //----------------------------------------------------------------------------
  435. // D3DSetBlobPart:
  436. // -----------------------
  437. // Update information in a compilation result.
  438. //----------------------------------------------------------------------------
  439. HRESULT WINAPI
  440. D3DSetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  441. _In_ SIZE_T SrcDataSize,
  442. _In_ D3D_BLOB_PART Part,
  443. _In_ UINT Flags,
  444. _In_reads_bytes_(PartSize) LPCVOID pPart,
  445. _In_ SIZE_T PartSize,
  446. _Out_ ID3DBlob** ppNewShader);
  447. //----------------------------------------------------------------------------
  448. // D3DCreateBlob:
  449. // -----------------------
  450. // Create an ID3DBlob instance.
  451. //----------------------------------------------------------------------------
  452. HRESULT WINAPI
  453. D3DCreateBlob(_In_ SIZE_T Size,
  454. _Out_ ID3DBlob** ppBlob);
  455. //----------------------------------------------------------------------------
  456. // D3DCompressShaders:
  457. // -----------------------
  458. // Compresses a set of shaders into a more compact form.
  459. //----------------------------------------------------------------------------
  460. typedef struct _D3D_SHADER_DATA
  461. {
  462. LPCVOID pBytecode;
  463. SIZE_T BytecodeLength;
  464. } D3D_SHADER_DATA;
  465. #define D3D_COMPRESS_SHADER_KEEP_ALL_PARTS 0x00000001
  466. HRESULT WINAPI
  467. D3DCompressShaders(_In_ UINT uNumShaders,
  468. _In_reads_(uNumShaders) D3D_SHADER_DATA* pShaderData,
  469. _In_ UINT uFlags,
  470. _Out_ ID3DBlob** ppCompressedData);
  471. //----------------------------------------------------------------------------
  472. // D3DDecompressShaders:
  473. // -----------------------
  474. // Decompresses one or more shaders from a compressed set.
  475. //----------------------------------------------------------------------------
  476. HRESULT WINAPI
  477. D3DDecompressShaders(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
  478. _In_ SIZE_T SrcDataSize,
  479. _In_ UINT uNumShaders,
  480. _In_ UINT uStartIndex,
  481. _In_reads_opt_(uNumShaders) UINT* pIndices,
  482. _In_ UINT uFlags,
  483. _Out_writes_(uNumShaders) ID3DBlob** ppShaders,
  484. _Out_opt_ UINT* pTotalShaders);
  485. #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
  486. // BK - pragma endregion
  487. // BK - pragma region Desktop Family
  488. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  489. //----------------------------------------------------------------------------
  490. // D3DDisassemble10Effect:
  491. // -----------------------
  492. // Takes a D3D10 effect interface and returns a
  493. // buffer containing text assembly.
  494. //----------------------------------------------------------------------------
  495. HRESULT WINAPI
  496. D3DDisassemble10Effect(_In_ interface ID3D10Effect *pEffect,
  497. _In_ UINT Flags,
  498. _Out_ ID3DBlob** ppDisassembly);
  499. #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
  500. // BK - pragma endregion
  501. #ifdef __cplusplus
  502. }
  503. #endif //__cplusplus
  504. #endif // #ifndef __D3DCOMPILER_H__