Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
8.1 KiB

  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. // Current name of the DLL shipped in the same SDK as this header.
  12. #define D3DCOMPILER_DLL_W L"d3dcompiler_41.dll"
  13. #define D3DCOMPILER_DLL_A "d3dcompiler_41.dll"
  14. #ifdef UNICODE
  15. #define D3DCOMPILER_DLL D3DCOMPILER_DLL_W
  16. #else
  17. #define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
  18. #endif
  19. #include "d3d11shader.h"
  20. // The compilation APIs are generally not tied to particular
  21. // versions of D3D, thus their names and types don't reflect
  22. // a particular version number unless it is necessary to
  23. // do so. However, for compatibility with previous compilation
  24. // API definitions some of the neutral types are simply
  25. // redefinitions of older types.
  26. typedef struct _D3D10_SHADER_MACRO D3D_SHADER_MACRO;
  27. typedef enum _D3D10_INCLUDE_TYPE D3D_INCLUDE_TYPE;
  28. typedef interface ID3D10Blob ID3DBlob;
  29. typedef ID3DBlob* LPD3DBLOB;
  30. typedef interface ID3D10Include ID3DInclude;
  31. typedef ID3DInclude* LPD3DINCLUDE;
  32. //////////////////////////////////////////////////////////////////////////////
  33. // APIs //////////////////////////////////////////////////////////////////////
  34. //////////////////////////////////////////////////////////////////////////////
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif //__cplusplus
  38. //----------------------------------------------------------------------------
  39. // D3DCompile:
  40. // ----------
  41. // Compile source text into bytecode appropriate for the given target.
  42. //----------------------------------------------------------------------------
  43. HRESULT WINAPI
  44. D3DCompile(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  45. __in SIZE_T SrcDataSize,
  46. __in_opt LPCSTR pSourceName,
  47. __in_xcount_opt(pDefines->Name != NULL) CONST D3D_SHADER_MACRO* pDefines,
  48. __in_opt LPD3DINCLUDE pInclude,
  49. __in LPCSTR pEntrypoint,
  50. __in LPCSTR pTarget,
  51. __in UINT Flags1,
  52. __in UINT Flags2,
  53. __out LPD3DBLOB* ppCode,
  54. __out_opt LPD3DBLOB* ppErrorMsgs);
  55. typedef HRESULT (WINAPI *pD3DCompile)
  56. (LPCVOID pSrcData,
  57. SIZE_T SrcDataSize,
  58. LPCSTR pFileName,
  59. CONST D3D10_SHADER_MACRO* pDefines,
  60. LPD3D10INCLUDE pInclude,
  61. LPCSTR pEntrypoint,
  62. LPCSTR pTarget,
  63. UINT Flags1,
  64. UINT Flags2,
  65. LPD3D10BLOB* ppCode,
  66. LPD3D10BLOB* ppErrorMsgs);
  67. //----------------------------------------------------------------------------
  68. // D3DPreprocess:
  69. // ----------
  70. // Process source text with the compiler's preprocessor and return
  71. // the resulting text.
  72. //----------------------------------------------------------------------------
  73. HRESULT WINAPI
  74. D3DPreprocess(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  75. __in SIZE_T SrcDataSize,
  76. __in_opt LPCSTR pSourceName,
  77. __in_opt CONST D3D_SHADER_MACRO* pDefines,
  78. __in_opt LPD3DINCLUDE pInclude,
  79. __out LPD3DBLOB* ppCodeText,
  80. __out_opt LPD3DBLOB* ppErrorMsgs);
  81. typedef HRESULT (WINAPI *pD3DPreprocess)
  82. (LPCVOID pSrcData,
  83. SIZE_T SrcDataSize,
  84. LPCSTR pFileName,
  85. CONST D3D10_SHADER_MACRO* pDefines,
  86. LPD3D10INCLUDE pInclude,
  87. LPD3D10BLOB* ppCodeText,
  88. LPD3D10BLOB* ppErrorMsgs);
  89. //----------------------------------------------------------------------------
  90. // D3DGetDebugInfo:
  91. // -----------------------
  92. // Gets shader debug info. Debug info is generated by D3DCompile and is
  93. // embedded in the body of the shader.
  94. //----------------------------------------------------------------------------
  95. HRESULT WINAPI
  96. D3DGetDebugInfo(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  97. __in SIZE_T SrcDataSize,
  98. __out LPD3DBLOB* ppDebugInfo);
  99. //----------------------------------------------------------------------------
  100. // D3DReflect:
  101. // ----------
  102. // Shader code contains metadata that can be inspected via the
  103. // reflection APIs.
  104. //----------------------------------------------------------------------------
  105. HRESULT WINAPI
  106. D3DReflect(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  107. __in SIZE_T SrcDataSize,
  108. __in REFIID pInterface,
  109. __out void** ppReflector);
  110. //----------------------------------------------------------------------------
  111. // D3DDisassemble:
  112. // ----------------------
  113. // Takes a binary shader and returns a buffer containing text assembly.
  114. //----------------------------------------------------------------------------
  115. #define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
  116. #define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
  117. HRESULT WINAPI
  118. D3DDisassemble(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  119. __in SIZE_T SrcDataSize,
  120. __in UINT Flags,
  121. __in_opt LPCSTR szComments,
  122. __out LPD3DBLOB* ppDisassembly);
  123. typedef HRESULT (WINAPI *pD3DDisassemble)
  124. (__in_bcount(SrcDataSize) LPCVOID pSrcData,
  125. __in SIZE_T SrcDataSize,
  126. __in UINT Flags,
  127. __in_opt LPCSTR szComments,
  128. __out LPD3DBLOB* ppDisassembly);
  129. //----------------------------------------------------------------------------
  130. // D3DDisassemble10Effect:
  131. // -----------------------
  132. // Takes a D3D10 effect interface and returns a
  133. // buffer containing text assembly.
  134. //----------------------------------------------------------------------------
  135. HRESULT WINAPI
  136. D3DDisassemble10Effect(__in ID3D10Effect *pEffect,
  137. __in UINT Flags,
  138. __out LPD3DBLOB* ppDisassembly);
  139. //----------------------------------------------------------------------------
  140. // D3DGetInputSignatureBlob:
  141. // -----------------------
  142. // Retrieve the input signature from a compilation result.
  143. //----------------------------------------------------------------------------
  144. HRESULT WINAPI
  145. D3DGetInputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  146. __in SIZE_T SrcDataSize,
  147. __out LPD3DBLOB* ppSignatureBlob);
  148. //----------------------------------------------------------------------------
  149. // D3DGetOutputSignatureBlob:
  150. // -----------------------
  151. // Retrieve the output signature from a compilation result.
  152. //----------------------------------------------------------------------------
  153. HRESULT WINAPI
  154. D3DGetOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  155. __in SIZE_T SrcDataSize,
  156. __out LPD3DBLOB* ppSignatureBlob);
  157. //----------------------------------------------------------------------------
  158. // D3DGetInputAndOutputSignatureBlob:
  159. // -----------------------
  160. // Retrieve the input and output signatures from a compilation result.
  161. //----------------------------------------------------------------------------
  162. HRESULT WINAPI
  163. D3DGetInputAndOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData,
  164. __in SIZE_T SrcDataSize,
  165. __out LPD3DBLOB* ppSignatureBlob);
  166. //----------------------------------------------------------------------------
  167. // D3DStripShader:
  168. // -----------------------
  169. // Removes unwanted blobs from a compilation result
  170. //----------------------------------------------------------------------------
  171. typedef enum D3DCOMPILER_STRIP_FLAGS
  172. {
  173. D3DCOMPILER_STRIP_REFLECTION_DATA = 1,
  174. D3DCOMPILER_STRIP_DEBUG_INFO = 2,
  175. D3DCOMPILER_STRIP_TEST_BLOBS = 4,
  176. D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff,
  177. } D3DCOMPILER_STRIP_FLAGS;
  178. HRESULT WINAPI
  179. D3DStripShader(__in_bcount(BytecodeLength) LPCVOID pShaderBytecode,
  180. __in SIZE_T BytecodeLength,
  181. __in UINT uStripFlags,
  182. __out LPD3DBLOB* ppStrippedBlob);
  183. #ifdef __cplusplus
  184. }
  185. #endif //__cplusplus
  186. #endif // #ifndef __D3DCOMPILER_H__