]> git.cworth.org Git - apitrace/blob - specs/d3d10.py
0552575d64e67ac9c370f985936020bc191b3f3f
[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 ])
216
217 D3D10_COUNTER = Enum("D3D10_COUNTER", [
218     "D3D10_COUNTER_GPU_IDLE",
219     "D3D10_COUNTER_VERTEX_PROCESSING",
220     "D3D10_COUNTER_GEOMETRY_PROCESSING",
221     "D3D10_COUNTER_PIXEL_PROCESSING",
222     "D3D10_COUNTER_OTHER_GPU_PROCESSING",
223     "D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION",
224     "D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION",
225     "D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION",
226     "D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION",
227     "D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION",
228     "D3D10_COUNTER_VS_MEMORY_LIMITED",
229     "D3D10_COUNTER_VS_COMPUTATION_LIMITED",
230     "D3D10_COUNTER_GS_MEMORY_LIMITED",
231     "D3D10_COUNTER_GS_COMPUTATION_LIMITED",
232     "D3D10_COUNTER_PS_MEMORY_LIMITED",
233     "D3D10_COUNTER_PS_COMPUTATION_LIMITED",
234     "D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE",
235     "D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE",
236     "D3D10_COUNTER_DEVICE_DEPENDENT_0",
237 ])
238
239 D3D10_COUNTER_DESC = Struct("D3D10_COUNTER_DESC", [
240     (D3D10_COUNTER, "Counter"),
241     (UINT, "MiscFlags"),
242 ])
243
244 D3D10_COUNTER_TYPE = Enum("D3D10_COUNTER_TYPE", [
245     "D3D10_COUNTER_TYPE_FLOAT32",
246     "D3D10_COUNTER_TYPE_UINT16",
247     "D3D10_COUNTER_TYPE_UINT32",
248     "D3D10_COUNTER_TYPE_UINT64",
249 ])
250
251 D3D10_COUNTER_INFO = Struct("D3D10_COUNTER_INFO", [
252     (D3D10_COUNTER, "LastDeviceDependentCounter"),
253     (UINT, "NumSimultaneousCounters"),
254     (UINT8, "NumDetectableParallelUnits"),
255 ])
256
257 D3D10_RESOURCE_DIMENSION = Enum("D3D10_RESOURCE_DIMENSION", [
258     "D3D10_RESOURCE_DIMENSION_UNKNOWN",
259     "D3D10_RESOURCE_DIMENSION_BUFFER",
260     "D3D10_RESOURCE_DIMENSION_TEXTURE1D",
261     "D3D10_RESOURCE_DIMENSION_TEXTURE2D",
262     "D3D10_RESOURCE_DIMENSION_TEXTURE3D",
263 ])
264
265 D3D10_USAGE = Enum("D3D10_USAGE", [
266     "D3D10_USAGE_DEFAULT",
267     "D3D10_USAGE_IMMUTABLE",
268     "D3D10_USAGE_DYNAMIC",
269     "D3D10_USAGE_STAGING",
270 ])
271
272 D3D10_BIND_FLAG = Flags(UINT, [
273     "D3D10_BIND_VERTEX_BUFFER",
274     "D3D10_BIND_INDEX_BUFFER",
275     "D3D10_BIND_CONSTANT_BUFFER",
276     "D3D10_BIND_SHADER_RESOURCE",
277     "D3D10_BIND_STREAM_OUTPUT",
278     "D3D10_BIND_RENDER_TARGET",
279     "D3D10_BIND_DEPTH_STENCIL",
280 ])
281
282 D3D10_CPU_ACCESS_FLAG = Flags(UINT, [
283     "D3D10_CPU_ACCESS_WRITE",
284     "D3D10_CPU_ACCESS_READ",
285 ])
286
287 D3D10_RESOURCE_MISC_FLAG = Flags(UINT, [
288     "D3D10_RESOURCE_MISC_GENERATE_MIPS",
289     "D3D10_RESOURCE_MISC_SHARED",
290     "D3D10_RESOURCE_MISC_TEXTURECUBE",
291     "D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX",
292     "D3D10_RESOURCE_MISC_GDI_COMPATIBLE",
293 ])
294
295 D3D10_BUFFER_DESC = Struct("D3D10_BUFFER_DESC", [
296     (UINT, "ByteWidth"),
297     (D3D10_USAGE, "Usage"),
298     (D3D10_BIND_FLAG, "BindFlags"),
299     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
300     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
301 ])
302
303 D3D10_MAP = Enum("D3D10_MAP", [
304     "D3D10_MAP_READ",
305     "D3D10_MAP_WRITE",
306     "D3D10_MAP_READ_WRITE",
307     "D3D10_MAP_WRITE_DISCARD",
308     "D3D10_MAP_WRITE_NO_OVERWRITE",
309 ])
310
311 D3D10_TEXTURE1D_DESC = Struct("D3D10_TEXTURE1D_DESC", [
312     (UINT, "Width"),
313     (UINT, "MipLevels"),
314     (UINT, "ArraySize"),
315     (DXGI_FORMAT, "Format"),
316     (D3D10_USAGE, "Usage"),
317     (D3D10_BIND_FLAG, "BindFlags"),
318     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
319     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
320 ])
321
322 D3D10_TEXTURE2D_DESC = Struct("D3D10_TEXTURE2D_DESC", [
323     (UINT, "Width"),
324     (UINT, "Height"),
325     (UINT, "MipLevels"),
326     (UINT, "ArraySize"),
327     (DXGI_FORMAT, "Format"),
328     (DXGI_SAMPLE_DESC, "SampleDesc"),
329     (D3D10_USAGE, "Usage"),
330     (D3D10_BIND_FLAG, "BindFlags"),
331     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
332     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
333 ])
334
335 D3D10_TEXTURE3D_DESC = Struct("D3D10_TEXTURE3D_DESC", [
336     (UINT, "Width"),
337     (UINT, "Height"),
338     (UINT, "Depth"),
339     (UINT, "MipLevels"),
340     (DXGI_FORMAT, "Format"),
341     (D3D10_USAGE, "Usage"),
342     (D3D10_BIND_FLAG, "BindFlags"),
343     (D3D10_CPU_ACCESS_FLAG, "CPUAccessFlags"),
344     (D3D10_RESOURCE_MISC_FLAG, "MiscFlags"),
345 ])
346
347 D3D10_DSV_DIMENSION = Enum("D3D10_DSV_DIMENSION", [
348     "D3D10_DSV_DIMENSION_UNKNOWN",
349     "D3D10_DSV_DIMENSION_TEXTURE1D",
350     "D3D10_DSV_DIMENSION_TEXTURE1DARRAY",
351     "D3D10_DSV_DIMENSION_TEXTURE2D",
352     "D3D10_DSV_DIMENSION_TEXTURE2DARRAY",
353     "D3D10_DSV_DIMENSION_TEXTURE2DMS",
354     "D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY",
355 ])
356
357 D3D10_TEX1D_DSV = Struct("D3D10_TEX1D_DSV", [
358     (UINT, "MipSlice"),
359 ])
360
361 D3D10_TEX1D_ARRAY_DSV = Struct("D3D10_TEX1D_ARRAY_DSV", [
362     (UINT, "MipSlice"),
363     (UINT, "FirstArraySlice"),
364     (UINT, "ArraySize"),
365 ])
366
367 D3D10_TEX2D_DSV = Struct("D3D10_TEX2D_DSV", [
368     (UINT, "MipSlice"),
369 ])
370
371 D3D10_TEX2D_ARRAY_DSV = Struct("D3D10_TEX2D_ARRAY_DSV", [
372     (UINT, "MipSlice"),
373     (UINT, "FirstArraySlice"),
374     (UINT, "ArraySize"),
375 ])
376
377 D3D10_TEX2DMS_DSV = Struct("D3D10_TEX2DMS_DSV", [
378     (UINT, "UnusedField_NothingToDefine"),
379 ])
380
381 D3D10_TEX2DMS_ARRAY_DSV = Struct("D3D10_TEX2DMS_ARRAY_DSV", [
382     (UINT, "FirstArraySlice"),
383     (UINT, "ArraySize"),
384 ])
385
386 D3D10_DEPTH_STENCIL_VIEW_DESC = Struct("D3D10_DEPTH_STENCIL_VIEW_DESC", [
387     (DXGI_FORMAT, "Format"),
388     (D3D10_DSV_DIMENSION, "ViewDimension"),
389     (D3D10_TEX1D_DSV, "Texture1D"),
390     (D3D10_TEX1D_ARRAY_DSV, "Texture1DArray"),
391     (D3D10_TEX2D_DSV, "Texture2D"),
392     (D3D10_TEX2D_ARRAY_DSV, "Texture2DArray"),
393     (D3D10_TEX2DMS_DSV, "Texture2DMS"),
394     (D3D10_TEX2DMS_ARRAY_DSV, "Texture2DMSArray"),
395 ])
396
397 D3D10_RTV_DIMENSION = Enum("D3D10_RTV_DIMENSION", [
398     "D3D10_RTV_DIMENSION_UNKNOWN",
399     "D3D10_RTV_DIMENSION_BUFFER",
400     "D3D10_RTV_DIMENSION_TEXTURE1D",
401     "D3D10_RTV_DIMENSION_TEXTURE1DARRAY",
402     "D3D10_RTV_DIMENSION_TEXTURE2D",
403     "D3D10_RTV_DIMENSION_TEXTURE2DARRAY",
404     "D3D10_RTV_DIMENSION_TEXTURE2DMS",
405     "D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY",
406     "D3D10_RTV_DIMENSION_TEXTURE3D",
407 ])
408
409 D3D10_BUFFER_RTV = Struct("D3D10_BUFFER_RTV", [
410     (UINT, "ElementOffset"),
411     (UINT, "ElementWidth"),
412 ])
413
414 D3D10_TEX1D_RTV = Struct("D3D10_TEX1D_RTV", [
415     (UINT, "MipSlice"),
416 ])
417
418 D3D10_TEX1D_ARRAY_RTV = Struct("D3D10_TEX1D_ARRAY_RTV", [
419     (UINT, "MipSlice"),
420     (UINT, "FirstArraySlice"),
421     (UINT, "ArraySize"),
422 ])
423
424 D3D10_TEX2D_RTV = Struct("D3D10_TEX2D_RTV", [
425     (UINT, "MipSlice"),
426 ])
427
428 D3D10_TEX2D_ARRAY_RTV = Struct("D3D10_TEX2D_ARRAY_RTV", [
429     (UINT, "MipSlice"),
430     (UINT, "FirstArraySlice"),
431     (UINT, "ArraySize"),
432 ])
433
434 D3D10_TEX2DMS_RTV = Struct("D3D10_TEX2DMS_RTV", [
435     (UINT, "UnusedField_NothingToDefine"),
436 ])
437
438 D3D10_TEX2DMS_ARRAY_RTV = Struct("D3D10_TEX2DMS_ARRAY_RTV", [
439     (UINT, "FirstArraySlice"),
440     (UINT, "ArraySize"),
441 ])
442
443 D3D10_TEX3D_RTV = Struct("D3D10_TEX3D_RTV", [
444     (UINT, "MipSlice"),
445     (UINT, "FirstWSlice"),
446     (UINT, "WSize"),
447 ])
448
449 D3D10_RENDER_TARGET_VIEW_DESC = Struct("D3D10_RENDER_TARGET_VIEW_DESC", [
450     (DXGI_FORMAT, "Format"),
451     (D3D10_RTV_DIMENSION, "ViewDimension"),
452     (D3D10_BUFFER_RTV, "Buffer"),
453     (D3D10_TEX1D_RTV, "Texture1D"),
454     (D3D10_TEX1D_ARRAY_RTV, "Texture1DArray"),
455     (D3D10_TEX2D_RTV, "Texture2D"),
456     (D3D10_TEX2D_ARRAY_RTV, "Texture2DArray"),
457     (D3D10_TEX2DMS_RTV, "Texture2DMS"),
458     (D3D10_TEX2DMS_ARRAY_RTV, "Texture2DMSArray"),
459     (D3D10_TEX3D_RTV, "Texture3D"),
460 ])
461
462 D3D10_SRV_DIMENSION = Enum("D3D10_SRV_DIMENSION", [
463     "D3D10_SRV_DIMENSION_UNKNOWN",
464         "D3D10_SRV_DIMENSION_BUFFER",
465         "D3D10_SRV_DIMENSION_TEXTURE1D",
466         "D3D10_SRV_DIMENSION_TEXTURE1DARRAY",
467         "D3D10_SRV_DIMENSION_TEXTURE2D",
468         "D3D10_SRV_DIMENSION_TEXTURE2DARRAY",
469         "D3D10_SRV_DIMENSION_TEXTURE2DMS",
470         "D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY",
471         "D3D10_SRV_DIMENSION_TEXTURE3D",
472         "D3D10_SRV_DIMENSION_TEXTURECUBE",
473 ])
474
475 D3D10_BUFFER_SRV = Struct("D3D10_BUFFER_SRV", [
476     (UINT, "ElementOffset"),
477     (UINT, "ElementWidth"),
478 ])
479
480 D3D10_TEX1D_SRV = Struct("D3D10_TEX1D_SRV", [
481     (UINT, "MostDetailedMip"),
482     (UINT, "MipLevels"),
483 ])
484
485 D3D10_TEX1D_ARRAY_SRV = Struct("D3D10_TEX1D_ARRAY_SRV", [
486     (UINT, "MostDetailedMip"),
487     (UINT, "MipLevels"),
488     (UINT, "FirstArraySlice"),
489     (UINT, "ArraySize"),
490 ])
491
492 D3D10_TEX2D_SRV = Struct("D3D10_TEX2D_SRV", [
493     (UINT, "MostDetailedMip"),
494     (UINT, "MipLevels"),
495 ])
496
497 D3D10_TEX2D_ARRAY_SRV = Struct("D3D10_TEX2D_ARRAY_SRV", [
498     (UINT, "MostDetailedMip"),
499     (UINT, "MipLevels"),
500     (UINT, "FirstArraySlice"),
501     (UINT, "ArraySize"),
502 ])
503
504 D3D10_TEX2DMS_SRV = Struct("D3D10_TEX2DMS_SRV", [
505     (UINT, "UnusedField_NothingToDefine"),
506 ])
507
508 D3D10_TEX2DMS_ARRAY_SRV = Struct("D3D10_TEX2DMS_ARRAY_SRV", [
509     (UINT, "FirstArraySlice"),
510     (UINT, "ArraySize"),
511 ])
512
513 D3D10_TEX3D_SRV = Struct("D3D10_TEX3D_SRV", [
514     (UINT, "MostDetailedMip"),
515     (UINT, "MipLevels"),
516 ])
517
518 D3D10_TEXCUBE_SRV = Struct("D3D10_TEXCUBE_SRV", [
519     (UINT, "MostDetailedMip"),
520     (UINT, "MipLevels"),
521 ])
522
523 D3D10_SHADER_RESOURCE_VIEW_DESC = Struct("D3D10_SHADER_RESOURCE_VIEW_DESC", [
524     (DXGI_FORMAT, "Format"),
525     (D3D10_SRV_DIMENSION, "ViewDimension"),
526     (D3D10_BUFFER_SRV, "Buffer"),
527     (D3D10_TEX1D_SRV, "Texture1D"),
528     (D3D10_TEX1D_ARRAY_SRV, "Texture1DArray"),
529     (D3D10_TEX2D_SRV, "Texture2D"),
530     (D3D10_TEX2D_ARRAY_SRV, "Texture2DArray"),
531     (D3D10_TEX2DMS_SRV, "Texture2DMS"),
532     (D3D10_TEX2DMS_ARRAY_SRV, "Texture2DMSArray"),
533     (D3D10_TEX3D_SRV, "Texture3D"),
534     (D3D10_TEXCUBE_SRV, "TextureCube"),
535 ])
536
537 D3D10_BOX = Struct("D3D10_BOX", [
538     (UINT, "left"),
539     (UINT, "top"),
540     (UINT, "front"),
541     (UINT, "right"),
542     (UINT, "bottom"),
543     (UINT, "back"),
544 ])
545
546 D3D10_SUBRESOURCE_DATA = Struct("D3D10_SUBRESOURCE_DATA", [
547     (Blob(Const(Void), "_calcSubresourceSize(pDesc, {i}, {self}.SysMemPitch, {self}.SysMemSlicePitch)"), "pSysMem"),
548     (UINT, "SysMemPitch"),
549     (UINT, "SysMemSlicePitch"),
550 ])
551
552 D3D10_SO_DECLARATION_ENTRY = Struct("D3D10_SO_DECLARATION_ENTRY", [
553     (LPCSTR, "SemanticName"),
554     (UINT, "SemanticIndex"),
555     (BYTE, "StartComponent"),
556     (BYTE, "ComponentCount"),
557     (BYTE, "OutputSlot"),
558 ])
559
560 D3D10_INPUT_CLASSIFICATION = Enum("D3D10_INPUT_CLASSIFICATION", [
561     "D3D10_INPUT_PER_VERTEX_DATA",
562     "D3D10_INPUT_PER_INSTANCE_DATA",
563 ])
564
565 D3D10_INPUT_ELEMENT_DESC = Struct("D3D10_INPUT_ELEMENT_DESC", [
566     (LPCSTR, "SemanticName"),
567     (UINT, "SemanticIndex"),
568     (DXGI_FORMAT, "Format"),
569     (UINT, "InputSlot"),
570     (UINT, "AlignedByteOffset"),
571     (D3D10_INPUT_CLASSIFICATION, "InputSlotClass"),
572     (UINT, "InstanceDataStepRate"),
573 ])
574
575 D3D10_QUERY = Enum("D3D10_QUERY", [
576     "D3D10_QUERY_EVENT",
577     "D3D10_QUERY_OCCLUSION",
578     "D3D10_QUERY_TIMESTAMP",
579     "D3D10_QUERY_TIMESTAMP_DISJOINT",
580     "D3D10_QUERY_PIPELINE_STATISTICS",
581     "D3D10_QUERY_OCCLUSION_PREDICATE",
582     "D3D10_QUERY_SO_STATISTICS",
583     "D3D10_QUERY_SO_OVERFLOW_PREDICATE",
584 ])
585
586 D3D10_QUERY_MISC_FLAG = Flags(UINT, [
587     "D3D10_QUERY_MISC_PREDICATEHINT",
588 ])
589
590 D3D10_QUERY_DESC = Struct("D3D10_QUERY_DESC", [
591     (D3D10_QUERY, "Query"),
592     (D3D10_QUERY_MISC_FLAG, "MiscFlags"),
593 ])
594
595 D3D10_RECT = Alias("D3D10_RECT", RECT)
596 D3D10_VIEWPORT = Struct("D3D10_VIEWPORT", [
597     (INT, "TopLeftX"),
598     (INT, "TopLeftY"),
599     (UINT, "Width"),
600     (UINT, "Height"),
601     (FLOAT, "MinDepth"),
602     (FLOAT, "MaxDepth"),
603 ])
604
605 D3D10_MAPPED_TEXTURE2D = Struct("D3D10_MAPPED_TEXTURE2D", [
606     (LinearPointer(Void, "_MappedSize"), "pData"),
607     (UINT, "RowPitch"),
608 ])
609
610 D3D10_MAPPED_TEXTURE3D = Struct("D3D10_MAPPED_TEXTURE3D", [
611     (LinearPointer(Void, "_MappedSize"), "pData"),
612     (UINT, "RowPitch"),
613     (UINT, "DepthPitch"),
614 ])
615
616 D3D10_MAP_FLAG = Flags(UINT, [
617     "D3D10_MAP_FLAG_DO_NOT_WAIT",
618 ])
619
620 D3D10_CLEAR_FLAG = Flags(UINT, [
621     "D3D10_CLEAR_DEPTH",
622     "D3D10_CLEAR_STENCIL",
623 ])
624
625 D3D10_COLOR_WRITE_ENABLE = Flags(UINT, [
626     "D3D10_COLOR_WRITE_ENABLE_ALL",
627     "D3D10_COLOR_WRITE_ENABLE_RED",
628     "D3D10_COLOR_WRITE_ENABLE_GREEN",
629     "D3D10_COLOR_WRITE_ENABLE_BLUE",
630     "D3D10_COLOR_WRITE_ENABLE_ALPHA",
631 ])
632
633 D3D10_TEXTURECUBE_FACE = Enum("D3D10_TEXTURECUBE_FACE", [
634     "D3D10_TEXTURECUBE_FACE_POSITIVE_X",
635     "D3D10_TEXTURECUBE_FACE_NEGATIVE_X",
636     "D3D10_TEXTURECUBE_FACE_POSITIVE_Y",
637     "D3D10_TEXTURECUBE_FACE_NEGATIVE_Y",
638     "D3D10_TEXTURECUBE_FACE_POSITIVE_Z",
639     "D3D10_TEXTURECUBE_FACE_NEGATIVE_Z",
640 ])
641
642 D3D10_ASYNC_GETDATA_FLAG = Flags(UINT, [
643     "D3D10_ASYNC_GETDATA_DONOTFLUSH",
644 ])
645
646 D3D10_FILTER_TYPE = Enum("D3D10_FILTER_TYPE", [
647     "D3D10_FILTER_TYPE_POINT",
648     "D3D10_FILTER_TYPE_LINEAR",
649 ])
650
651 D3D10_QUERY_DATA_TIMESTAMP_DISJOINT = Struct("D3D10_QUERY_DATA_TIMESTAMP_DISJOINT", [
652     (UINT64, "Frequency"),
653     (BOOL, "Disjoint"),
654 ])
655
656 D3D10_QUERY_DATA_PIPELINE_STATISTICS = Struct("D3D10_QUERY_DATA_PIPELINE_STATISTICS", [
657     (UINT64, "IAVertices"),
658     (UINT64, "IAPrimitives"),
659     (UINT64, "VSInvocations"),
660     (UINT64, "GSInvocations"),
661     (UINT64, "GSPrimitives"),
662     (UINT64, "CInvocations"),
663     (UINT64, "CPrimitives"),
664     (UINT64, "PSInvocations"),
665 ])
666
667 D3D10_QUERY_DATA_SO_STATISTICS = Struct("D3D10_QUERY_DATA_SO_STATISTICS", [
668     (UINT64, "NumPrimitivesWritten"),
669     (UINT64, "PrimitivesStorageNeeded"),
670 ])
671
672 D3D10_CREATE_DEVICE_FLAG = Flags(UINT, [
673     "D3D10_CREATE_DEVICE_SINGLETHREADED",
674     "D3D10_CREATE_DEVICE_DEBUG",
675     "D3D10_CREATE_DEVICE_SWITCH_TO_REF",
676     "D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS",
677     "D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP",
678     "D3D10_CREATE_DEVICE_BGRA_SUPPORT",
679     "D3D10_CREATE_DEVICE_STRICT_VALIDATION",
680 ])
681
682 D3D10_RAISE_FLAG = Flags(UINT, [
683     "D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR",
684 ])
685
686 ID3D10DeviceChild = Interface("ID3D10DeviceChild", IUnknown)
687 ID3D10Resource = Interface("ID3D10Resource", ID3D10DeviceChild)
688 ID3D10Buffer = Interface("ID3D10Buffer", ID3D10Resource)
689 ID3D10Texture1D = Interface("ID3D10Texture1D", ID3D10Resource)
690 ID3D10Texture2D = Interface("ID3D10Texture2D", ID3D10Resource)
691 ID3D10Texture3D = Interface("ID3D10Texture3D", ID3D10Resource)
692 ID3D10View = Interface("ID3D10View", ID3D10DeviceChild)
693 ID3D10DepthStencilView = Interface("ID3D10DepthStencilView", ID3D10View)
694 ID3D10RenderTargetView = Interface("ID3D10RenderTargetView", ID3D10View)
695 ID3D10ShaderResourceView = Interface("ID3D10ShaderResourceView", ID3D10View)
696 ID3D10BlendState = Interface("ID3D10BlendState", ID3D10DeviceChild)
697 ID3D10DepthStencilState = Interface("ID3D10DepthStencilState", ID3D10DeviceChild)
698 ID3D10GeometryShader = Interface("ID3D10GeometryShader", ID3D10DeviceChild)
699 ID3D10InputLayout = Interface("ID3D10InputLayout", ID3D10DeviceChild)
700 ID3D10PixelShader = Interface("ID3D10PixelShader", ID3D10DeviceChild)
701 ID3D10RasterizerState = Interface("ID3D10RasterizerState", ID3D10DeviceChild)
702 ID3D10SamplerState = Interface("ID3D10SamplerState", ID3D10DeviceChild)
703 ID3D10VertexShader = Interface("ID3D10VertexShader", ID3D10DeviceChild)
704 ID3D10Asynchronous = Interface("ID3D10Asynchronous", ID3D10DeviceChild)
705 ID3D10Counter = Interface("ID3D10Counter", ID3D10Asynchronous)
706 ID3D10Query = Interface("ID3D10Query", ID3D10Asynchronous)
707 ID3D10Predicate = Interface("ID3D10Predicate", ID3D10Query)
708 ID3D10Device = Interface("ID3D10Device", IUnknown)
709 ID3D10Multithread = Interface("ID3D10Multithread", IUnknown)
710
711 ID3D10DeviceChild.methods += [
712     StdMethod(Void, "GetDevice", [Out(Pointer(ObjPointer(ID3D10Device)), "ppDevice")]),
713     StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False),
714     StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False),
715     StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False),
716 ]
717
718 ID3D10Resource.methods += [
719     StdMethod(Void, "GetType", [Out(Pointer(D3D10_RESOURCE_DIMENSION), "rType")], sideeffects=False),
720     StdMethod(Void, "SetEvictionPriority", [(UINT, "EvictionPriority")]),
721     StdMethod(UINT, "GetEvictionPriority", [], sideeffects=False),
722 ]
723
724 ID3D10Buffer.methods += [
725     StdMethod(HRESULT, "Map", [(D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppData")]),
726     StdMethod(Void, "Unmap", []),
727     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_BUFFER_DESC), "pDesc")], sideeffects=False),
728 ]
729
730 ID3D10Texture1D.methods += [
731     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppData")]),
732     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
733     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE1D_DESC), "pDesc")], sideeffects=False),
734 ]
735
736 ID3D10Texture2D.methods += [
737     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(D3D10_MAPPED_TEXTURE2D), "pMappedTex2D")]),
738     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
739     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE2D_DESC), "pDesc")], sideeffects=False),
740 ]
741
742 ID3D10Texture3D.methods += [
743     StdMethod(HRESULT, "Map", [(UINT, "Subresource"), (D3D10_MAP, "MapType"), (D3D10_MAP_FLAG, "MapFlags"), Out(Pointer(D3D10_MAPPED_TEXTURE3D), "pMappedTex3D")]),
744     StdMethod(Void, "Unmap", [(UINT, "Subresource")]),
745     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_TEXTURE3D_DESC), "pDesc")], sideeffects=False),
746 ]
747
748 ID3D10View.methods += [
749     StdMethod(Void, "GetResource", [Out(Pointer(ObjPointer(ID3D10Resource)), "ppResource")]),
750 ]
751
752 ID3D10DepthStencilView.methods += [
753     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_DEPTH_STENCIL_VIEW_DESC), "pDesc")], sideeffects=False),
754 ]
755
756 ID3D10RenderTargetView.methods += [
757     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_RENDER_TARGET_VIEW_DESC), "pDesc")], sideeffects=False),
758 ]
759
760 ID3D10ShaderResourceView.methods += [
761     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_SHADER_RESOURCE_VIEW_DESC), "pDesc")], sideeffects=False),
762 ]
763
764 ID3D10BlendState.methods += [
765     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_BLEND_DESC), "pDesc")], sideeffects=False),
766 ]
767
768 ID3D10DepthStencilState.methods += [
769     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_DEPTH_STENCIL_DESC), "pDesc")], sideeffects=False),
770 ]
771
772 ID3D10RasterizerState.methods += [
773     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_RASTERIZER_DESC), "pDesc")], sideeffects=False),
774 ]
775
776 ID3D10SamplerState.methods += [
777     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_SAMPLER_DESC), "pDesc")], sideeffects=False),
778 ]
779
780 ID3D10Asynchronous.methods += [
781     StdMethod(Void, "Begin", []),
782     StdMethod(Void, "End", []),
783     StdMethod(HRESULT, "GetData", [Out(Blob(Void, "DataSize"), "pData"), (UINT, "DataSize"), (D3D10_ASYNC_GETDATA_FLAG, "GetDataFlags")], sideeffects=False),
784     StdMethod(UINT, "GetDataSize", [], sideeffects=False),
785 ]
786
787 ID3D10Counter.methods += [
788     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_COUNTER_DESC), "pDesc")], sideeffects=False),
789 ]
790
791 ID3D10Query.methods += [
792     StdMethod(Void, "GetDesc", [Out(Pointer(D3D10_QUERY_DESC), "pDesc")], sideeffects=False),
793 ]
794
795 ID3D10Device.methods += [
796     StdMethod(Void, "VSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
797     StdMethod(Void, "PSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
798     StdMethod(Void, "PSSetShader", [(ObjPointer(ID3D10PixelShader), "pPixelShader")]),
799     StdMethod(Void, "PSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
800     StdMethod(Void, "VSSetShader", [(ObjPointer(ID3D10VertexShader), "pVertexShader")]),
801     StdMethod(Void, "DrawIndexed", [(UINT, "IndexCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation")]),
802     StdMethod(Void, "Draw", [(UINT, "VertexCount"), (UINT, "StartVertexLocation")]),
803     StdMethod(Void, "PSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
804     StdMethod(Void, "IASetInputLayout", [(ObjPointer(ID3D10InputLayout), "pInputLayout")]),
805     StdMethod(Void, "IASetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppVertexBuffers"), (Array(Const(UINT), "NumBuffers"), "pStrides"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]),
806     StdMethod(Void, "IASetIndexBuffer", [(ObjPointer(ID3D10Buffer), "pIndexBuffer"), (DXGI_FORMAT, "Format"), (UINT, "Offset")]),
807     StdMethod(Void, "DrawIndexedInstanced", [(UINT, "IndexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation"), (UINT, "StartInstanceLocation")]),
808     StdMethod(Void, "DrawInstanced", [(UINT, "VertexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartVertexLocation"), (UINT, "StartInstanceLocation")]),
809     StdMethod(Void, "GSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppConstantBuffers")]),
810     StdMethod(Void, "GSSetShader", [(ObjPointer(ID3D10GeometryShader), "pShader")]),
811     StdMethod(Void, "IASetPrimitiveTopology", [(D3D10_PRIMITIVE_TOPOLOGY, "Topology")]),
812     StdMethod(Void, "VSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
813     StdMethod(Void, "VSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
814     StdMethod(Void, "SetPredication", [(ObjPointer(ID3D10Predicate), "pPredicate"), (BOOL, "PredicateValue")]),
815     StdMethod(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
816     StdMethod(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
817     StdMethod(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(ObjPointer(ID3D10RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (ObjPointer(ID3D10DepthStencilView), "pDepthStencilView")]),
818     StdMethod(Void, "OMSetBlendState", [(ObjPointer(ID3D10BlendState), "pBlendState"), (Array(Const(FLOAT), 4), "BlendFactor"), (UINT, "SampleMask")]),
819     StdMethod(Void, "OMSetDepthStencilState", [(ObjPointer(ID3D10DepthStencilState), "pDepthStencilState"), (UINT, "StencilRef")]),
820     StdMethod(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D10Buffer)), "NumBuffers"), "ppSOTargets"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]),
821     StdMethod(Void, "DrawAuto", []),
822     StdMethod(Void, "RSSetState", [(ObjPointer(ID3D10RasterizerState), "pRasterizerState")]),
823     StdMethod(Void, "RSSetViewports", [(UINT, "NumViewports"), (Array(Const(D3D10_VIEWPORT), "NumViewports"), "pViewports")]),
824     StdMethod(Void, "RSSetScissorRects", [(UINT, "NumRects"), (Array(Const(D3D10_RECT), "NumRects"), "pRects")]),
825     StdMethod(Void, "CopySubresourceRegion", [(ObjPointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (UINT, "DstX"), (UINT, "DstY"), (UINT, "DstZ"), (ObjPointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (Pointer(Const(D3D10_BOX)), "pSrcBox")]),
826     StdMethod(Void, "CopyResource", [(ObjPointer(ID3D10Resource), "pDstResource"), (ObjPointer(ID3D10Resource), "pSrcResource")]),
827     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")]),
828     StdMethod(Void, "ClearRenderTargetView", [(ObjPointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]),
829     StdMethod(Void, "ClearDepthStencilView", [(ObjPointer(ID3D10DepthStencilView), "pDepthStencilView"), (D3D10_CLEAR_FLAG, "ClearFlags"), (FLOAT, "Depth"), (UINT8, "Stencil")]),
830     StdMethod(Void, "GenerateMips", [(ObjPointer(ID3D10ShaderResourceView), "pShaderResourceView")]),
831     StdMethod(Void, "ResolveSubresource", [(ObjPointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (ObjPointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (DXGI_FORMAT, "Format")]),
832     StdMethod(Void, "VSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
833     StdMethod(Void, "PSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
834     StdMethod(Void, "PSGetShader", [Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPixelShader")]),
835     StdMethod(Void, "PSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
836     StdMethod(Void, "VSGetShader", [Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVertexShader")]),
837     StdMethod(Void, "PSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
838     StdMethod(Void, "IAGetInputLayout", [Out(Pointer(ObjPointer(ID3D10InputLayout)), "ppInputLayout")]),
839     StdMethod(Void, "IAGetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppVertexBuffers"), Out(Array(UINT, "NumBuffers"), "pStrides"), Out(Array(UINT, "NumBuffers"), "pOffsets")]),
840     StdMethod(Void, "IAGetIndexBuffer", [Out(Pointer(ObjPointer(ID3D10Buffer)), "pIndexBuffer"), Out(Pointer(DXGI_FORMAT), "Format"), Out(Pointer(UINT), "Offset")]),
841     StdMethod(Void, "GSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppConstantBuffers")]),
842     StdMethod(Void, "GSGetShader", [Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGeometryShader")]),
843     StdMethod(Void, "IAGetPrimitiveTopology", [Out(Pointer(D3D10_PRIMITIVE_TOPOLOGY), "pTopology")], sideeffects=False),
844     StdMethod(Void, "VSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
845     StdMethod(Void, "VSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
846     StdMethod(Void, "GetPredication", [Out(Pointer(ObjPointer(ID3D10Predicate)), "ppPredicate"), Out(Pointer(BOOL), "pPredicateValue")]),
847     StdMethod(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(ObjPointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
848     StdMethod(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(ObjPointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
849     StdMethod(Void, "OMGetRenderTargets", [(UINT, "NumViews"), Out(Array(ObjPointer(ID3D10RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppDepthStencilView")]),
850     StdMethod(Void, "OMGetBlendState", [Out(Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState"), Out(Array(FLOAT, 4), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]),
851     StdMethod(Void, "OMGetDepthStencilState", [Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState"), Out(Pointer(UINT), "pStencilRef")]),
852     StdMethod(Void, "SOGetTargets", [(UINT, "NumBuffers"), Out(Array(ObjPointer(ID3D10Buffer), "NumBuffers"), "ppSOTargets"), Out(Array(UINT, "NumBuffers"), "pOffsets")]),
853     StdMethod(Void, "RSGetState", [Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]),
854     StdMethod(Void, "RSGetViewports", [Out(Pointer(UINT), "NumViewports"), Out(Array(D3D10_VIEWPORT, "*NumViewports"), "pViewports")], sideeffects=False),
855     StdMethod(Void, "RSGetScissorRects", [Out(Pointer(UINT), "NumRects"), Out(Array(D3D10_RECT, "*NumRects"), "pRects")], sideeffects=False),
856     StdMethod(HRESULT, "GetDeviceRemovedReason", [], sideeffects=False),
857     StdMethod(HRESULT, "SetExceptionMode", [(D3D10_RAISE_FLAG, "RaiseFlags")]),
858     StdMethod(D3D10_RAISE_FLAG, "GetExceptionMode", [], sideeffects=False),
859     StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False),
860     StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False),
861     StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False),
862     StdMethod(Void, "ClearState", []),
863     StdMethod(Void, "Flush", []),
864     StdMethod(HRESULT, "CreateBuffer", [(Pointer(Const(D3D10_BUFFER_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "1"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Buffer)), "ppBuffer")]),
865     StdMethod(HRESULT, "CreateTexture1D", [(Pointer(Const(D3D10_TEXTURE1D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture1D)), "ppTexture1D")]),
866     StdMethod(HRESULT, "CreateTexture2D", [(Pointer(Const(D3D10_TEXTURE2D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture2D)), "ppTexture2D")]),
867     StdMethod(HRESULT, "CreateTexture3D", [(Pointer(Const(D3D10_TEXTURE3D_DESC)), "pDesc"), (Array(Const(D3D10_SUBRESOURCE_DATA), "_getNumSubResources(pDesc)"), "pInitialData"), Out(Pointer(ObjPointer(ID3D10Texture3D)), "ppTexture3D")]),
868     StdMethod(HRESULT, "CreateShaderResourceView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_SHADER_RESOURCE_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10ShaderResourceView)), "ppSRView")]),
869     StdMethod(HRESULT, "CreateRenderTargetView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_RENDER_TARGET_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10RenderTargetView)), "ppRTView")]),
870     StdMethod(HRESULT, "CreateDepthStencilView", [(ObjPointer(ID3D10Resource), "pResource"), (Pointer(Const(D3D10_DEPTH_STENCIL_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D10DepthStencilView)), "ppDepthStencilView")]),
871     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")]),
872     StdMethod(HRESULT, "CreateVertexShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10VertexShader)), "ppVertexShader")]),
873     StdMethod(HRESULT, "CreateGeometryShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10GeometryShader)), "ppGeometryShader")]),
874     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")]),
875     StdMethod(HRESULT, "CreatePixelShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D10PixelShader)), "ppPixelShader")]),
876     StdMethod(HRESULT, "CreateBlendState", [(Pointer(Const(D3D10_BLEND_DESC)), "pBlendStateDesc"), Out(Pointer(ObjPointer(ID3D10BlendState)), "ppBlendState")]),
877     StdMethod(HRESULT, "CreateDepthStencilState", [(Pointer(Const(D3D10_DEPTH_STENCIL_DESC)), "pDepthStencilDesc"), Out(Pointer(ObjPointer(ID3D10DepthStencilState)), "ppDepthStencilState")]),
878     StdMethod(HRESULT, "CreateRasterizerState", [(Pointer(Const(D3D10_RASTERIZER_DESC)), "pRasterizerDesc"), Out(Pointer(ObjPointer(ID3D10RasterizerState)), "ppRasterizerState")]),
879     StdMethod(HRESULT, "CreateSamplerState", [(Pointer(Const(D3D10_SAMPLER_DESC)), "pSamplerDesc"), Out(Pointer(ObjPointer(ID3D10SamplerState)), "ppSamplerState")]),
880     StdMethod(HRESULT, "CreateQuery", [(Pointer(Const(D3D10_QUERY_DESC)), "pQueryDesc"), Out(Pointer(ObjPointer(ID3D10Query)), "ppQuery")]),
881     StdMethod(HRESULT, "CreatePredicate", [(Pointer(Const(D3D10_QUERY_DESC)), "pPredicateDesc"), Out(Pointer(ObjPointer(ID3D10Predicate)), "ppPredicate")]),
882     StdMethod(HRESULT, "CreateCounter", [(Pointer(Const(D3D10_COUNTER_DESC)), "pCounterDesc"), Out(Pointer(ObjPointer(ID3D10Counter)), "ppCounter")]),
883     StdMethod(HRESULT, "CheckFormatSupport", [(DXGI_FORMAT, "Format"), Out(Pointer(D3D10_FORMAT_SUPPORT), "pFormatSupport")], sideeffects=False),
884     StdMethod(HRESULT, "CheckMultisampleQualityLevels", [(DXGI_FORMAT, "Format"), (UINT, "SampleCount"), Out(Pointer(UINT), "pNumQualityLevels")], sideeffects=False),
885     StdMethod(Void, "CheckCounterInfo", [Out(Pointer(D3D10_COUNTER_INFO), "pCounterInfo")]),
886     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),
887     StdMethod(D3D10_CREATE_DEVICE_FLAG, "GetCreationFlags", [], sideeffects=False),
888     StdMethod(HRESULT, "OpenSharedResource", [(HANDLE, "hResource"), (REFIID, "ReturnedInterface"), Out(Pointer(ObjPointer(Void)), "ppResource")]),
889     StdMethod(Void, "SetTextFilterSize", [(UINT, "Width"), (UINT, "Height")]),
890     StdMethod(Void, "GetTextFilterSize", [Out(Pointer(UINT), "pWidth"), Out(Pointer(UINT), "pHeight")], sideeffects=False),
891 ]
892
893 ID3D10Multithread.methods += [
894     StdMethod(Void, "Enter", []),
895     StdMethod(Void, "Leave", []),
896     StdMethod(BOOL, "SetMultithreadProtected", [(BOOL, "bMTProtect")]),
897     StdMethod(BOOL, "GetMultithreadProtected", [], sideeffects=False),
898 ]
899
900
901 d3d10 = Module("d3d10")
902
903
904 from d3d10sdklayers import *
905 import d3d10misc
906 import d3d10shader
907 import d3d10effect