]> git.cworth.org Git - apitrace/blob - specs/d3d10effect.py
d3dretrace: Basic d3d10 support.
[apitrace] / specs / d3d10effect.py
1 ##########################################################################
2 #
3 # Copyright 2012 Jose Fonseca
4 # All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26
27 from d3d10 import *
28
29 from d3d10shader import *
30
31
32 ID3D10StateBlock = Interface("ID3D10StateBlock", IUnknown)
33 ID3D10EffectType = Interface("ID3D10EffectType")
34 ID3D10EffectVariable = Interface("ID3D10EffectVariable")
35 ID3D10EffectScalarVariable = Interface("ID3D10EffectScalarVariable", ID3D10EffectVariable)
36 ID3D10EffectVectorVariable = Interface("ID3D10EffectVectorVariable", ID3D10EffectVariable)
37 ID3D10EffectMatrixVariable = Interface("ID3D10EffectMatrixVariable", ID3D10EffectVariable)
38 ID3D10EffectStringVariable = Interface("ID3D10EffectStringVariable", ID3D10EffectVariable)
39 ID3D10EffectShaderResourceVariable = Interface("ID3D10EffectShaderResourceVariable", ID3D10EffectVariable)
40 ID3D10EffectRenderTargetViewVariable = Interface("ID3D10EffectRenderTargetViewVariable", ID3D10EffectVariable)
41 ID3D10EffectDepthStencilViewVariable = Interface("ID3D10EffectDepthStencilViewVariable", ID3D10EffectVariable)
42 ID3D10EffectConstantBuffer = Interface("ID3D10EffectConstantBuffer", ID3D10EffectVariable)
43 ID3D10EffectShaderVariable = Interface("ID3D10EffectShaderVariable", ID3D10EffectVariable)
44 ID3D10EffectBlendVariable = Interface("ID3D10EffectBlendVariable", ID3D10EffectVariable)
45 ID3D10EffectDepthStencilVariable = Interface("ID3D10EffectDepthStencilVariable", ID3D10EffectVariable)
46 ID3D10EffectRasterizerVariable = Interface("ID3D10EffectRasterizerVariable", ID3D10EffectVariable)
47 ID3D10EffectSamplerVariable = Interface("ID3D10EffectSamplerVariable", ID3D10EffectVariable)
48 ID3D10EffectPass = Interface("ID3D10EffectPass")
49 ID3D10EffectTechnique = Interface("ID3D10EffectTechnique")
50 ID3D10Effect = Interface("ID3D10Effect", IUnknown)
51 ID3D10EffectPool = Interface("ID3D10EffectPool", IUnknown)
52
53
54 D3D10_DEVICE_STATE_TYPES = Enum("D3D10_DEVICE_STATE_TYPES", [
55     "D3D10_DST_SO_BUFFERS",
56     "D3D10_DST_OM_RENDER_TARGETS",
57     "D3D10_DST_OM_DEPTH_STENCIL_STATE",
58     "D3D10_DST_OM_BLEND_STATE",
59     "D3D10_DST_VS",
60     "D3D10_DST_VS_SAMPLERS",
61     "D3D10_DST_VS_SHADER_RESOURCES",
62     "D3D10_DST_VS_CONSTANT_BUFFERS",
63     "D3D10_DST_GS",
64     "D3D10_DST_GS_SAMPLERS",
65     "D3D10_DST_GS_SHADER_RESOURCES",
66     "D3D10_DST_GS_CONSTANT_BUFFERS",
67     "D3D10_DST_PS",
68     "D3D10_DST_PS_SAMPLERS",
69     "D3D10_DST_PS_SHADER_RESOURCES",
70     "D3D10_DST_PS_CONSTANT_BUFFERS",
71     "D3D10_DST_IA_VERTEX_BUFFERS",
72     "D3D10_DST_IA_INDEX_BUFFER",
73     "D3D10_DST_IA_INPUT_LAYOUT",
74     "D3D10_DST_IA_PRIMITIVE_TOPOLOGY",
75     "D3D10_DST_RS_VIEWPORTS",
76     "D3D10_DST_RS_SCISSOR_RECTS",
77     "D3D10_DST_RS_RASTERIZER_STATE",
78     "D3D10_DST_PREDICATION",
79 ])
80
81 D3D10_STATE_BLOCK_MASK = Struct("D3D10_STATE_BLOCK_MASK", [
82     (BYTE, "VS"),
83     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "VSSamplers"),
84     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "VSShaderResources"),
85     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "VSConstantBuffers"),
86     (BYTE, "GS"),
87     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "GSSamplers"),
88     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "GSShaderResources"),
89     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "GSConstantBuffers"),
90     (BYTE, "PS"),
91     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)"), "PSSamplers"),
92     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)"), "PSShaderResources"),
93     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)"), "PSConstantBuffers"),
94     (Array(BYTE, "D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)"), "IAVertexBuffers"),
95     (BYTE, "IAIndexBuffer"),
96     (BYTE, "IAInputLayout"),
97     (BYTE, "IAPrimitiveTopology"),
98     (BYTE, "OMRenderTargets"),
99     (BYTE, "OMDepthStencilState"),
100     (BYTE, "OMBlendState"),
101     (BYTE, "RSViewports"),
102     (BYTE, "RSScissorRects"),
103     (BYTE, "RSRasterizerState"),
104     (BYTE, "SOBuffers"),
105     (BYTE, "Predication"),
106 ])
107
108 ID3D10StateBlock.methods += [
109     StdMethod(HRESULT, "Capture", []),
110     StdMethod(HRESULT, "Apply", []),
111     StdMethod(HRESULT, "ReleaseAllDeviceObjects", []),
112     StdMethod(HRESULT, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]),
113 ]
114
115 D3D10_EFFECT = Flags(UINT, [
116     "D3D10_EFFECT_COMPILE_CHILD_EFFECT",
117     "D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS",
118     "D3D10_EFFECT_SINGLE_THREADED",
119     "D3D10_EFFECT_VARIABLE_POOLED",
120     "D3D10_EFFECT_VARIABLE_ANNOTATION",
121     "D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT",
122 ])
123
124 D3D10_EFFECT_TYPE_DESC = Struct("D3D10_EFFECT_TYPE_DESC", [
125     (LPCSTR, "TypeName"),
126     (D3D10_SHADER_VARIABLE_CLASS, "Class"),
127     (D3D10_SHADER_VARIABLE_TYPE, "Type"),
128     (UINT, "Elements"),
129     (UINT, "Members"),
130     (UINT, "Rows"),
131     (UINT, "Columns"),
132     (UINT, "PackedSize"),
133     (UINT, "UnpackedSize"),
134     (UINT, "Stride"),
135 ])
136
137 ID3D10EffectType.methods += [
138     StdMethod(BOOL, "IsValid", []),
139     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_EFFECT_TYPE_DESC), "pDesc")]),
140     StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeByIndex", [(UINT, "Index")]),
141     StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeByName", [(LPCSTR, "Name")]),
142     StdMethod(ObjPointer(ID3D10EffectType), "GetMemberTypeBySemantic", [(LPCSTR, "Semantic")]),
143     StdMethod(LPCSTR, "GetMemberName", [(UINT, "Index")]),
144     StdMethod(LPCSTR, "GetMemberSemantic", [(UINT, "Index")]),
145 ]
146
147 D3D10_EFFECT_VARIABLE_DESC = Struct("D3D10_EFFECT_VARIABLE_DESC", [
148     (LPCSTR, "Name"),
149     (LPCSTR, "Semantic"),
150     (UINT, "Flags"),
151     (UINT, "Annotations"),
152     (UINT, "BufferOffset"),
153     (UINT, "ExplicitBindPoint"),
154 ])
155
156 ID3D10EffectVariable.methods += [
157     StdMethod(BOOL, "IsValid", []),
158     StdMethod(ObjPointer(ID3D10EffectType), "GetType", []),
159     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_EFFECT_VARIABLE_DESC), "pDesc")]),
160     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]),
161     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]),
162     StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberByIndex", [(UINT, "Index")]),
163     StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberByName", [(LPCSTR, "Name")]),
164     StdMethod(ObjPointer(ID3D10EffectVariable), "GetMemberBySemantic", [(LPCSTR, "Semantic")]),
165     StdMethod(ObjPointer(ID3D10EffectVariable), "GetElement", [(UINT, "Index")]),
166     StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetParentConstantBuffer", []),
167     StdMethod(ObjPointer(ID3D10EffectScalarVariable), "AsScalar", []),
168     StdMethod(ObjPointer(ID3D10EffectVectorVariable), "AsVector", []),
169     StdMethod(ObjPointer(ID3D10EffectMatrixVariable), "AsMatrix", []),
170     StdMethod(ObjPointer(ID3D10EffectStringVariable), "AsString", []),
171     StdMethod(ObjPointer(ID3D10EffectShaderResourceVariable), "AsShaderResource", []),
172     StdMethod(ObjPointer(ID3D10EffectRenderTargetViewVariable), "AsRenderTargetView", []),
173     StdMethod(ObjPointer(ID3D10EffectDepthStencilViewVariable), "AsDepthStencilView", []),
174     StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "AsConstantBuffer", []),
175     StdMethod(ObjPointer(ID3D10EffectShaderVariable), "AsShader", []),
176     StdMethod(ObjPointer(ID3D10EffectBlendVariable), "AsBlend", []),
177     StdMethod(ObjPointer(ID3D10EffectDepthStencilVariable), "AsDepthStencil", []),
178     StdMethod(ObjPointer(ID3D10EffectRasterizerVariable), "AsRasterizer", []),
179     StdMethod(ObjPointer(ID3D10EffectSamplerVariable), "AsSampler", []),
180     StdMethod(HRESULT, "SetRawValue", [(Blob(Void, "ByteCount"), "pData"), (UINT, "Offset"), (UINT, "ByteCount")]),
181     StdMethod(HRESULT, "GetRawValue", [Out(OpaqueBlob(Void, "ByteCount"), "pData"), (UINT, "Offset"), (UINT, "ByteCount")], sideeffects=False),
182 ]
183
184 ID3D10EffectScalarVariable.methods += [
185     StdMethod(HRESULT, "SetFloat", [(Float, "Value")]),
186     StdMethod(HRESULT, "GetFloat", [Out(Pointer(Float), "pValue")]),
187     StdMethod(HRESULT, "SetFloatArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
188     StdMethod(HRESULT, "GetFloatArray", [Out(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
189     StdMethod(HRESULT, "SetInt", [(Int, "Value")]),
190     StdMethod(HRESULT, "GetInt", [Out(Pointer(Int), "pValue")]),
191     StdMethod(HRESULT, "SetIntArray", [(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]),
192     StdMethod(HRESULT, "GetIntArray", [Out(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]),
193     StdMethod(HRESULT, "SetBool", [(BOOL, "Value")]),
194     StdMethod(HRESULT, "GetBool", [Out(Pointer(BOOL), "pValue")]),
195     StdMethod(HRESULT, "SetBoolArray", [(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]),
196     StdMethod(HRESULT, "GetBoolArray", [Out(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]),
197 ]
198
199 ID3D10EffectVectorVariable.methods += [
200     StdMethod(HRESULT, "SetBoolVector", [(Pointer(BOOL), "pData")]),
201     StdMethod(HRESULT, "SetIntVector", [(Pointer(Int), "pData")]),
202     StdMethod(HRESULT, "SetFloatVector", [(Pointer(Float), "pData")]),
203     StdMethod(HRESULT, "GetBoolVector", [Out(Pointer(BOOL), "pData")]),
204     StdMethod(HRESULT, "GetIntVector", [Out(Pointer(Int), "pData")]),
205     StdMethod(HRESULT, "GetFloatVector", [Out(Pointer(Float), "pData")]),
206     StdMethod(HRESULT, "SetBoolVectorArray", [(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]),
207     StdMethod(HRESULT, "SetIntVectorArray", [(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]),
208     StdMethod(HRESULT, "SetFloatVectorArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
209     StdMethod(HRESULT, "GetBoolVectorArray", [Out(Pointer(BOOL), "pData"), (UINT, "Offset"), (UINT, "Count")]),
210     StdMethod(HRESULT, "GetIntVectorArray", [Out(Pointer(Int), "pData"), (UINT, "Offset"), (UINT, "Count")]),
211     StdMethod(HRESULT, "GetFloatVectorArray", [Out(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
212 ]
213
214 ID3D10EffectMatrixVariable.methods += [
215     StdMethod(HRESULT, "SetMatrix", [(Pointer(Float), "pData")]),
216     StdMethod(HRESULT, "GetMatrix", [Out(Pointer(Float), "pData")]),
217     StdMethod(HRESULT, "SetMatrixArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
218     StdMethod(HRESULT, "GetMatrixArray", [Out(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
219     StdMethod(HRESULT, "SetMatrixTranspose", [(Pointer(Float), "pData")]),
220     StdMethod(HRESULT, "GetMatrixTranspose", [Out(Pointer(Float), "pData")]),
221     StdMethod(HRESULT, "SetMatrixTransposeArray", [(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
222     StdMethod(HRESULT, "GetMatrixTransposeArray", [Out(Pointer(Float), "pData"), (UINT, "Offset"), (UINT, "Count")]),
223 ]
224
225 ID3D10EffectStringVariable.methods += [
226     StdMethod(HRESULT, "GetString", [Out(Pointer(LPCSTR), "ppString")]),
227     StdMethod(HRESULT, "GetStringArray", [Out(Pointer(LPCSTR), "ppStrings"), (UINT, "Offset"), (UINT, "Count")]),
228 ]
229
230 ID3D10EffectShaderResourceVariable.methods += [
231     StdMethod(HRESULT, "SetResource", [(ObjPointer(ID3D10ShaderResourceView), "pResource")]),
232     StdMethod(HRESULT, "GetResource", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResource")]),
233     StdMethod(HRESULT, "SetResourceArray", [(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
234     StdMethod(HRESULT, "GetResourceArray", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
235 ]
236
237 ID3D10EffectRenderTargetViewVariable.methods += [
238     StdMethod(HRESULT, "SetRenderTarget", [(ObjPointer(ID3D10RenderTargetView), "pResource")]),
239     StdMethod(HRESULT, "GetRenderTarget", [Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResource")]),
240     StdMethod(HRESULT, "SetRenderTargetArray", [(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
241     StdMethod(HRESULT, "GetRenderTargetArray", [Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
242 ]
243
244 ID3D10EffectDepthStencilViewVariable.methods += [
245     StdMethod(HRESULT, "SetDepthStencil", [(ObjPointer(ID3D10DepthStencilView), "pResource")]),
246     StdMethod(HRESULT, "GetDepthStencil", [Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResource")]),
247     StdMethod(HRESULT, "SetDepthStencilArray", [(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
248     StdMethod(HRESULT, "GetDepthStencilArray", [Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppResources"), (UINT, "Offset"), (UINT, "Count")]),
249 ]
250
251 ID3D10EffectConstantBuffer.methods += [
252     StdMethod(HRESULT, "SetConstantBuffer", [(ObjPointer(ID3D10Buffer), "pConstantBuffer")]),
253     StdMethod(HRESULT, "GetConstantBuffer", [Out(Pointer(ObjPointer(ID3D10Buffer)), "ppConstantBuffer")]),
254     StdMethod(HRESULT, "SetTextureBuffer", [(ObjPointer(ID3D10ShaderResourceView), "pTextureBuffer")]),
255     StdMethod(HRESULT, "GetTextureBuffer", [Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppTextureBuffer")]),
256 ]
257
258 D3D10_EFFECT_SHADER_DESC = Struct("D3D10_EFFECT_SHADER_DESC", [
259     (Pointer(Const(BYTE)), "pInputSignature"),
260     (BOOL, "IsInline"),
261     (Pointer(Const(BYTE)), "pBytecode"),
262     (UINT, "BytecodeLength"),
263     (LPCSTR, "SODecl"),
264     (UINT, "NumInputSignatureEntries"),
265     (UINT, "NumOutputSignatureEntries"),
266 ])
267
268 ID3D10EffectShaderVariable.methods += [
269     StdMethod(HRESULT, "GetShaderDesc", [(UINT, "ShaderIndex"), Out(Pointer(D3D10_EFFECT_SHADER_DESC), "pDesc")]),
270     StdMethod(HRESULT, "GetVertexShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVS")]),
271     StdMethod(HRESULT, "GetGeometryShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGS")]),
272     StdMethod(HRESULT, "GetPixelShader", [(UINT, "ShaderIndex"), Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPS")]),
273     StdMethod(HRESULT, "GetInputSignatureElementDesc", [(UINT, "ShaderIndex"), (UINT, "Element"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]),
274     StdMethod(HRESULT, "GetOutputSignatureElementDesc", [(UINT, "ShaderIndex"), (UINT, "Element"), Out(Pointer(D3D10_SIGNATURE_PARAMETER_DESC), "pDesc")]),
275 ]
276
277 ID3D10EffectBlendVariable.methods += [
278     StdMethod(HRESULT, "GetBlendState", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState")]),
279     StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_BLEND_DESC), "pBlendDesc")]),
280 ]
281
282 ID3D10EffectDepthStencilVariable.methods += [
283     StdMethod(HRESULT, "GetDepthStencilState", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState")]),
284     StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_DEPTH_STENCIL_DESC), "pDepthStencilDesc")]),
285 ]
286
287 ID3D10EffectRasterizerVariable.methods += [
288     StdMethod(HRESULT, "GetRasterizerState", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]),
289     StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_RASTERIZER_DESC), "pRasterizerDesc")]),
290 ]
291
292 ID3D10EffectSamplerVariable.methods += [
293     StdMethod(HRESULT, "GetSampler", [(UINT, "Index"), Out(Pointer(ObjPointer(ID3D10SamplerState)), "ppSampler")]),
294     StdMethod(HRESULT, "GetBackingStore", [(UINT, "Index"), Out(Pointer(D3D10_SAMPLER_DESC), "pSamplerDesc")]),
295 ]
296
297 D3D10_PASS_DESC = Struct("D3D10_PASS_DESC", [
298     (LPCSTR, "Name"),
299     (UINT, "Annotations"),
300     (Pointer(BYTE), "pIAInputSignature"),
301     (SIZE_T, "IAInputSignatureSize"),
302     (UINT, "StencilRef"),
303     (UINT, "SampleMask"),
304     (Array(FLOAT, 4), "BlendFactor"),
305 ])
306
307 D3D10_PASS_SHADER_DESC = Struct("D3D10_PASS_SHADER_DESC", [
308     (ObjPointer(ID3D10EffectShaderVariable), "pShaderVariable"),
309     (UINT, "ShaderIndex"),
310 ])
311
312 ID3D10EffectPass.methods += [
313     StdMethod(BOOL, "IsValid", []),
314     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_PASS_DESC), "pDesc")]),
315     StdMethod(HRESULT, "GetVertexShaderDesc", [Out(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]),
316     StdMethod(HRESULT, "GetGeometryShaderDesc", [Out(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]),
317     StdMethod(HRESULT, "GetPixelShaderDesc", [Out(Pointer(D3D10_PASS_SHADER_DESC), "pDesc")]),
318     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]),
319     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]),
320     StdMethod(HRESULT, "Apply", [(UINT, "Flags")]),
321     StdMethod(HRESULT, "ComputeStateBlockMask", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask")]),
322 ]
323
324 D3D10_TECHNIQUE_DESC = Struct("D3D10_TECHNIQUE_DESC", [
325     (LPCSTR, "Name"),
326     (UINT, "Passes"),
327     (UINT, "Annotations"),
328 ])
329
330 ID3D10EffectTechnique.methods += [
331     StdMethod(BOOL, "IsValid", []),
332     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_TECHNIQUE_DESC), "pDesc")]),
333     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByIndex", [(UINT, "Index")]),
334     StdMethod(ObjPointer(ID3D10EffectVariable), "GetAnnotationByName", [(LPCSTR, "Name")]),
335     StdMethod(ObjPointer(ID3D10EffectPass), "GetPassByIndex", [(UINT, "Index")]),
336     StdMethod(ObjPointer(ID3D10EffectPass), "GetPassByName", [(LPCSTR, "Name")]),
337     StdMethod(HRESULT, "ComputeStateBlockMask", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask")]),
338 ]
339
340 D3D10_EFFECT_DESC = Struct("D3D10_EFFECT_DESC", [
341     (BOOL, "IsChildEffect"),
342     (UINT, "ConstantBuffers"),
343     (UINT, "SharedConstantBuffers"),
344     (UINT, "GlobalVariables"),
345     (UINT, "SharedGlobalVariables"),
346     (UINT, "Techniques"),
347 ])
348
349 ID3D10Effect.methods += [
350     StdMethod(BOOL, "IsValid", []),
351     StdMethod(BOOL, "IsPool", []),
352     StdMethod(HRESULT, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]),
353     StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3D10_EFFECT_DESC), "pDesc")]),
354     StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetConstantBufferByIndex", [(UINT, "Index")]),
355     StdMethod(ObjPointer(ID3D10EffectConstantBuffer), "GetConstantBufferByName", [(LPCSTR, "Name")]),
356     StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableByIndex", [(UINT, "Index")]),
357     StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableByName", [(LPCSTR, "Name")]),
358     StdMethod(ObjPointer(ID3D10EffectVariable), "GetVariableBySemantic", [(LPCSTR, "Semantic")]),
359     StdMethod(ObjPointer(ID3D10EffectTechnique), "GetTechniqueByIndex", [(UINT, "Index")]),
360     StdMethod(ObjPointer(ID3D10EffectTechnique), "GetTechniqueByName", [(LPCSTR, "Name")]),
361     StdMethod(HRESULT, "Optimize", []),
362     StdMethod(BOOL, "IsOptimized", []),
363 ]
364
365 ID3D10EffectPool.methods += [
366     StdMethod(ObjPointer(ID3D10Effect), "AsEffect", []),
367 ]
368
369
370 d3d10.addFunctions([
371     StdFunction(HRESULT, "D3D10StateBlockMaskUnion", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]),
372     StdFunction(HRESULT, "D3D10StateBlockMaskIntersect", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]),
373     StdFunction(HRESULT, "D3D10StateBlockMaskDifference", [(Pointer(D3D10_STATE_BLOCK_MASK), "pA"), (Pointer(D3D10_STATE_BLOCK_MASK), "pB"), Out(Pointer(D3D10_STATE_BLOCK_MASK), "pResult")]),
374     StdFunction(HRESULT, "D3D10StateBlockMaskEnableCapture", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "RangeStart"), (UINT, "RangeLength")]),
375     StdFunction(HRESULT, "D3D10StateBlockMaskDisableCapture", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "RangeStart"), (UINT, "RangeLength")]),
376     StdFunction(HRESULT, "D3D10StateBlockMaskEnableAll", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask")]),
377     StdFunction(HRESULT, "D3D10StateBlockMaskDisableAll", [Out(Pointer(D3D10_STATE_BLOCK_MASK), "pMask")]),
378     StdFunction(BOOL, "D3D10StateBlockMaskGetSetting", [(Pointer(D3D10_STATE_BLOCK_MASK), "pMask"), (D3D10_DEVICE_STATE_TYPES, "StateType"), (UINT, "Entry")]),
379     StdFunction(HRESULT, "D3D10CreateStateBlock", [(ObjPointer(ID3D10Device), "pDevice"), (Pointer(D3D10_STATE_BLOCK_MASK), "pStateBlockMask"), Out(Pointer(ObjPointer(ID3D10StateBlock)), "ppStateBlock")]),
380     StdFunction(HRESULT, "D3D10CompileEffectFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (LPCSTR, "pSrcFileName"), (Pointer(Const(D3D10_SHADER_MACRO)), "pDefines"), (LPD3D10INCLUDE, "pInclude"), (UINT, "HLSLFlags"), (UINT, "FXFlags"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppCompiledEffect"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppErrors")]),
381     StdFunction(HRESULT, "D3D10CreateEffectFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (UINT, "FXFlags"), (ObjPointer(ID3D10Device), "pDevice"), (ObjPointer(ID3D10EffectPool), "pEffectPool"), Out(Pointer(ObjPointer(ID3D10Effect)), "ppEffect")]),
382     StdFunction(HRESULT, "D3D10CreateEffectPoolFromMemory", [(OpaquePointer(Void), "pData"), (SIZE_T, "DataLength"), (UINT, "FXFlags"), (ObjPointer(ID3D10Device), "pDevice"), Out(Pointer(ObjPointer(ID3D10EffectPool)), "ppEffectPool")]),
383     StdFunction(HRESULT, "D3D10DisassembleEffect", [(ObjPointer(ID3D10Effect), "pEffect"), (BOOL, "EnableColorCode"), Out(Pointer(ObjPointer(ID3D10Blob)), "ppDisassembly")]),
384 ])