1 #include <_mingw_unicode.h>
2 /*
3  * Copyright 2010 Matteo Bruni for CodeWeavers
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #ifndef __D3DCOMPILER_H__
21 #define __D3DCOMPILER_H__
22 
23 #include "d3d11shader.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #if defined(__GNUC__)
30 #define D3DCOMPILER_DLL_W (const WCHAR[]){'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0}
31 #elif defined(_MSC_VER)
32 #define D3DCOMPILER_DLL_W L"d3dcompiler_43.dll"
33 #else
34 static const WCHAR D3DCOMPILER_DLL_W[] = {'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0};
35 #endif
36 
37 #define D3DCOMPILER_DLL_A  "d3dcompiler_43.dll"
38 #define D3DCOMPILER_DLL    __MINGW_NAME_AW(D3DCOMPILER_DLL_)
39 
40 #define D3DCOMPILE_DEBUG                            0x00000001
41 #define D3DCOMPILE_SKIP_VALIDATION                  0x00000002
42 #define D3DCOMPILE_SKIP_OPTIMIZATION                0x00000004
43 #define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR            0x00000008
44 #define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR         0x00000010
45 #define D3DCOMPILE_PARTIAL_PRECISION                0x00000020
46 #define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT         0x00000040
47 #define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT         0x00000080
48 #define D3DCOMPILE_NO_PRESHADER                     0x00000100
49 #define D3DCOMPILE_AVOID_FLOW_CONTROL               0x00000200
50 #define D3DCOMPILE_PREFER_FLOW_CONTROL              0x00000400
51 #define D3DCOMPILE_ENABLE_STRICTNESS                0x00000800
52 #define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY   0x00001000
53 #define D3DCOMPILE_IEEE_STRICTNESS                  0x00002000
54 #define D3DCOMPILE_OPTIMIZATION_LEVEL0              0x00004000
55 #define D3DCOMPILE_OPTIMIZATION_LEVEL1              0x00000000
56 #define D3DCOMPILE_OPTIMIZATION_LEVEL2              0x0000c000
57 #define D3DCOMPILE_OPTIMIZATION_LEVEL3              0x00008000
58 #define D3DCOMPILE_RESERVED16                       0x00010000
59 #define D3DCOMPILE_RESERVED17                       0x00020000
60 #define D3DCOMPILE_WARNINGS_ARE_ERRORS              0x00040000
61 #define D3DCOMPILE_RESOURCES_MAY_ALIAS              0x00080000
62 
63 #define D3D_DISASM_ENABLE_COLOR_CODE                0x00000001
64 #define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS      0x00000002
65 #define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING     0x00000004
66 #define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE         0x00000008
67 #define D3D_DISASM_DISABLE_DEBUG_INFO               0x00000010
68 
69 HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
70         const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
71         const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
72 typedef HRESULT (WINAPI *pD3DCompile)(const void *data, SIZE_T data_size, const char *filename,
73         const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint,
74         const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages);
75 
76 typedef enum D3DCOMPILER_STRIP_FLAGS
77 {
78     D3DCOMPILER_STRIP_REFLECTION_DATA = 1,
79     D3DCOMPILER_STRIP_DEBUG_INFO = 2,
80     D3DCOMPILER_STRIP_TEST_BLOBS = 4,
81     D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff
82 } D3DCOMPILER_STRIP_FLAGS;
83 
84 HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob);
85 
86 typedef enum D3D_BLOB_PART
87 {
88     D3D_BLOB_INPUT_SIGNATURE_BLOB,
89     D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
90     D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
91     D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
92     D3D_BLOB_ALL_SIGNATURE_BLOB,
93     D3D_BLOB_DEBUG_INFO,
94     D3D_BLOB_LEGACY_SHADER,
95     D3D_BLOB_XNA_PREPASS_SHADER,
96     D3D_BLOB_XNA_SHADER,
97     D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
98     D3D_BLOB_TEST_COMPILE_DETAILS,
99     D3D_BLOB_TEST_COMPILE_PERF
100 } D3D_BLOB_PART;
101 
102 HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T data_size,
103         UINT flags, const char *comments, ID3DBlob **disassembly);
104 typedef HRESULT (WINAPI *pD3DDisassemble)(const void *data, SIZE_T data_size,
105         UINT flags, const char *comments, ID3DBlob **disassembly);
106 HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
107 HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
108 HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
109 HRESULT WINAPI D3DGetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
110 HRESULT WINAPI D3DGetDebugInfo(const void *data, SIZE_T data_size, ID3DBlob **blob);
111 HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents);
112 HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob *blob, const WCHAR *filename, WINBOOL overwrite);
113 HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector);
114 
115 HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob);
116 
117 HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename,
118         const D3D_SHADER_MACRO *defines, ID3DInclude *include,
119         ID3DBlob **shader, ID3DBlob **error_messages);
120 typedef HRESULT (WINAPI *pD3DPreprocess)(const void *data, SIZE_T size, const char *filename,
121         const D3D_SHADER_MACRO *defines, ID3DInclude *include,
122         ID3DBlob **shader, ID3DBlob **error_messages);
123 
124 HRESULT WINAPI D3DLoadModule(const void *data, SIZE_T size, ID3D11Module **module);
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif
131