1
|
1 /***********************************************************************\
|
|
2 * d3d10shader.d *
|
|
3 * *
|
|
4 * Windows API header module *
|
|
5 * *
|
|
6 * Placed into public domain *
|
|
7 \***********************************************************************/
|
|
8 module win32.directx.d3d10shader;
|
|
9
|
|
10 private import win32.windows;
|
|
11 private import win32.directx.d3d10;
|
|
12
|
|
13 // some forward references...
|
|
14 enum D3D10_PRIMITIVE_TOPOLOGY;
|
|
15 enum D3D10_SRV_DIMENSION;
|
|
16
|
|
17 uint D3D10_TX_VERSION(uint _Major, uint _Minor) {
|
|
18 return ('T' << 24) | ('X' << 16) | (_Major << 8) | _Minor;
|
|
19 }
|
|
20
|
|
21 const D3D10_SHADER_DEBUG = 1 << 0;
|
|
22 const D3D10_SHADER_SKIP_VALIDATION = 1 << 1;
|
|
23 const D3D10_SHADER_SKIP_OPTIMIZATION = 1 << 2;
|
|
24 const D3D10_SHADER_PACK_MATRIX_ROW_MAJOR = 1 << 3;
|
|
25 const D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR = 1 << 4;
|
|
26 const D3D10_SHADER_PARTIAL_PRECISION = 1 << 5;
|
|
27 const D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT = 1 << 6;
|
|
28 const D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT = 1 << 7;
|
|
29 const D3D10_SHADER_NO_PRESHADER = 1 << 8;
|
|
30 const D3D10_SHADER_AVOID_FLOW_CONTROL = 1 << 9;
|
|
31 const D3D10_SHADER_PREFER_FLOW_CONTROL = 1 << 10;
|
|
32 const D3D10_SHADER_ENABLE_STRICTNESS = 1 << 11;
|
|
33 const D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY = 1 << 12;
|
|
34 const D3D10_SHADER_IEEE_STRICTNESS = 1 << 13;
|
|
35 const D3D10_SHADER_OPTIMIZATION_LEVEL0 = 1 << 14;
|
|
36 const D3D10_SHADER_OPTIMIZATION_LEVEL1 = 0;
|
|
37 const D3D10_SHADER_OPTIMIZATION_LEVEL2 = (1 << 14) | (1 << 15);
|
|
38 const D3D10_SHADER_OPTIMIZATION_LEVEL3 = 1 << 15;
|
|
39
|
|
40 struct D3D10_SHADER_MACRO {
|
|
41 LPCSTR Name;
|
|
42 LPCSTR Definition;
|
|
43 }
|
|
44
|
|
45 enum D3D10_SHADER_VARIABLE_CLASS {
|
|
46 D3D10_SVC_SCALAR,
|
|
47 D3D10_SVC_VECTOR,
|
|
48 D3D10_SVC_MATRIX_ROWS,
|
|
49 D3D10_SVC_MATRIX_COLUMNS,
|
|
50 D3D10_SVC_OBJECT,
|
|
51 D3D10_SVC_STRUCT,
|
|
52 D3D10_SVC_FORCE_DWORD = 0x7fffffff
|
|
53 }
|
|
54
|
|
55 enum D3D10_SHADER_VARIABLE_FLAGS {
|
|
56 D3D10_SVF_USERPACKED = 1,
|
|
57 D3D10_SVF_USED = 2,
|
|
58 D3D10_SVF_FORCE_DWORD = 0x7fffffff
|
|
59 }
|
|
60
|
|
61 enum D3D10_SHADER_VARIABLE_TYPE {
|
|
62 D3D10_SVT_VOID = 0,
|
|
63 D3D10_SVT_BOOL = 1,
|
|
64 D3D10_SVT_INT = 2,
|
|
65 D3D10_SVT_FLOAT = 3,
|
|
66 D3D10_SVT_STRING = 4,
|
|
67 D3D10_SVT_TEXTURE = 5,
|
|
68 D3D10_SVT_TEXTURE1D = 6,
|
|
69 D3D10_SVT_TEXTURE2D = 7,
|
|
70 D3D10_SVT_TEXTURE3D = 8,
|
|
71 D3D10_SVT_TEXTURECUBE = 9,
|
|
72 D3D10_SVT_SAMPLER = 10,
|
|
73 D3D10_SVT_PIXELSHADER = 15,
|
|
74 D3D10_SVT_VERTEXSHADER = 16,
|
|
75 D3D10_SVT_UINT = 19,
|
|
76 D3D10_SVT_UINT8 = 20,
|
|
77 D3D10_SVT_GEOMETRYSHADER = 21,
|
|
78 D3D10_SVT_RASTERIZER = 22,
|
|
79 D3D10_SVT_DEPTHSTENCIL = 23,
|
|
80 D3D10_SVT_BLEND = 24,
|
|
81 D3D10_SVT_BUFFER = 25,
|
|
82 D3D10_SVT_CBUFFER = 26,
|
|
83 D3D10_SVT_TBUFFER = 27,
|
|
84 D3D10_SVT_TEXTURE1DARRAY = 28,
|
|
85 D3D10_SVT_TEXTURE2DARRAY = 29,
|
|
86 D3D10_SVT_RENDERTARGETVIEW = 30,
|
|
87 D3D10_SVT_DEPTHSTENCILVIEW = 31,
|
|
88 D3D10_SVT_TEXTURE2DMS = 32,
|
|
89 D3D10_SVT_TEXTURE2DMSARRAY = 33,
|
|
90 D3D10_SVT_TEXTURECUBEARRAY = 34,
|
|
91 D3D10_SVT_FORCE_DWORD = 0x7fffffff
|
|
92 }
|
|
93
|
|
94 enum D3D10_SHADER_INPUT_FLAGS {
|
|
95 D3D10_SIF_USERPACKED = 1,
|
|
96 D3D10_SIF_COMPARISON_SAMPLER = 2,
|
|
97 D3D10_SIF_TEXTURE_COMPONENT_0 = 4,
|
|
98 D3D10_SIF_TEXTURE_COMPONENT_1 = 8,
|
|
99 D3D10_SIF_TEXTURE_COMPONENTS = 12,
|
|
100 D3D10_SIF_FORCE_DWORD = 0x7fffffff
|
|
101 }
|
|
102
|
|
103 enum D3D10_SHADER_INPUT_TYPE {
|
|
104 D3D10_SIT_CBUFFER,
|
|
105 D3D10_SIT_TBUFFER,
|
|
106 D3D10_SIT_TEXTURE,
|
|
107 D3D10_SIT_SAMPLER
|
|
108 }
|
|
109
|
|
110 enum D3D10_SHADER_CBUFFER_FLAGS {
|
|
111 D3D10_CBF_USERPACKED = 1,
|
|
112 D3D10_CBF_FORCE_DWORD = 0x7fffffff
|
|
113 }
|
|
114
|
|
115 enum D3D10_CBUFFER_TYPE {
|
|
116 D3D10_CT_CBUFFER,
|
|
117 D3D10_CT_TBUFFER
|
|
118 }
|
|
119
|
|
120 enum D3D10_NAME {
|
|
121 D3D10_NAME_UNDEFINED = 0,
|
|
122 D3D10_NAME_POSITION = 1,
|
|
123 D3D10_NAME_CLIP_DISTANCE = 2,
|
|
124 D3D10_NAME_CULL_DISTANCE = 3,
|
|
125 D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
|
|
126 D3D10_NAME_VIEWPORT_ARRAY_INDEX = 5,
|
|
127 D3D10_NAME_VERTEX_ID = 6,
|
|
128 D3D10_NAME_PRIMITIVE_ID = 7,
|
|
129 D3D10_NAME_INSTANCE_ID = 8,
|
|
130 D3D10_NAME_IS_FRONT_FACE = 9,
|
|
131 D3D10_NAME_SAMPLE_INDEX = 10,
|
|
132 D3D10_NAME_TARGET = 64,
|
|
133 D3D10_NAME_DEPTH = 65,
|
|
134 D3D10_NAME_COVERAGE = 66
|
|
135 }
|
|
136
|
|
137 enum D3D10_RESOURCE_RETURN_TYPE {
|
|
138 D3D10_RETURN_TYPE_UNORM = 1,
|
|
139 D3D10_RETURN_TYPE_SNORM,
|
|
140 D3D10_RETURN_TYPE_SINT,
|
|
141 D3D10_RETURN_TYPE_UINT,
|
|
142 D3D10_RETURN_TYPE_FLOAT,
|
|
143 D3D10_RETURN_TYPE_MIXED
|
|
144 }
|
|
145
|
|
146 enum D3D10_REGISTER_COMPONENT_TYPE {
|
|
147 D3D10_REGISTER_COMPONENT_UNKNOWN = 0,
|
|
148 D3D10_REGISTER_COMPONENT_UINT32,
|
|
149 D3D10_REGISTER_COMPONENT_SINT32,
|
|
150 D3D10_REGISTER_COMPONENT_FLOAT32
|
|
151 }
|
|
152
|
|
153 enum D3D10_INCLUDE_TYPE {
|
|
154 D3D10_INCLUDE_LOCAL,
|
|
155 D3D10_INCLUDE_SYSTEM,
|
|
156 D3D10_INCLUDE_FORCE_DWORD = 0x7fffffff
|
|
157 }
|
|
158
|
|
159 interface ID3D10Include {
|
|
160 /* TODO: fix vtbl[0] bug
|
|
161 extern(Windows) :
|
|
162 HRESULT Open(D3D10_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID* ppData, UINT* pBytes);
|
|
163 HRESULT Close(LPCVOID pData);
|
|
164 */
|
|
165 }
|
|
166
|
|
167 struct D3D10_SHADER_DESC {
|
|
168 UINT Version;
|
|
169 LPCSTR Creator;
|
|
170 UINT Flags;
|
|
171 UINT ConstantBuffers;
|
|
172 UINT BoundResources;
|
|
173 UINT InputParameters;
|
|
174 UINT OutputParameters;
|
|
175 UINT InstructionCount;
|
|
176 UINT TempRegisterCount;
|
|
177 UINT TempArrayCount;
|
|
178 UINT DefCount;
|
|
179 UINT DclCount;
|
|
180 UINT TextureNormalInstructions;
|
|
181 UINT TextureLoadInstructions;
|
|
182 UINT TextureCompInstructions;
|
|
183 UINT TextureBiasInstructions;
|
|
184 UINT TextureGradientInstructions;
|
|
185 UINT FloatInstructionCount;
|
|
186 UINT IntInstructionCount;
|
|
187 UINT UintInstructionCount;
|
|
188 UINT StaticFlowControlCount;
|
|
189 UINT DynamicFlowControlCount;
|
|
190 UINT MacroInstructionCount;
|
|
191 UINT ArrayInstructionCount;
|
|
192 UINT CutInstructionCount;
|
|
193 UINT EmitInstructionCount;
|
|
194 D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology;
|
|
195 UINT GSMaxOutputVertexCount;
|
|
196 }
|
|
197
|
|
198 struct D3D10_SHADER_BUFFER_DESC {
|
|
199 LPCSTR Name;
|
|
200 D3D10_CBUFFER_TYPE Type;
|
|
201 UINT Variables;
|
|
202 UINT Size;
|
|
203 UINT uFlags;
|
|
204 }
|
|
205
|
|
206 struct D3D10_SHADER_VARIABLE_DESC {
|
|
207 LPCSTR Name;
|
|
208 UINT StartOffset;
|
|
209 UINT Size;
|
|
210 UINT uFlags;
|
|
211 LPVOID DefaultValue;
|
|
212 }
|
|
213
|
|
214 struct D3D10_SHADER_TYPE_DESC {
|
|
215 D3D10_SHADER_VARIABLE_CLASS Class;
|
|
216 D3D10_SHADER_VARIABLE_TYPE Type;
|
|
217 UINT Rows;
|
|
218 UINT Columns;
|
|
219 UINT Elements;
|
|
220 UINT Members;
|
|
221 UINT Offset;
|
|
222 }
|
|
223
|
|
224 struct D3D10_SHADER_INPUT_BIND_DESC {
|
|
225 LPCSTR Name;
|
|
226 D3D10_SHADER_INPUT_TYPE Type;
|
|
227 UINT BindPoint;
|
|
228 UINT BindCount;
|
|
229 UINT uFlags;
|
|
230 D3D10_RESOURCE_RETURN_TYPE ReturnType;
|
|
231 D3D10_SRV_DIMENSION Dimension;
|
|
232 UINT NumSamples;
|
|
233 }
|
|
234
|
|
235 struct D3D10_SIGNATURE_PARAMETER_DESC {
|
|
236 LPCSTR SemanticName;
|
|
237 UINT SemanticIndex;
|
|
238 UINT Register;
|
|
239 D3D10_NAME SystemValueType;
|
|
240 D3D10_REGISTER_COMPONENT_TYPE ComponentType;
|
|
241 BYTE Mask;
|
|
242 BYTE ReadWriteMask;
|
|
243 }
|
|
244
|
|
245 extern(C) const GUID IID_ID3D10ShaderReflectionType = {0xc530ad7d, 0x9b16, 0x4395, [0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd]};
|
|
246
|
|
247 interface ID3D10ShaderReflectionType {
|
|
248 /* TODO: fix vtbl[0] bug
|
|
249 extern(Windows) :
|
|
250 HRESULT GetDesc(D3D10_SHADER_TYPE_DESC* pDesc);
|
|
251 ID3D10ShaderReflectionType* GetMemberTypeByIndex(UINT Index);
|
|
252 ID3D10ShaderReflectionType* GetMemberTypeByName(LPCSTR Name);
|
|
253 LPCSTR GetMemberTypeName(UINT Index);
|
|
254 */
|
|
255 }
|
|
256
|
|
257 extern(C) const GUID IID_ID3D10ShaderReflectionVariable = {0x1bf63c95, 0x2650, 0x405d, [0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1]};
|
|
258
|
|
259 interface ID3D10ShaderReflectionVariable {
|
|
260 /* TODO: fix vtbl[0] bug
|
|
261 extern(Windows) :
|
|
262 HRESULT GetDesc(D3D10_SHADER_VARIABLE_DESC* pDesc);
|
|
263 ID3D10ShaderReflectionType* GetType();
|
|
264 */
|
|
265 }
|
|
266
|
|
267 extern(C) const GUID IID_ID3D10ShaderReflectionConstantBuffer = {0x66c66a94, 0xdddd, 0x4b62, [0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0]};
|
|
268
|
|
269 interface ID3D10ShaderReflectionConstantBuffer {
|
|
270 /* TODO: fix vtbl[0] bug
|
|
271 extern(Windows) :
|
|
272 HRESULT GetDesc(D3D10_SHADER_BUFFER_DESC* pDesc);
|
|
273 ID3D10ShaderReflectionVariable* GetVariableByIndex(UINT Index);
|
|
274 ID3D10ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
|
|
275 */
|
|
276 }
|
|
277
|
|
278 extern(C) const GUID IID_ID3D10ShaderReflection = {0xd40e20b6, 0xf8f7, 0x42ad, [0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa]};
|
|
279
|
|
280 interface ID3D10ShaderReflection : IUnknown {
|
|
281 extern(Windows) :
|
|
282 HRESULT QueryInterface(REFIID iid, LPVOID* ppv);
|
|
283 ULONG AddRef();
|
|
284 ULONG Release();
|
|
285 HRESULT GetDesc(D3D10_SHADER_DESC* pDesc);
|
|
286 ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByIndex(UINT Index);
|
|
287 ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByName(LPCSTR Name);
|
|
288 HRESULT GetResourceBindingDesc(UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC* pDesc);
|
|
289 HRESULT GetInputParameterDesc(UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC* pDesc);
|
|
290 HRESULT GetOutputParameterDesc(UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC* pDesc);
|
|
291 }
|
|
292
|
|
293 HRESULT D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, D3D10_SHADER_MACRO* pDefines, ID3D10Include pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs);
|
|
294 HRESULT D3D10DisassembleShader(void* pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob* ppDisassembly);
|
|
295 LPCSTR D3D10GetPixelShaderProfile(ID3D10Device pDevice);
|
|
296 LPCSTR D3D10GetVertexShaderProfile(ID3D10Device pDevice);
|
|
297 LPCSTR D3D10GetGeometryShaderProfile(ID3D10Device pDevice);
|
|
298 HRESULT D3D10ReflectShader(void* pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection* ppReflector);
|
|
299 HRESULT D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, D3D10_SHADER_MACRO* pDefines, ID3D10Include pInclude, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs);
|
|
300 HRESULT D3D10GetInputSignatureBlob(void* pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob* ppSignatureBlob);
|
|
301 HRESULT D3D10GetOutputSignatureBlob(void* pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob* ppSignatureBlob);
|
|
302 HRESULT D3D10GetInputAndOutputSignatureBlob(void* pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob* ppSignatureBlob);
|
|
303 HRESULT D3D10GetShaderDebugInfo(void* pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob* ppDebugInfo);
|
|
304
|