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