]> git.cworth.org Git - apitrace/blob - specs/d3d10.py
Use skiplist-based FastCallSet within trace::CallSet
[apitrace] / specs / d3d10.py
1 ##########################################################################
2 #
3 # Copyright 2011 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 dxgi import *
28 from d3dcommon import *
29
30
31 HRESULT = MAKE_HRESULT([
32     "D3D10_ERROR_FILE_NOT_FOUND",
33     "D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS",
34     "D3DERR_INVALIDCALL",
35     "D3DERR_WASSTILLDRAWING",
36 ])
37
38 D3D10_BLEND = Enum("D3D10_BLEND", [
39     "D3D10_BLEND_ZERO",
40     "D3D10_BLEND_ONE",
41     "D3D10_BLEND_SRC_COLOR",
42     "D3D10_BLEND_INV_SRC_COLOR",
43     "D3D10_BLEND_SRC_ALPHA",
44     "D3D10_BLEND_INV_SRC_ALPHA",
45     "D3D10_BLEND_DEST_ALPHA",
46     "D3D10_BLEND_INV_DEST_ALPHA",
47     "D3D10_BLEND_DEST_COLOR",
48     "D3D10_BLEND_INV_DEST_COLOR",
49     "D3D10_BLEND_SRC_ALPHA_SAT",
50     "D3D10_BLEND_BLEND_FACTOR",
51     "D3D10_BLEND_INV_BLEND_FACTOR",
52     "D3D10_BLEND_SRC1_COLOR",
53     "D3D10_BLEND_INV_SRC1_COLOR",
54     "D3D10_BLEND_SRC1_ALPHA",
55     "D3D10_BLEND_INV_SRC1_ALPHA",
56 ])
57
58 D3D10_BLEND_OP = Enum("D3D10_BLEND_OP", [
59     "D3D10_BLEND_OP_ADD",
60     "D3D10_BLEND_OP_SUBTRACT",
61     "D3D10_BLEND_OP_REV_SUBTRACT",
62     "D3D10_BLEND_OP_MIN",
63     "D3D10_BLEND_OP_MAX",
64 ])
65
66 D3D10_BLEND_DESC = Struct("D3D10_BLEND_DESC", [
67     (BOOL, "AlphaToCoverageEnable"),
68     (Array(BOOL, 8), "BlendEnable"),
69     (D3D10_BLEND, "SrcBlend"),
70     (D3D10_BLEND, "DestBlend"),
71     (D3D10_BLEND_OP, "BlendOp"),
72     (D3D10_BLEND, "SrcBlendAlpha"),
73     (D3D10_BLEND, "DestBlendAlpha"),
74     (D3D10_BLEND_OP, "BlendOpAlpha"),
75     (Array(UINT8, 8), "RenderTargetWriteMask"),
76 ])
77
78 D3D10_DEPTH_WRITE_MASK = Enum("D3D10_DEPTH_WRITE_MASK", [
79     "D3D10_DEPTH_WRITE_MASK_ZERO",
80     "D3D10_DEPTH_WRITE_MASK_ALL",
81 ])
82
83 D3D10_COMPARISON_FUNC = Enum("D3D10_COMPARISON_FUNC", [
84     "D3D10_COMPARISON_NEVER",
85     "D3D10_COMPARISON_LESS",
86     "D3D10_COMPARISON_EQUAL",
87     "D3D10_COMPARISON_LESS_EQUAL",
88     "D3D10_COMPARISON_GREATER",
89     "D3D10_COMPARISON_NOT_EQUAL",
90     "D3D10_COMPARISON_GREATER_EQUAL",
91     "D3D10_COMPARISON_ALWAYS",
92 ])
93
94 D3D10_STENCIL_OP = Enum("D3D10_STENCIL_OP", [
95     "D3D10_STENCIL_OP_KEEP",
96     "D3D10_STENCIL_OP_ZERO",
97     "D3D10_STENCIL_OP_REPLACE",
98     "D3D10_STENCIL_OP_INCR_SAT",
99     "D3D10_STENCIL_OP_DECR_SAT",
100     "D3D10_STENCIL_OP_INVERT",
101     "D3D10_STENCIL_OP_INCR",
102     "D3D10_STENCIL_OP_DECR",
103 ])
104
105 D3D10_DEPTH_STENCILOP_DESC = Struct("D3D10_DEPTH_STENCILOP_DESC", [
106     (D3D10_STENCIL_OP, "StencilFailOp"),
107     (D3D10_STENCIL_OP, "StencilDepthFailOp"),
108     (D3D10_STENCIL_OP, "StencilPassOp"),
109     (D3D10_COMPARISON_FUNC, "StencilFunc"),
110 ])
111
112 D3D10_DEPTH_STENCIL_DESC = Struct("D3D10_DEPTH_STENCIL_DESC", [
113     (BOOL, "DepthEnable"),
114     (D3D10_DEPTH_WRITE_MASK, "DepthWriteMask"),
115     (D3D10_COMPARISON_FUNC, "DepthFunc"),
116     (BOOL, "StencilEnable"),
117     (UINT8, "StencilReadMask"),
118     (UINT8, "StencilWriteMask"),
119     (D3D10_DEPTH_STENCILOP_DESC, "FrontFace"),
120     (D3D10_DEPTH_STENCILOP_DESC, "BackFace"),
121 ])
122
123 D3D10_FILL_MODE = Enum("D3D10_FILL_MODE", [
124     "D3D10_FILL_WIREFRAME",
125     "D3D10_FILL_SOLID",
126 ])
127
128 D3D10_CULL_MODE = Enum("D3D10_CULL_MODE", [
129     "D3D10_CULL_NONE",
130     "D3D10_CULL_FRONT",
131     "D3D10_CULL_BACK",
132 ])
133
134 D3D10_RASTERIZER_DESC = Struct("D3D10_RASTERIZER_DESC", [
135     (D3D10_FILL_MODE, "FillMode"),
136     (D3D10_CULL_MODE, "CullMode"),
137     (BOOL, "FrontCounterClockwise"),
138     (INT, "DepthBias"),
139     (FLOAT, "DepthBiasClamp"),
140     (FLOAT, "SlopeScaledDepthBias"),
141     (BOOL, "DepthClipEnable"),
142     (BOOL, "ScissorEnable"),
143     (BOOL, "MultisampleEnable"),
144     (BOOL, "AntialiasedLineEnable"),
145 ])
146
147 D3D10_FILTER = Enum("D3D10_FILTER", [
148     "D3D10_FILTER_MIN_MAG_MIP_POINT",
149     "D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR",
150     "D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT",
151     "D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR",
152     "D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT",
153     "D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR",
154     "D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT",
155     "D3D10_FILTER_MIN_MAG_MIP_LINEAR",
156     "D3D10_FILTER_ANISOTROPIC",
157     "D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT",
158     "D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR",
159     "D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT",
160     "D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR",
161     "D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT",
162     "D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR",
163     "D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT",
164     "D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR",
165     "D3D10_FILTER_COMPARISON_ANISOTROPIC",
166     "D3D10_FILTER_TEXT_1BIT",
167 ])
168
169 D3D10_TEXTURE_ADDRESS_MODE = Enum("D3D10_TEXTURE_ADDRESS_MODE", [
170     "D3D10_TEXTURE_ADDRESS_WRAP",
171     "D3D10_TEXTURE_ADDRESS_MIRROR",
172     "D3D10_TEXTURE_ADDRESS_CLAMP",
173     "D3D10_TEXTURE_ADDRESS_BORDER",
174     "D3D10_TEXTURE_ADDRESS_MIRROR_ONCE",
175 ])
176
177 D3D10_SAMPLER_DESC = Struct("D3D10_SAMPLER_DESC", [
178     (D3D10_FILTER, "Filter"),
179     (D3D10_TEXTURE_ADDRESS_MODE, "AddressU"),
180     (D3D10_TEXTURE_ADDRESS_MODE, "AddressV"),
181     (D3D10_TEXTURE_ADDRESS_MODE, "AddressW"),
182     (FLOAT, "MipLODBias"),
183     (UINT, "MaxAnisotropy"),
184     (D3D10_COMPARISON_FUNC, "ComparisonFunc"),
185     (Array(FLOAT, 4), "BorderColor"),
186     (FLOAT, "MinLOD"),
187     (FLOAT, "MaxLOD"),
188 ])
189
190 D3D10_FORMAT_SUPPORT = Flags(UINT, [
191     "D3D10_FORMAT_SUPPORT_BUFFER",
192     "D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER",
193     "D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER",
194     "D3D10_FORMAT_SUPPORT_SO_BUFFER",
195     "D3D10_FORMAT_SUPPORT_TEXTURE1D",
196     "D3D10_FORMAT_SUPPORT_TEXTURE2D",
197     "D3D10_FORMAT_SUPPORT_TEXTURE3D",
198     "D3D10_FORMAT_SUPPORT_TEXTURECUBE",
199     "D3D10_FORMAT_SUPPORT_SHADER_LOAD",
200     "D3D10_FORMAT_SUPPORT_SHADER_SAMPLE",
201     "D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON",
202     "D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT",
203     "D3D10_FORMAT_SUPPORT_MIP",
204     "D3D10_FORMAT_SUPPORT_MIP_AUTOGEN",
205     "D3D10_FORMAT_SUPPORT_RENDER_TARGET",
206     "D3D10_FORMAT_SUPPORT_BLENDABLE",
207     "D3D10_FORMAT_SUPPORT_DEPTH_STENCIL",
208     "D3D10_FORMAT_SUPPORT_CPU_LOCKABLE",
209     "D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE",
210     "D3D10_FORMAT_SUPPORT_DISPLAY",
211     "D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT",
212     "D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET",
213     "D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD",
214     "D3D10_FORMAT_SUPPORT_SHADER_GATHER",
215     "D3D10_FORMAT_SUPPORT_BACK_BUFFER_CAST",
216 ])
217
218 D3D10_COUNTER = Enum("D3D10_COUNTER", [
219     "D3D10_COUNTER_GPU_IDLE",
220     "D3D10_COUNTER_VERTEX_PROCESSING",
221     "D3D10_COUNTER_GEOMETRY_PROCESSING",
222     "D3D10_COUNTER_PIXEL_PROCESSING",
223     "D3D10_COUNTER_OTHER_GPU_PROCESSING",
224     "D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION",
225     "D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION",
226     "D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION",
227     "D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION",
228     "D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION",
229     "D3D10_COUNTER_VS_MEMORY_LIMITED",
230     "D3D10_COUNTER_VS_COMPUTATION_LIMITED",
231     "D3D10_COUNTER_GS_MEMORY_LIMITED",
232     "D3D10_COUNTER_GS_COMPUTATION_LIMITED",
233     "D3D10_COUNTER_PS_MEMORY_LIMITED",
234     "D3D10_COUNTER_PS_COMPUTATION_LIMITED",
235     "D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE",
236     "D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE",
237     "D3D10_COUNTER_DEVICE_DEPENDENT_0",
238 ])
239
240 D3D10_COUNTER_DESC = Struct("D3D10_COUNTER_DESC", [
241     (D3D10_COUNTER, "Counter"),
242     (UINT, "MiscFlags"),
243 ])
244
245 D3D10_COUNTER_TYPE = Enum("D3D10_COUNTER_TYPE", [
246     "D3D10_COUNTER_TYPE_FLOAT32",
247     "D3D10_COUNTER_TYPE_UINT16",
248     "D3D10_COUNTER_TYPE_UINT32",
249     "D3D10_COUNTER_TYPE_UINT64",
250 ])
251
252 D3D10_COUNTER_INFO = Struct("D3D10_COUNTER_INFO", [
253     (D3D10_COUNTER, "LastDeviceDependentCounter"),
254     (UINT, "NumSimultaneousCounters"),
255     (UINT8, "NumDetectableParallelUnits"),
256 ])
257
258 D3D10_RESOURCE_DIMENSION = Enum("D3D10_RESOURCE_DIMENSION", [
259     "D3D10_RESOURCE_DIMENSION_UNKNOWN",
260     "D3D10_RESOURCE_DIMENSION_BUFFER",
261     "D3D10_RESOURCE_DIMENSION_TEXTURE1D",
262     "D3D10_RESOURCE_DIMENSION_TEXTURE2D",
263     "D3D10_RESOURCE_DIMENSION_TEXTURE3D",
264 ])
265
266 D3D10_USAGE = Enum("D3D10_USAGE", [
267     "D3D10_USAGE_DEFAULT",
268     "D3D10_USAGE_IMMUTABLE",
269     "D3D10_USAGE_DYNAMIC",
270     "D3D10_USAGE_STAGING",
271 ])
272
273 D3D10_BIND_FLAG = Flags(UINT, [
274     "D3D10_BIND_VERTEX_BUFFER",
275     "D3D10_BIND_INDEX_BUFFER",
276     "D3D10_BIND_CONSTANT_BUFFER",
277     "D3D10_BIND_SHADER_RESOURCE",
278     "D3D10_BIND_STREAM_OUTPUT",
279     "D3D10_BIND_RENDER_TARGET",
280     "D3D10_BIND_DEPTH_STENCIL",
281 ])
282
283 D3D10_CPU_ACCESS_FLAG = Flags(UINT, [
284     "D3D10_CPU_ACCESS_WRITE",
285     "D3D10_CPU_ACCESS_READ",
286 ])
287
288 D3D10_RESOURCE_MISC_FLAG = Flags(UINT, [
289     "D3D10_RESOURCE_MISC_GENERATE_MIPS",
290     "D3D10_RESOURCE_MISC_SHARED",
291     "D3D10_RESOURCE_MISC_TEXTURECUBE",
292     "D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX",
293     "D3D10_RESOURCE_MISC_GDI_COMPATIBLE",
294 ])
295
296 D3D10_BUFFER_DESC = Struct("D3D10_BUFFER_DESC", [
297     (UINT, "ByteWidth"),
298     (D3D10_USAGE, "Usage"),
299     (D3D10_BIND_FLAG, "BindFlags"),
300     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
301     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
302 ])
303
304 D3D10_MAP = Enum("D3D10_MAP", [
305     "D3D10_MAP_READ",
306     "D3D10_MAP_WRITE",
307     "D3D10_MAP_READ_WRITE",
308     "D3D10_MAP_WRITE_DISCARD",
309     "D3D10_MAP_WRITE_NO_OVERWRITE",
310 ])
311
312 D3D10_TEXTURE1D_DESC = Struct("D3D10_TEXTURE1D_DESC", [
313     (UINT, "Width"),
314     (UINT, "MipLevels"),
315     (UINT, "ArraySize"),
316     (DXGI_FORMAT, "Format"),
317     (D3D10_USAGE, "Usage"),
318     (D3D10_BIND_FLAG, "BindFlags"),
319     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
320     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
321 ])
322
323 D3D10_TEXTURE2D_DESC = Struct("D3D10_TEXTURE2D_DESC", [
324     (UINT, "Width"),
325     (UINT, "Height"),
326     (UINT, "MipLevels"),
327     (UINT, "ArraySize"),
328     (DXGI_FORMAT, "Format"),
329     (DXGI_SAMPLE_DESC, "SampleDesc"),
330     (D3D10_USAGE, "Usage"),
331     (D3D10_BIND_FLAG, "BindFlags"),
332     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
333     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
334 ])
335
336 D3D10_TEXTURE3D_DESC = Struct("D3D10_TEXTURE3D_DESC", [
337     (UINT, "Width"),
338     (UINT, "Height"),
339     (UINT, "Depth"),
340     (UINT, "MipLevels"),
341     (DXGI_FORMAT, "Format"),
342     (D3D10_USAGE, "Usage"),
343     (D3D10_BIND_FLAG, "BindFlags"),
344     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
345     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
346 ])
347
348 D3D10_DSV_DIMENSION = Enum("D3D10_DSV_DIMENSION", [
349     "D3D10_DSV_DIMENSION_UNKNOWN",
350     "D3D10_DSV_DIMENSION_TEXTURE1D",
351     "D3D10_DSV_DIMENSION_TEXTURE1DARRAY",
352     "D3D10_DSV_DIMENSION_TEXTURE2D",
353     "D3D10_DSV_DIMENSION_TEXTURE2DARRAY",
354     "D3D10_DSV_DIMENSION_TEXTURE2DMS",
355     "D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY",
356 ])
357
358 D3D10_TEX1D_DSV = Struct("D3D10_TEX1D_DSV", [
359     (UINT, "MipSlice"),
360 ])
361
362 D3D10_TEX1D_ARRAY_DSV = Struct("D3D10_TEX1D_ARRAY_DSV", [
363     (UINT, "MipSlice"),
364     (UINT, "FirstArraySlice"),
365     (UINT, "ArraySize"),
366 ])
367
368 D3D10_TEX2D_DSV = Struct("D3D10_TEX2D_DSV", [
369     (UINT, "MipSlice"),
370 ])
371
372 D3D10_TEX2D_ARRAY_DSV = Struct("D3D10_TEX2D_ARRAY_DSV", [
373     (UINT, "MipSlice"),
374     (UINT, "FirstArraySlice"),
375     (UINT, "ArraySize"),
376 ])
377
378 D3D10_TEX2DMS_DSV = Struct("D3D10_TEX2DMS_DSV", [
379     (UINT, "UnusedField_NothingToDefine"),
380 ])
381
382 D3D10_TEX2DMS_ARRAY_DSV = Struct("D3D10_TEX2DMS_ARRAY_DSV", [
383     (UINT, "FirstArraySlice"),
384     (UINT, "ArraySize"),
385 ])
386
387 D3D10_DEPTH_STENCIL_VIEW_DESC = Struct("D3D10_DEPTH_STENCIL_VIEW_DESC", [
388     (DXGI_FORMAT, "Format"),
389     (D3D10_DSV_DIMENSION, "ViewDimension"),
390     (Union("{self}.ViewDimension", [
391         ("D3D10_DSV_DIMENSION_TEXTURE1D", D3D10_TEX1D_DSV, "Texture1D"),
392         ("D3D10_DSV_DIMENSION_TEXTURE1DARRAY", D3D10_TEX1D_ARRAY_DSV, "Texture1DArray"),
393         ("D3D10_DSV_DIMENSION_TEXTURE2D", D3D10_TEX2D_DSV, "Texture2D"),
394         ("D3D10_DSV_DIMENSION_TEXTURE2DARRAY", D3D10_TEX2D_ARRAY_DSV, "Texture2DArray"),
395         ("D3D10_DSV_DIMENSION_TEXTURE2DMS", D3D10_TEX2DMS_DSV, "Texture2DMS"),
396         ("D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY", D3D10_TEX2DMS_ARRAY_DSV, "Texture2DMSArray"),
397     ]), None),
398 ])
399
400 D3D10_RTV_DIMENSION = Enum("D3D10_RTV_DIMENSION", [
401     "D3D10_RTV_DIMENSION_UNKNOWN",
402     "D3D10_RTV_DIMENSION_BUFFER",
403     "D3D10_RTV_DIMENSION_TEXTURE1D",
404     "D3D10_RTV_DIMENSION_TEXTURE1DARRAY",
405     "D3D10_RTV_DIMENSION_TEXTURE2D",
406     "D3D10_RTV_DIMENSION_TEXTURE2DARRAY",
407     "D3D10_RTV_DIMENSION_TEXTURE2DMS",
408     "D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY",
409     "D3D10_RTV_DIMENSION_TEXTURE3D",
410 ])
411
412 D3D10_BUFFER_RTV = Struct("D3D10_BUFFER_RTV", [
413     (UINT, "FirstElement"),
414     (UINT, "NumElements"),
415 ])
416
417 D3D10_TEX1D_RTV = Struct("D3D10_TEX1D_RTV", [
418     (UINT, "MipSlice"),
419 ])
420
421 D3D10_TEX1D_ARRAY_RTV = Struct("D3D10_TEX1D_ARRAY_RTV", [
422     (UINT, "MipSlice"),
423     (UINT, "FirstArraySlice"),
424     (UINT, "ArraySize"),
425 ])
426
427 D3D10_TEX2D_RTV = Struct("D3D10_TEX2D_RTV", [
428     (UINT, "MipSlice"),
429 ])
430
431 D3D10_TEX2D_ARRAY_RTV = Struct("D3D10_TEX2D_ARRAY_RTV", [
432     (UINT, "MipSlice"),
433     (UINT, "FirstArraySlice"),
434     (UINT, "ArraySize"),
435 ])
436
437 D3D10_TEX2DMS_RTV = Struct("D3D10_TEX2DMS_RTV", [
438     (UINT, "UnusedField_NothingToDefine"),
439 ])
440
441 D3D10_TEX2DMS_ARRAY_RTV = Struct("D3D10_TEX2DMS_ARRAY_RTV", [
442     (UINT, "FirstArraySlice"),
443     (UINT, "ArraySize"),
444 ])
445
446 D3D10_TEX3D_RTV = Struct("D3D10_TEX3D_RTV", [
447     (UINT, "MipSlice"),
448     (UINT, "FirstWSlice"),
449     (UINT, "WSize"),
450 ])
451
452 D3D10_RENDER_TARGET_VIEW_DESC = Struct("D3D10_RENDER_TARGET_VIEW_DESC", [
453     (DXGI_FORMAT, "Format"),
454     (D3D10_RTV_DIMENSION, "ViewDimension"),
455     (Union("{self}.ViewDimension", [
456         ("D3D10_RTV_DIMENSION_BUFFER", D3D10_BUFFER_RTV, "Buffer"),
457         ("D3D10_RTV_DIMENSION_TEXTURE1D", D3D10_TEX1D_RTV, "Texture1D"),
458         ("D3D10_RTV_DIMENSION_TEXTURE1DARRAY", D3D10_TEX1D_ARRAY_RTV, "Texture1DArray"),
459         ("D3D10_RTV_DIMENSION_TEXTURE2D", D3D10_TEX2D_RTV, "Texture2D"),
460         ("D3D10_RTV_DIMENSION_TEXTURE2DARRAY", D3D10_TEX2D_ARRAY_RTV, "Texture2DArray"),
461         ("D3D10_RTV_DIMENSION_TEXTURE2DMS", D3D10_TEX2DMS_RTV, "Texture2DMS"),
462         ("D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY", D3D10_TEX2DMS_ARRAY_RTV, "Texture2DMSArray"),
463         ("D3D10_RTV_DIMENSION_TEXTURE3D", D3D10_TEX3D_RTV, "Texture3D"),
464     ]), None),
465 ])
466
467 D3D10_SRV_DIMENSION = Enum("D3D10_SRV_DIMENSION", [
468     "D3D10_SRV_DIMENSION_UNKNOWN",
469         "D3D10_SRV_DIMENSION_BUFFER",
470         "D3D10_SRV_DIMENSION_TEXTURE1D",
471         "D3D10_SRV_DIMENSION_TEXTURE1DARRAY",
472         "D3D10_SRV_DIMENSION_TEXTURE2D",
473         "D3D10_SRV_DIMENSION_TEXTURE2DARRAY",
474         "D3D10_SRV_DIMENSION_TEXTURE2DMS",
475         "D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY",
476         "D3D10_SRV_DIMENSION_TEXTURE3D",
477         "D3D10_SRV_DIMENSION_TEXTURECUBE",
478 ])
479
480 D3D10_BUFFER_SRV = Struct("D3D10_BUFFER_SRV", [
481     (UINT, "FirstElement"),
482     (UINT, "NumElements"),
483 ])
484
485 D3D10_TEX1D_SRV = Struct("D3D10_TEX1D_SRV", [
486     (UINT, "MostDetailedMip"),
487     (UINT, "MipLevels"),
488 ])
489
490 D3D10_TEX1D_ARRAY_SRV = Struct("D3D10_TEX1D_ARRAY_SRV", [
491     (UINT, "MostDetailedMip"),
492     (UINT, "MipLevels"),
493     (UINT, "FirstArraySlice"),
494     (UINT, "ArraySize"),
495 ])
496
497 D3D10_TEX2D_SRV = Struct("D3D10_TEX2D_SRV", [
498     (UINT, "MostDetailedMip"),
499     (UINT, "MipLevels"),
500 ])
501
502 D3D10_TEX2D_ARRAY_SRV = Struct("D3D10_TEX2D_ARRAY_SRV", [
503     (UINT, "MostDetailedMip"),
504     (UINT, "MipLevels"),
505     (UINT, "FirstArraySlice"),
506     (UINT, "ArraySize"),
507 ])
508
509 D3D10_TEX2DMS_SRV = Struct("D3D10_TEX2DMS_SRV", [
510     (UINT, "UnusedField_NothingToDefine"),
511 ])
512
513 D3D10_TEX2DMS_ARRAY_SRV = Struct("D3D10_TEX2DMS_ARRAY_SRV", [
514     (UINT, "FirstArraySlice"),
515     (UINT, "ArraySize"),
516 ])
517
518 D3D10_TEX3D_SRV = Struct("D3D10_TEX3D_SRV", [
519     (UINT, "MostDetailedMip"),
520     (UINT, "MipLevels"),
521 ])
522
523 D3D10_TEXCUBE_SRV = Struct("D3D10_TEXCUBE_SRV", [
524     (UINT, "MostDetailedMip"),
525     (UINT, "MipLevels"),
526 ])
527
528 D3D10_SHADER_RESOURCE_VIEW_DESC = Struct("D3D10_SHADER_RESOURCE_VIEW_DESC", [
529     (DXGI_FORMAT, "Format"),
530     (D3D10_SRV_DIMENSION, "ViewDimension"),
531     (Union("{self}.ViewDimension", [
532         ("D3D10_SRV_DIMENSION_BUFFER", D3D10_BUFFER_SRV, "Buffer"),
533         ("D3D10_SRV_DIMENSION_TEXTURE1D", D3D10_TEX1D_SRV, "Texture1D"),
534         ("D3D10_SRV_DIMENSION_TEXTURE1DARRAY", D3D10_TEX1D_ARRAY_SRV, "Texture1DArray"),
535         ("D3D10_SRV_DIMENSION_TEXTURE2D", D3D10_TEX2D_SRV, "Texture2D"), 
536         ("D3D10_SRV_DIMENSION_TEXTURE2DARRAY", D3D10_TEX2D_ARRAY_SRV, "Texture2DArray"),
537         ("D3D10_SRV_DIMENSION_TEXTURE2DMS", D3D10_TEX2DMS_SRV, "Texture2DMS"),
538         ("D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY", D3D10_TEX2DMS_ARRAY_SRV, "Texture2DMSArray"),
539         ("D3D10_SRV_DIMENSION_TEXTURE3D", D3D10_TEX3D_SRV, "Texture3D"),
540         ("D3D10_SRV_DIMENSION_TEXTURECUBE", D3D10_TEXCUBE_SRV, "TextureCube"),
541     ]), None),
542 ])
543
544 D3D10_BOX = Struct("D3D10_BOX", [
545     (UINT, "left"),
546     (UINT, "top"),
547     (UINT, "front"),
548     (UINT, "right"),
549     (UINT, "bottom"),
550     (UINT, "back"),
551 ])
552
553 D3D10_SUBRESOURCE_DATA = Struct("D3D10_SUBRESOURCE_DATA", [
554     (Blob(Const(Void), "_calcSubresourceSize(pDesc, {i}, {self}.SysMemPitch, {self}.SysMemSlicePitch)"), "pSysMem"),
555     (UINT, "SysMemPitch"),
556     (UINT, "SysMemSlicePitch"),
557 ])
558
559 D3D10_SO_DECLARATION_ENTRY = Struct("D3D10_SO_DECLARATION_ENTRY", [
560     (LPCSTR, "SemanticName"),
561     (UINT, "SemanticIndex"),
562     (BYTE, "StartComponent"),
563     (BYTE, "ComponentCount"),
564     (BYTE, "OutputSlot"),
565 ])
566
567 D3D10_INPUT_CLASSIFICATION = Enum("D3D10_INPUT_CLASSIFICATION", [
568     "D3D10_INPUT_PER_VERTEX_DATA",
569     "D3D10_INPUT_PER_INSTANCE_DATA",
570 ])
571
572 D3D10_INPUT_ELEMENT_DESC = Struct("D3D10_INPUT_ELEMENT_DESC", [
573     (LPCSTR, "SemanticName"),
574     (UINT, "SemanticIndex"),
575     (DXGI_FORMAT, "Format"),
576     (UINT, "InputSlot"),
577     (UINT, "AlignedByteOffset"),
578     (D3D10_INPUT_CLASSIFICATION, "InputSlotClass"),
579     (UINT, "InstanceDataStepRate"),
580 ])
581
582 D3D10_QUERY = Enum("D3D10_QUERY", [
583     "D3D10_QUERY_EVENT",
584     "D3D10_QUERY_OCCLUSION",
585     "D3D10_QUERY_TIMESTAMP",
586     "D3D10_QUERY_TIMESTAMP_DISJOINT",
587     "D3D10_QUERY_PIPELINE_STATISTICS",
588     "D3D10_QUERY_OCCLUSION_PREDICATE",
589     "D3D10_QUERY_SO_STATISTICS",
590     "D3D10_QUERY_SO_OVERFLOW_PREDICATE",
591 ])
592
593 D3D10_QUERY_MISC_FLAG = Flags(UINT, [
594     "D3D10_QUERY_MISC_PREDICATEHINT",
595 ])
596
597 D3D10_QUERY_DESC = Struct("D3D10_QUERY_DESC", [
598     (D3D10_QUERY, "Query"),
599     (D3D10_QUERY_MISC_FLAG, "MiscFlags"),
600 ])
601
602 D3D10_RECT = Alias("D3D10_RECT", RECT)
603 D3D10_VIEWPORT = Struct("D3D10_VIEWPORT", [
604     (INT, "TopLeftX"),
605     (INT, "TopLeftY"),
606     (UINT, "Width"),
607     (UINT, "Height"),
608     (FLOAT, "MinDepth"),
609     (FLOAT, "MaxDepth"),
610 ])
611
612 D3D10_MAPPED_TEXTURE2D = Struct("D3D10_MAPPED_TEXTURE2D", [
613     (LinearPointer(Void, "_MappedSize"), "pData"),
614     (UINT, "RowPitch"),
615 ])
616
617 D3D10_MAPPED_TEXTURE3D = Struct("D3D10_MAPPED_TEXTURE3D", [
618     (LinearPointer(Void, "_MappedSize"), "pData"),
619     (UINT, "RowPitch"),
620     (UINT, "DepthPitch"),
621 ])
622
623 D3D10_MAP_FLAG = Flags(UINT, [
624     "D3D10_MAP_FLAG_DO_NOT_WAIT",
625 ])
626
627 D3D10_CLEAR_FLAG = Flags(UINT, [
628     "D3D10_CLEAR_DEPTH",
629     "D3D10_CLEAR_STENCIL",
630 ])
631
632 D3D10_COLOR_WRITE_ENABLE = Flags(UINT, [
633     "D3D10_COLOR_WRITE_ENABLE_ALL",
634     "D3D10_COLOR_WRITE_ENABLE_RED",
635     "D3D10_COLOR_WRITE_ENABLE_GREEN",
636     "D3D10_COLOR_WRITE_ENABLE_BLUE",
637     "D3D10_COLOR_WRITE_ENABLE_ALPHA",
638 ])
639
640 D3D10_TEXTURECUBE_FACE = Enum("D3D10_TEXTURECUBE_FACE", [
641     "D3D10_TEXTURECUBE_FACE_POSITIVE_X",
642     "D3D10_TEXTURECUBE_FACE_NEGATIVE_X",
643     "D3D10_TEXTURECUBE_FACE_POSITIVE_Y",
644     "D3D10_TEXTURECUBE_FACE_NEGATIVE_Y",
645     "D3D10_TEXTURECUBE_FACE_POSITIVE_Z",
646     "D3D10_TEXTURECUBE_FACE_NEGATIVE_Z",
647 ])
648
649 D3D10_ASYNC_GETDATA_FLAG = Flags(UINT, [
650     "D3D10_ASYNC_GETDATA_DONOTFLUSH",
651 ])
652
653 D3D10_FILTER_TYPE = Enum("D3D10_FILTER_TYPE", [
654     "D3D10_FILTER_TYPE_POINT",
655     "D3D10_FILTER_TYPE_LINEAR",
656 ])
657
658 D3D10_QUERY_DATA_TIMESTAMP_DISJOINT = Struct("D3D10_QUERY_DATA_TIMESTAMP_DISJOINT", [
659     (UINT64, "Frequency"),
660     (BOOL, "Disjoint"),
661 ])
662
663 D3D10_QUERY_DATA_PIPELINE_STATISTICS = Struct("D3D10_QUERY_DATA_PIPELINE_STATISTICS", [
664     (UINT64, "IAVertices"),
665     (UINT64, "IAPrimitives"),
666     (UINT64, "VSInvocations"),
667     (UINT64, "GSInvocations"),
668     (UINT64, "GSPrimitives"),
669     (UINT64, "CInvocations"),
670     (UINT64, "CPrimitives"),
671     (UINT64, "PSInvocations"),
672 ])
673
674 D3D10_QUERY_DATA_SO_STATISTICS = Struct("D3D10_QUERY_DATA_SO_STATISTICS", [
675     (UINT64, "NumPrimitivesWritten"),
676     (UINT64, "PrimitivesStorageNeeded"),
677 ])
678
679 D3D10_CREATE_DEVICE_FLAG = Flags(UINT, [
680     "D3D10_CREATE_DEVICE_SINGLETHREADED",
681     "D3D10_CREATE_DEVICE_DEBUG",
682     "D3D10_CREATE_DEVICE_SWITCH_TO_REF",
683     "D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS",
684     "D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP",
685     "D3D10_CREATE_DEVICE_BGRA_SUPPORT",
686     "D3D10_CREATE_DEVICE_STRICT_VALIDATION",
687     "D3D10_CREATE_DEVICE_BGRA_SUPPORT",
688     "D3D10_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY",
689     "D3D10_CREATE_DEVICE_STRICT_VALIDATION",
690     "D3D10_CREATE_DEVICE_DEBUGGABLE",
691 ])
692
693 D3D10_RAISE_FLAG = Flags(UINT, [
694     "D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR",
695 ])
696
697 ID3D10DeviceChild = Interface("ID3D10DeviceChild", IUnknown)
698 ID3D10Resource = Interface("ID3D10Resource", ID3D10DeviceChild)
699 ID3D10Buffer = Interface("ID3D10Buffer", ID3D10Resource)
700 ID3D10Texture1D = Interface("ID3D10Texture1D", ID3D10Resource)
701 ID3D10Texture2D = Interface("ID3D10Texture2D", ID3D10Resource)
702 ID3D10Texture3D = Interface("ID3D10Texture3D", ID3D10Resource)
703 ID3D10View = Interface("ID3D10View", ID3D10DeviceChild)
704 ID3D10DepthStencilView = Interface("ID3D10DepthStencilView", ID3D10View)
705 ID3D10RenderTargetView = Interface("ID3D10RenderTargetView", ID3D10View)
706 ID3D10ShaderResourceView = Interface("ID3D10ShaderResourceView", ID3D10View)
707 ID3D10BlendState = Interface("ID3D10BlendState", ID3D10DeviceChild)
708 ID3D10DepthStencilState = Interface("ID3D10DepthStencilState", ID3D10DeviceChild)
709 ID3D10GeometryShader = Interface("ID3D10GeometryShader", ID3D10DeviceChild)
710 ID3D10InputLayout = Interface("ID3D10InputLayout", ID3D10DeviceChild)
711 ID3D10PixelShader = Interface("ID3D10PixelShader", ID3D10DeviceChild)
712 ID3D10RasterizerState = Interface("ID3D10RasterizerState", ID3D10DeviceChild)
713 ID3D10SamplerState = Interface("ID3D10SamplerState", ID3D10DeviceChild)
714 ID3D10VertexShader = Interface("ID3D10VertexShader", ID3D10DeviceChild)
715 ID3D10Asynchronous = Interface("ID3D10Asynchronous", ID3D10DeviceChild)
716 ID3D10Counter = Interface("ID3D10Counter", ID3D10Asynchronous)
717 ID3D10Query = Interface("ID3D10Query", ID3D10Asynchronous)
718 ID3D10Predicate = Interface("ID3D10Predicate", ID3D10Query)
719 ID3D10Device = Interface("ID3D10Device", IUnknown)
720 ID3D10Multithread = Interface("ID3D10Multithread", IUnknown)
721
722 ID3D10DeviceChild.methods += [
723     StdMethod(Void, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]),
724     StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False),
725     StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False),
726     StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False),
727 ]
728
729 ID3D10Resource.methods += [
730     StdMethod(Void, "GetType", [Out(Pointer(D3D10_RESOURCE_DIMENSION), "rType")], sideeffects=False),
731     StdMethod(Void, "SetEvictionPriority", [(UINT, "EvictionPriority")]),
732     StdMethod(UINT, "GetEvictionPriority", [], sideeffects=False),
733 ]
734
735 ID3D10Buffer.methods += [
736     StdMethod(HRESULT, "Map", [(D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppData")]),
737     StdMethod(Void, "Unmap", []),
738     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_BUFFER_DESC), "pDesc")], sideeffects=False),
739 ]
740
741 ID3D10Texture1D.methods += [
742     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppData")]),
743     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
744     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE1D_DESC), "pDesc")], sideeffects=False),
745 ]
746
747 ID3D10Texture2D.methods += [
748     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(D3D10_MAPPED_TEXTURE2D), "pMappedTex2D")]),
749     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
750     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE2D_DESC), "pDesc")], sideeffects=False),
751 ]
752
753 ID3D10Texture3D.methods += [
754     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(D3D10_MAPPED_TEXTURE3D), "pMappedTex3D")]),
755     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
756     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE3D_DESC), "pDesc")], sideeffects=False),
757 ]
758
759 ID3D10View.methods += [
760     StdMethod(Void, "GetResource", [Out(Pointer(ObjPointer(ID3D10Resource)), "ppResource")]),
761 ]
762
763 ID3D10DepthStencilView.methods += [
764     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_DEPTH_STENCIL_VIEW_DESC), "pDesc")], sideeffects=False),
765 ]
766
767 ID3D10RenderTargetView.methods += [
768     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_RENDER_TARGET_VIEW_DESC), "pDesc")], sideeffects=False),
769 ]
770
771 ID3D10ShaderResourceView.methods += [
772     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_SHADER_RESOURCE_VIEW_DESC), "pDesc")], sideeffects=False),
773 ]
774
775 ID3D10BlendState.methods += [
776     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_BLEND_DESC), "pDesc")], sideeffects=False),
777 ]
778
779 ID3D10DepthStencilState.methods += [
780     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_DEPTH_STENCIL_DESC), "pDesc")], sideeffects=False),
781 ]
782
783 ID3D10RasterizerState.methods += [
784     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_RASTERIZER_DESC), "pDesc")], sideeffects=False),
785 ]
786
787 ID3D10SamplerState.methods += [
788     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_SAMPLER_DESC), "pDesc")], sideeffects=False),
789 ]
790
791 ID3D10Asynchronous.methods += [
792     StdMethod(Void, "Begin", []),
793     StdMethod(Void, "End", []),
794     StdMethod(HRESULT, "GetData", [Out(Blob(Void, "DataSize"), "pData"), (UINT, "DataSize"), (D3D10_ASYNC_GETDATA_FLAG, "GetDataFlags")], sideeffects=False),
795     StdMethod(UINT, "GetDataSize", [], sideeffects=False),
796 ]
797
798 ID3D10Counter.methods += [
799     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_COUNTER_DESC), "pDesc")], sideeffects=False),
800 ]
801
802 ID3D10Query.methods += [
803     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_QUERY_DESC), "pDesc")], sideeffects=False),
804 ]
805
806 ID3D10Device.methods += [
807     StdMethod(Void, "VSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
808     StdMethod(Void, "PSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
809     StdMethod(Void, "PSSetShader", [(ObjPointer(ID3D10PixelShader), "pPixelShader")]),
810     StdMethod(Void, "PSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
811     StdMethod(Void, "VSSetShader", [(ObjPointer(ID3D10VertexShader), "pVertexShader")]),
812     StdMethod(Void, "DrawIndexed", [(UINT, "IndexCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation")]),
813     StdMethod(Void, "Draw", [(UINT, "VertexCount"), (UINT, "StartVertexLocation")]),
814     StdMethod(Void, "PSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
815     StdMethod(Void, "IASetInputLayout", [(ObjPointer(ID3D10InputLayout), "pInputLayout")]),
816     StdMethod(Void, "IASetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppVertexBuffers"), (Array(Const(UINT), "NumBuffers"), "pStrides"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]),
817     StdMethod(Void, "IASetIndexBuffer", [(ObjPointer(ID3D10Buffer), "pIndexBuffer"), (DXGI_FORMAT, "Format"), (UINT, "Offset")]),
818     StdMethod(Void, "DrawIndexedInstanced", [(UINT, "IndexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation"), (UINT, "StartInstanceLocation")]),
819     StdMethod(Void, "DrawInstanced", [(UINT, "VertexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartVertexLocation"), (UINT, "StartInstanceLocation")]),
820     StdMethod(Void, "GSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
821     StdMethod(Void, "GSSetShader", [(ObjPointer(ID3D10GeometryShader), "pShader")]),
822     StdMethod(Void, "IASetPrimitiveTopology", [(D3D10_PRIMITIVE_TOPOLOGY, "Topology")]),
823     StdMethod(Void, "VSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
824     StdMethod(Void, "VSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
825     StdMethod(Void, "SetPredication", [(ObjPointer(ID3D10Predicate), "pPredicate"), (BOOL, "PredicateValue")]),
826     StdMethod(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
827     StdMethod(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
828     StdMethod(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (ObjPointer(ID3D10DepthStencilView), "pDepthStencilView")]),
829     StdMethod(Void, "OMSetBlendState", [(ObjPointer(ID3D10BlendState), "pBlendState"), (Array(Const(FLOAT), 4), "BlendFactor"), (UINT, "SampleMask")]),
830     StdMethod(Void, "OMSetDepthStencilState", [(ObjPointer(ID3D10DepthStencilState), "pDepthStencilState"), (UINT, "StencilRef")]),
831     StdMethod(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppSOTargets"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]),
832     StdMethod(Void, "DrawAuto", []),
833     StdMethod(Void, "RSSetState", [(ObjPointer(ID3D10RasterizerState), "pRasterizerState")]),
834     StdMethod(Void, "RSSetViewports", [(UINT, "NumViewports"), (Array(Const(D3D10_VIEWPORT), "NumViewports"), "pViewports")]),
835     StdMethod(Void, "RSSetScissorRects", [(UINT, "NumRects"), (Array(Const(D3D10_RECT), "NumRects"), "pRects")]),
836     StdMethod(Void, "CopySubresourceRegion", [(ObjPointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (UINT, "DstX"), (UINT, "DstY"), (UINT, "DstZ"), (ObjPointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (Pointer(Const(D3D10_BOX)), "pSrcBox")]),
837     StdMethod(Void, "CopyResource", [(ObjPointer(ID3D10Resource), "pDstResource"), (ObjPointer(ID3D10Resource), "pSrcResource")]),
838     StdMethod(Void, "UpdateSubresource", [(ObjPointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(Const(D3D10_BOX)), "pDstBox"), (Blob(Const(Void), "_calcSubresourceSize(pDstResource, DstSubresource, pDstBox, SrcRowPitch, SrcDepthPitch)"), "pSrcData"), (UINT, "SrcRowPitch"), (UINT, "SrcDepthPitch")]),
839     StdMethod(Void, "ClearRenderTargetView", [(ObjPointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]),
840     StdMethod(Void, "ClearDepthStencilView", [(ObjPointer(ID3D10DepthStencilView), "pDepthStencilView"), (D3D10_CLEAR_FLAG, "ClearFlags"), (FLOAT, "Depth"), (UINT8, "Stencil")]),
841     StdMethod(Void, "GenerateMips", [(ObjPointer(ID3D10ShaderResourceView), "pShaderResourceView")]),
842     StdMethod(Void, "ResolveSubresource", [(ObjPointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (ObjPointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (DXGI_FORMAT, "Format")]),
843     StdMethod(Void, "VSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
844     StdMethod(Void, "PSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
845     StdMethod(Void, "PSGetShader", [Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPixelShader")]),
846     StdMethod(Void, "PSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
847     StdMethod(Void, "VSGetShader", [Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVertexShader")]),
848     StdMethod(Void, "PSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
849     StdMethod(Void, "IAGetInputLayout", [Out(Pointer(ObjPointer(ID3D10InputLayout)), "ppInputLayout")]),
850     StdMethod(Void, "IAGetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppVertexBuffers"), Out(Array(UINT, "NumBuffers"), "pStrides"), Out(Array(UINT, "NumBuffers"), "pOffsets")]),
851     StdMethod(Void, "IAGetIndexBuffer", [Out(Pointer(ObjPointer(ID3D10Buffer)), "pIndexBuffer"), Out(Pointer(DXGI_FORMAT), "Format"), Out(Pointer(UINT), "Offset")]),
852     StdMethod(Void, "GSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
853     StdMethod(Void, "GSGetShader", [Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGeometryShader")]),
854     StdMethod(Void, "IAGetPrimitiveTopology", [Out(Pointer(D3D10_PRIMITIVE_TOPOLOGY), "pTopology")], sideeffects=False),
855     StdMethod(Void, "VSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
856     StdMethod(Void, "VSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
857     StdMethod(Void, "GetPredication", [Out(Pointer(ObjPointer(ID3D10Predicate)), "ppPredicate"), Out(Pointer(BOOL), "pPredicateValue")]),
858     StdMethod(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
859     StdMethod(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
860     StdMethod(Void, "OMGetRenderTargets", [(UINT, "NumViews"), Out(Array(ObjPointer(ID3D10RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppDepthStencilView")]),
861     StdMethod(Void, "OMGetBlendState", [Out(Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState"), Out(Array(FLOAT, 4), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]),
862     StdMethod(Void, "OMGetDepthStencilState", [Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState"), Out(Pointer(UINT), "pStencilRef")]),
863     StdMethod(Void, "SOGetTargets", [(UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppSOTargets"), Out(Array(UINT, "NumBuffers"), "pOffsets")]),
864     StdMethod(Void, "RSGetState", [Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]),
865     StdMethod(Void, "RSGetViewports", [Out(Pointer(UINT), "NumViewports"), Out(Array(D3D10_VIEWPORT, "*NumViewports"), "pViewports")], sideeffects=False),
866     StdMethod(Void, "RSGetScissorRects", [Out(Pointer(UINT), "NumRects"), Out(Array(D3D10_RECT, "*NumRects"), "pRects")], sideeffects=False),
867     StdMethod(HRESULT, "GetDeviceRemovedReason", [], sideeffects=False),
868     StdMethod(HRESULT, "SetExceptionMode", [(D3D10_RAISE_FLAG, "RaiseFlags")]),
869     StdMethod(D3D10_RAISE_FLAG, "GetExceptionMode", [], sideeffects=False),
870     StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False),
871     StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False),
872     StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False),
873     StdMethod(Void, "ClearState", []),
874     StdMethod(Void, "Flush", []),
875     StdMethod(HRESULT, "CreateBuffer", [(Pointer(Const(D3D10_BUFFER_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "1"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Buffer)), "ppBuffer")]),
876     StdMethod(HRESULT, "CreateTexture1D", [(Pointer(Const(D3D10_TEXTURE1D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture1D)), "ppTexture1D")]),
877     StdMethod(HRESULT, "CreateTexture2D", [(Pointer(Const(D3D10_TEXTURE2D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture2D)), "ppTexture2D")]),
878     StdMethod(HRESULT, "CreateTexture3D", [(Pointer(Const(D3D10_TEXTURE3D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture3D)), "ppTexture3D")]),
879     StdMethod(HRESULT, "CreateShaderResourceView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_SHADER_RESOURCE_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppSRView")]),
880     StdMethod(HRESULT, "CreateRenderTargetView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_RENDER_TARGET_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppRTView")]),
881     StdMethod(HRESULT, "CreateDepthStencilView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_DEPTH_STENCIL_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppDepthStencilView")]),
882     StdMethod(HRESULT, "CreateInputLayout", [(Array(Const(D3D10_INPUT_ELEMENT_DESC), "NumElements"), "pInputElementDescs"), (UINT, "NumElements"), (Blob(Const(Void), "BytecodeLength"), "pShaderBytecodeWithInputSignature"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10InputLayout)), "ppInputLayout")]),
883     StdMethod(HRESULT, "CreateVertexShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVertexShader")]),
884     StdMethod(HRESULT, "CreateGeometryShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGeometryShader")]),
885     StdMethod(HRESULT, "CreateGeometryShaderWithStreamOutput", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (Array(Const(D3D10_SO_DECLARATION_ENTRY), "NumEntries"), "pSODeclaration"), (UINT, "NumEntries"), (UINT, "OutputStreamStride"), Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGeometryShader")]),
886     StdMethod(HRESULT, "CreatePixelShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPixelShader")]),
887     StdMethod(HRESULT, "CreateBlendState", [(Pointer(Const(D3D10_BLEND_DESC)), "pBlendStateDesc"), Out(Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState")]),
888     StdMethod(HRESULT, "CreateDepthStencilState", [(Pointer(Const(D3D10_DEPTH_STENCIL_DESC)), "pDepthStencilDesc"), Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState")]),
889     StdMethod(HRESULT, "CreateRasterizerState", [(Pointer(Const(D3D10_RASTERIZER_DESC)), "pRasterizerDesc"), Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]),
890     StdMethod(HRESULT, "CreateSamplerState", [(Pointer(Const(D3D10_SAMPLER_DESC)), "pSamplerDesc"), Out(Pointer(ObjPointer(ID3D10SamplerState)), "ppSamplerState")]),
891     StdMethod(HRESULT, "CreateQuery", [(Pointer(Const(D3D10_QUERY_DESC)), "pQueryDesc"), Out(Pointer(ObjPointer(ID3D10Query)), "ppQuery")]),
892     StdMethod(HRESULT, "CreatePredicate", [(Pointer(Const(D3D10_QUERY_DESC)), "pPredicateDesc"), Out(Pointer(ObjPointer(ID3D10Predicate)), "ppPredicate")]),
893     StdMethod(HRESULT, "CreateCounter", [(Pointer(Const(D3D10_COUNTER_DESC)), "pCounterDesc"), Out(Pointer(ObjPointer(ID3D10Counter)), "ppCounter")]),
894     StdMethod(HRESULT, "CheckFormatSupport", [(DXGI_FORMAT, "Format"), Out(Pointer(D3D10_FORMAT_SUPPORT), "pFormatSupport")], sideeffects=False),
895     StdMethod(HRESULT, "CheckMultisampleQualityLevels", [(DXGI_FORMAT, "Format"), (UINT, "SampleCount"), Out(Pointer(UINT), "pNumQualityLevels")], sideeffects=False),
896     StdMethod(Void, "CheckCounterInfo", [Out(Pointer(D3D10_COUNTER_INFO), "pCounterInfo")], sideeffects=False),
897     StdMethod(HRESULT, "CheckCounter", [(Pointer(Const(D3D10_COUNTER_DESC)), "pDesc"), Out(Pointer(D3D10_COUNTER_TYPE), "pType"), Out(Pointer(UINT), "pActiveCounters"), Out(LPSTR, "szName"), Out(Pointer(UINT), "pNameLength"), Out(LPSTR, "szUnits"), Out(Pointer(UINT), "pUnitsLength"), Out(LPSTR, "szDescription"), Out(Pointer(UINT), "pDescriptionLength")], sideeffects=False),
898     StdMethod(D3D10_CREATE_DEVICE_FLAG, "GetCreationFlags", [], sideeffects=False),
899     StdMethod(HRESULT, "OpenSharedResource", [(HANDLE, "hResource"), (REFIID, "ReturnedInterface"), Out(Pointer(ObjPointer(Void)), "ppResource")]),
900     StdMethod(Void, "SetTextFilterSize", [(UINT, "Width"), (UINT, "Height")]),
901     StdMethod(Void, "GetTextFilterSize", [Out(Pointer(UINT), "pWidth"), Out(Pointer(UINT), "pHeight")], sideeffects=False),
902 ]
903
904 ID3D10Multithread.methods += [
905     StdMethod(Void, "Enter", []),
906     StdMethod(Void, "Leave", []),
907     StdMethod(BOOL, "SetMultithreadProtected", [(BOOL, "bMTProtect")]),
908     StdMethod(BOOL, "GetMultithreadProtected", [], sideeffects=False),
909 ]
910
911
912 d3d10 = Module("d3d10")
913
914
915 from d3d10sdklayers import *
916 import d3d10misc