1 module directx.d3dx11async;
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 //  Copyright (c) Microsoft Corporation.  All rights reserved.
5 //
6 //  File:       D3DX11Async.h
7 //  Content:    D3DX11 Asynchronous Shader loaders / compilers
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 
11 version(Windows):
12 
13 import directx.d3d11;
14 import directx.d3dcommon;
15 import directx.win32;
16 import directx.d3dx11core;
17 import directx.d3dcommon;
18 import directx.d3dx11tex;
19 
20 // declared in d3d10shader.h
21 alias LPD3DINCLUDE LPD3D10INCLUDE;
22 alias D3D_SHADER_MACRO D3D10_SHADER_MACRO;
23 
24 extern (Windows) {
25 
26 //----------------------------------------------------------------------------
27 // D3DX11Compile:
28 // ------------------
29 // Compiles an effect or shader.
30 //
31 // Parameters:
32 //  pSrcFile
33 //      Source file name.
34 //  hSrcModule
35 //      Module handle. if NULL, current module will be used.
36 //  pSrcResource
37 //      Resource name in module.
38 //  pSrcData
39 //      Pointer to source code.
40 //  SrcDataLen
41 //      Size of source code, in bytes.
42 //  pDefines
43 //      Optional NULL-terminated array of preprocessor macro definitions.
44 //  pInclude
45 //      Optional interface pointer to use for handling #include directives.
46 //      If this parameter is NULL, #includes will be honored when compiling
47 //      from file, and will error when compiling from resource or memory.
48 //  pFunctionName
49 //      Name of the entrypoint function where execution should begin.
50 //  pProfile
51 //      Instruction set to be used when generating code.  Currently supported
52 //      profiles are "vs_1_1",  "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
53 //                   "vs_3_sw", "vs_4_0", "vs_4_1",
54 //                   "ps_2_0",  "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", 
55 //                   "ps_3_sw", "ps_4_0", "ps_4_1",
56 //                   "gs_4_0",  "gs_4_1",
57 //                   "tx_1_0",
58 //                   "fx_4_0",  "fx_4_1"
59 //      Note that this entrypoint does not compile fx_2_0 targets, for that
60 //      you need to use the D3DX9 function.
61 //  Flags1
62 //      See D3D10_SHADER_xxx flags.
63 //  Flags2
64 //      See D3D10_EFFECT_xxx flags.
65 //  ppShader
66 //      Returns a buffer containing the created shader.  This buffer contains
67 //      the compiled shader code, as well as any embedded debug and symbol
68 //      table info.  (See D3D10GetShaderConstantTable)
69 //  ppErrorMsgs
70 //      Returns a buffer containing a listing of errors and warnings that were
71 //      encountered during the compile.  If you are running in a debugger,
72 //      these are the same messages you will see in your debug output.
73 //  pHResult
74 //      Pointer to a memory location to receive the return value upon completion.
75 //      Maybe NULL if not needed.
76 //      If pPump != NULL, pHResult must be a valid memory location until the
77 //      the asynchronous execution completes.
78 //----------------------------------------------------------------------------
79 
80 HRESULT D3DX11CompileFromFileA(LPCSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude,
81         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
82 		
83 HRESULT D3DX11CompileFromFileW(LPCWSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude,
84         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
85 
86 // TODO: make sure this matches phobos win32 style
87 alias D3DX11CompileFromFileW D3DX11CompileFromFile;
88 
89 
90 HRESULT D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
91     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
92 
93 HRESULT D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
94     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
95 
96 alias D3DX11CompileFromResourceW D3DX11CompileFromResource;
97 
98 
99 HRESULT D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
100     LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
101 	
102 HRESULT D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
103     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
104 
105 HRESULT D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
106     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
107 
108 HRESULT D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, 
109     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
110 	
111 HRESULT D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
112     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
113 
114 HRESULT D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, 
115     LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult);
116 
117 alias D3DX11PreprocessShaderFromFileW D3DX11PreprocessShaderFromFile;
118 alias D3DX11PreprocessShaderFromResourceW D3DX11PreprocessShaderFromResource;
119 
120 
121 //----------------------------------------------------------------------------
122 // Async processors
123 //----------------------------------------------------------------------------
124 
125 HRESULT D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
126         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2,
127         ID3D10Blob* ppCompiledShader, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor);
128 
129 HRESULT D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, 
130         ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor);
131 
132 //----------------------------------------------------------------------------
133 // D3DX11 Asynchronous texture I/O (advanced mode)
134 //----------------------------------------------------------------------------
135 
136 HRESULT D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader* ppDataLoader);
137 HRESULT D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader* ppDataLoader);
138 HRESULT D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader* ppDataLoader);
139 HRESULT D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader* ppDataLoader);
140 HRESULT D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader* ppDataLoader);
141 
142 alias D3DX11CreateAsyncFileLoaderW D3DX11CreateAsyncFileLoader;
143 alias D3DX11CreateAsyncResourceLoaderW D3DX11CreateAsyncResourceLoader;
144 
145 
146 HRESULT D3DX11CreateAsyncTextureProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor);
147 HRESULT D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO* pImageInfo, ID3DX11DataProcessor* ppDataProcessor);
148 HRESULT D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor);
149 
150 }