1 ##########################################################################
3 # Copyright 2008-2009 VMware, Inc.
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:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
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
24 ##########################################################################/
29 from d3d9types import *
31 D3DVS20CAPS = Flags(DWORD, [
32 "D3DVS20CAPS_PREDICATION",
35 D3DVSHADERCAPS2_0 = Struct("D3DVSHADERCAPS2_0", [
36 (D3DVS20CAPS, "Caps"),
37 (INT, "DynamicFlowControlDepth"),
39 (INT, "StaticFlowControlDepth"),
42 D3DPS20CAPS = Flags(DWORD, [
43 "D3DPS20CAPS_ARBITRARYSWIZZLE",
44 "D3DPS20CAPS_GRADIENTINSTRUCTIONS",
45 "D3DPS20CAPS_PREDICATION",
46 "D3DPS20CAPS_NODEPENDENTREADLIMIT",
47 "D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT",
50 D3DPSHADERCAPS2_0 = Struct("D3DPSHADERCAPS2_0", [
51 (D3DPS20CAPS, "Caps"),
52 (INT, "DynamicFlowControlDepth"),
54 (INT, "StaticFlowControlDepth"),
55 (INT, "NumInstructionSlots"),
58 D3DCAPS = Flags(DWORD, [
59 "D3DCAPS_READ_SCANLINE",
62 D3DCAPS2 = Flags(DWORD, [
63 "D3DCAPS2_FULLSCREENGAMMA",
64 "D3DCAPS2_CANCALIBRATEGAMMA",
66 "D3DCAPS2_CANMANAGERESOURCE",
67 "D3DCAPS2_DYNAMICTEXTURES",
68 "D3DCAPS2_CANAUTOGENMIPMAP",
69 "D3DCAPS2_CANSHARERESOURCE",
72 D3DCAPS3 = Flags(DWORD, [
74 "D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD",
75 "D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION",
76 "D3DCAPS3_COPY_TO_VIDMEM",
77 "D3DCAPS3_COPY_TO_SYSTEMMEM",
81 D3DCURSORCAPS = Flags(DWORD, [
82 "D3DCURSORCAPS_COLOR",
83 "D3DCURSORCAPS_LOWRES",
86 D3DDEVCAPS = Flags(DWORD, [
87 "D3DDEVCAPS_EXECUTESYSTEMMEMORY",
88 "D3DDEVCAPS_EXECUTEVIDEOMEMORY",
89 "D3DDEVCAPS_TLVERTEXSYSTEMMEMORY",
90 "D3DDEVCAPS_TLVERTEXVIDEOMEMORY",
91 "D3DDEVCAPS_TEXTURESYSTEMMEMORY",
92 "D3DDEVCAPS_TEXTUREVIDEOMEMORY",
93 "D3DDEVCAPS_DRAWPRIMTLVERTEX",
94 "D3DDEVCAPS_CANRENDERAFTERFLIP",
95 "D3DDEVCAPS_TEXTURENONLOCALVIDMEM",
96 "D3DDEVCAPS_DRAWPRIMITIVES2",
97 "D3DDEVCAPS_SEPARATETEXTUREMEMORIES",
98 "D3DDEVCAPS_DRAWPRIMITIVES2EX",
99 "D3DDEVCAPS_HWTRANSFORMANDLIGHT",
100 "D3DDEVCAPS_CANBLTSYSTONONLOCAL",
101 "D3DDEVCAPS_HWRASTERIZATION",
102 "D3DDEVCAPS_PUREDEVICE",
103 "D3DDEVCAPS_QUINTICRTPATCHES",
104 "D3DDEVCAPS_RTPATCHES",
105 "D3DDEVCAPS_RTPATCHHANDLEZERO",
106 "D3DDEVCAPS_NPATCHES",
109 D3DPMISCCAPS = Flags(DWORD, [
110 "D3DPMISCCAPS_MASKZ",
111 "D3DPMISCCAPS_CULLNONE",
112 "D3DPMISCCAPS_CULLCW",
113 "D3DPMISCCAPS_CULLCCW",
114 "D3DPMISCCAPS_COLORWRITEENABLE",
115 "D3DPMISCCAPS_CLIPPLANESCALEDPOINTS",
116 "D3DPMISCCAPS_CLIPTLVERTS",
117 "D3DPMISCCAPS_TSSARGTEMP",
118 "D3DPMISCCAPS_BLENDOP",
119 "D3DPMISCCAPS_NULLREFERENCE",
120 "D3DPMISCCAPS_INDEPENDENTWRITEMASKS",
121 "D3DPMISCCAPS_PERSTAGECONSTANT",
122 "D3DPMISCCAPS_FOGANDSPECULARALPHA",
123 "D3DPMISCCAPS_SEPARATEALPHABLEND",
124 "D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS",
125 "D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING",
126 "D3DPMISCCAPS_FOGVERTEXCLAMPED",
127 "D3DPMISCCAPS_POSTBLENDSRGBCONVERT",
130 D3DLINECAPS = Flags(DWORD, [
131 "D3DLINECAPS_TEXTURE",
134 "D3DLINECAPS_ALPHACMP",
136 "D3DLINECAPS_ANTIALIAS",
139 D3DPRASTERCAPS = Flags(DWORD, [
140 "D3DPRASTERCAPS_DITHER",
141 "D3DPRASTERCAPS_ZTEST",
142 "D3DPRASTERCAPS_FOGVERTEX",
143 "D3DPRASTERCAPS_FOGTABLE",
144 "D3DPRASTERCAPS_MIPMAPLODBIAS",
145 "D3DPRASTERCAPS_ZBUFFERLESSHSR",
146 "D3DPRASTERCAPS_FOGRANGE",
147 "D3DPRASTERCAPS_ANISOTROPY",
148 "D3DPRASTERCAPS_WBUFFER",
149 "D3DPRASTERCAPS_WFOG",
150 "D3DPRASTERCAPS_ZFOG",
151 "D3DPRASTERCAPS_COLORPERSPECTIVE",
152 "D3DPRASTERCAPS_SCISSORTEST",
153 "D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS",
154 "D3DPRASTERCAPS_DEPTHBIAS",
155 "D3DPRASTERCAPS_MULTISAMPLE_TOGGLE",
158 D3DPCMPCAPS = Flags(DWORD, [
162 "D3DPCMPCAPS_LESSEQUAL",
163 "D3DPCMPCAPS_GREATER",
164 "D3DPCMPCAPS_NOTEQUAL",
165 "D3DPCMPCAPS_GREATEREQUAL",
166 "D3DPCMPCAPS_ALWAYS",
169 D3DPBLENDCAPS = Flags(DWORD, [
170 "D3DPBLENDCAPS_ZERO",
172 "D3DPBLENDCAPS_SRCCOLOR",
173 "D3DPBLENDCAPS_INVSRCCOLOR",
174 "D3DPBLENDCAPS_SRCALPHA",
175 "D3DPBLENDCAPS_INVSRCALPHA",
176 "D3DPBLENDCAPS_DESTALPHA",
177 "D3DPBLENDCAPS_INVDESTALPHA",
178 "D3DPBLENDCAPS_DESTCOLOR",
179 "D3DPBLENDCAPS_INVDESTCOLOR",
180 "D3DPBLENDCAPS_SRCALPHASAT",
181 "D3DPBLENDCAPS_BOTHSRCALPHA",
182 "D3DPBLENDCAPS_BOTHINVSRCALPHA",
183 "D3DPBLENDCAPS_BLENDFACTOR",
184 "D3DPBLENDCAPS_SRCCOLOR2",
185 "D3DPBLENDCAPS_INVSRCCOLOR2",
188 D3DPSHADECAPS = Flags(DWORD, [
189 "D3DPSHADECAPS_COLORGOURAUDRGB",
190 "D3DPSHADECAPS_SPECULARGOURAUDRGB",
191 "D3DPSHADECAPS_ALPHAGOURAUDBLEND",
192 "D3DPSHADECAPS_FOGGOURAUD",
195 D3DPTEXTURECAPS = Flags(DWORD, [
196 "D3DPTEXTURECAPS_PERSPECTIVE",
197 "D3DPTEXTURECAPS_POW2",
198 "D3DPTEXTURECAPS_ALPHA",
199 "D3DPTEXTURECAPS_SQUAREONLY",
200 "D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE",
201 "D3DPTEXTURECAPS_ALPHAPALETTE",
202 "D3DPTEXTURECAPS_NONPOW2CONDITIONAL",
203 "D3DPTEXTURECAPS_PROJECTED",
204 "D3DPTEXTURECAPS_CUBEMAP",
205 "D3DPTEXTURECAPS_VOLUMEMAP",
206 "D3DPTEXTURECAPS_MIPMAP",
207 "D3DPTEXTURECAPS_MIPVOLUMEMAP",
208 "D3DPTEXTURECAPS_MIPCUBEMAP",
209 "D3DPTEXTURECAPS_CUBEMAP_POW2",
210 "D3DPTEXTURECAPS_VOLUMEMAP_POW2",
211 "D3DPTEXTURECAPS_NOPROJECTEDBUMPENV",
214 D3DPTFILTERCAPS = Flags(DWORD, [
215 "D3DPTFILTERCAPS_MINFPOINT",
216 "D3DPTFILTERCAPS_MINFLINEAR",
217 "D3DPTFILTERCAPS_MINFANISOTROPIC",
218 "D3DPTFILTERCAPS_MINFPYRAMIDALQUAD",
219 "D3DPTFILTERCAPS_MINFGAUSSIANQUAD",
220 "D3DPTFILTERCAPS_MIPFPOINT",
221 "D3DPTFILTERCAPS_MIPFLINEAR",
222 "D3DPTFILTERCAPS_CONVOLUTIONMONO",
223 "D3DPTFILTERCAPS_MAGFPOINT",
224 "D3DPTFILTERCAPS_MAGFLINEAR",
225 "D3DPTFILTERCAPS_MAGFANISOTROPIC",
226 "D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD",
227 "D3DPTFILTERCAPS_MAGFGAUSSIANQUAD",
230 D3DPTADDRESSCAPS = Flags(DWORD, [
231 "D3DPTADDRESSCAPS_WRAP",
232 "D3DPTADDRESSCAPS_MIRROR",
233 "D3DPTADDRESSCAPS_CLAMP",
234 "D3DPTADDRESSCAPS_BORDER",
235 "D3DPTADDRESSCAPS_INDEPENDENTUV",
236 "D3DPTADDRESSCAPS_MIRRORONCE",
239 D3DSTENCILCAPS = Flags(DWORD, [
240 "D3DSTENCILCAPS_KEEP",
241 "D3DSTENCILCAPS_ZERO",
242 "D3DSTENCILCAPS_REPLACE",
243 "D3DSTENCILCAPS_INCRSAT",
244 "D3DSTENCILCAPS_DECRSAT",
245 "D3DSTENCILCAPS_INVERT",
246 "D3DSTENCILCAPS_INCR",
247 "D3DSTENCILCAPS_DECR",
248 "D3DSTENCILCAPS_TWOSIDED",
251 D3DTEXOPCAPS = Flags(DWORD, [
252 "D3DTEXOPCAPS_DISABLE",
253 "D3DTEXOPCAPS_SELECTARG1",
254 "D3DTEXOPCAPS_SELECTARG2",
255 "D3DTEXOPCAPS_MODULATE",
256 "D3DTEXOPCAPS_MODULATE2X",
257 "D3DTEXOPCAPS_MODULATE4X",
259 "D3DTEXOPCAPS_ADDSIGNED",
260 "D3DTEXOPCAPS_ADDSIGNED2X",
261 "D3DTEXOPCAPS_SUBTRACT",
262 "D3DTEXOPCAPS_ADDSMOOTH",
263 "D3DTEXOPCAPS_BLENDDIFFUSEALPHA",
264 "D3DTEXOPCAPS_BLENDTEXTUREALPHA",
265 "D3DTEXOPCAPS_BLENDFACTORALPHA",
266 "D3DTEXOPCAPS_BLENDTEXTUREALPHAPM",
267 "D3DTEXOPCAPS_BLENDCURRENTALPHA",
268 "D3DTEXOPCAPS_PREMODULATE",
269 "D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR",
270 "D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA",
271 "D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR",
272 "D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA",
273 "D3DTEXOPCAPS_BUMPENVMAP",
274 "D3DTEXOPCAPS_BUMPENVMAPLUMINANCE",
275 "D3DTEXOPCAPS_DOTPRODUCT3",
276 "D3DTEXOPCAPS_MULTIPLYADD",
280 D3DFVFCAPS = Flags(DWORD, [
281 "D3DFVFCAPS_TEXCOORDCOUNTMASK",
282 "D3DFVFCAPS_DONOTSTRIPELEMENTS",
286 D3DVTXPCAPS = Flags(DWORD, [
287 "D3DVTXPCAPS_TEXGEN",
288 "D3DVTXPCAPS_MATERIALSOURCE7",
289 "D3DVTXPCAPS_DIRECTIONALLIGHTS",
290 "D3DVTXPCAPS_POSITIONALLIGHTS",
291 "D3DVTXPCAPS_LOCALVIEWER",
292 "D3DVTXPCAPS_TWEENING",
293 "D3DVTXPCAPS_TEXGEN_SPHEREMAP",
294 "D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER",
297 D3DDEVCAPS2 = Flags(DWORD, [
298 "D3DDEVCAPS2_STREAMOFFSET",
299 "D3DDEVCAPS2_DMAPNPATCH",
300 "D3DDEVCAPS2_ADAPTIVETESSRTPATCH",
301 "D3DDEVCAPS2_ADAPTIVETESSNPATCH",
302 "D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES",
303 "D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH",
304 "D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET",
307 D3DDTCAPS = Flags(DWORD, [
312 "D3DDTCAPS_USHORT2N",
313 "D3DDTCAPS_USHORT4N",
316 "D3DDTCAPS_FLOAT16_2",
317 "D3DDTCAPS_FLOAT16_4",
320 #D3DPS_VERSION = Enum("DWORD", [
321 # "D3DPS_VERSION(0,0)",
322 # "D3DPS_VERSION(1,0)",
323 # "D3DPS_VERSION(1,1)",
324 # "D3DPS_VERSION(1,2)",
325 # "D3DPS_VERSION(1,3)",
326 # "D3DPS_VERSION(1,4)",
327 # "D3DPS_VERSION(2,0)",
328 # "D3DPS_VERSION(3,0)",
330 D3DPS_VERSION = DWORD
332 #D3DVS_VERSION = Enum("DWORD", [
333 # "D3DVS_VERSION(0,0)",
334 # "D3DVS_VERSION(1,0)",
335 # "D3DVS_VERSION(1,1)",
336 # "D3DVS_VERSION(2,0)",
337 # "D3DVS_VERSION(3,0)",
339 D3DVS_VERSION = DWORD
341 D3DCAPS9 = Struct("D3DCAPS9", [
342 (D3DDEVTYPE, "DeviceType"),
343 (UINT, "AdapterOrdinal"),
347 (D3DPRESENT_INTERVAL, "PresentationIntervals"),
348 (D3DCURSORCAPS, "CursorCaps"),
349 (D3DDEVCAPS, "DevCaps"),
350 (D3DPMISCCAPS, "PrimitiveMiscCaps"),
351 (D3DPRASTERCAPS, "RasterCaps"),
352 (D3DPCMPCAPS, "ZCmpCaps"),
353 (D3DPBLENDCAPS, "SrcBlendCaps"),
354 (D3DPBLENDCAPS, "DestBlendCaps"),
355 (D3DPCMPCAPS, "AlphaCmpCaps"),
356 (D3DPSHADECAPS, "ShadeCaps"),
357 (D3DPTEXTURECAPS, "TextureCaps"),
358 (D3DPTFILTERCAPS, "TextureFilterCaps"),
359 (D3DPTFILTERCAPS, "CubeTextureFilterCaps"),
360 (D3DPTFILTERCAPS, "VolumeTextureFilterCaps"),
361 (D3DPTADDRESSCAPS, "TextureAddressCaps"),
362 (D3DPTADDRESSCAPS, "VolumeTextureAddressCaps"),
363 (D3DLINECAPS, "LineCaps"),
364 (DWORD, "MaxTextureWidth"),
365 (DWORD, "MaxTextureHeight"),
366 (DWORD, "MaxVolumeExtent"),
367 (DWORD, "MaxTextureRepeat"),
368 (DWORD, "MaxTextureAspectRatio"),
369 (DWORD, "MaxAnisotropy"),
370 (Float, "MaxVertexW"),
371 (Float, "GuardBandLeft"),
372 (Float, "GuardBandTop"),
373 (Float, "GuardBandRight"),
374 (Float, "GuardBandBottom"),
375 (Float, "ExtentsAdjust"),
376 (D3DSTENCILCAPS, "StencilCaps"),
377 (D3DFVFCAPS, "FVFCaps"),
378 (D3DTEXOPCAPS, "TextureOpCaps"),
379 (DWORD, "MaxTextureBlendStages"),
380 (DWORD, "MaxSimultaneousTextures"),
381 (D3DVTXPCAPS, "VertexProcessingCaps"),
382 (DWORD, "MaxActiveLights"),
383 (DWORD, "MaxUserClipPlanes"),
384 (DWORD, "MaxVertexBlendMatrices"),
385 (DWORD, "MaxVertexBlendMatrixIndex"),
386 (Float, "MaxPointSize"),
387 (DWORD, "MaxPrimitiveCount"),
388 (DWORD, "MaxVertexIndex"),
389 (DWORD, "MaxStreams"),
390 (DWORD, "MaxStreamStride"),
391 (D3DVS_VERSION, "VertexShaderVersion"),
392 (DWORD, "MaxVertexShaderConst"),
393 (D3DPS_VERSION, "PixelShaderVersion"),
394 (Float, "PixelShader1xMaxValue"),
395 (D3DDEVCAPS2, "DevCaps2"),
396 (Float, "MaxNpatchTessellationLevel"),
397 (DWORD, "Reserved5"),
398 (UINT, "MasterAdapterOrdinal"),
399 (UINT, "AdapterOrdinalInGroup"),
400 (UINT, "NumberOfAdaptersInGroup"),
401 (D3DDTCAPS, "DeclTypes"),
402 (DWORD, "NumSimultaneousRTs"),
403 (D3DPTFILTERCAPS, "StretchRectFilterCaps"),
404 (D3DVSHADERCAPS2_0, "VS20Caps"),
405 (D3DPSHADERCAPS2_0, "PS20Caps"),
406 (D3DPTFILTERCAPS, "VertexTextureFilterCaps"),
407 (DWORD, "MaxVShaderInstructionsExecuted"),
408 (DWORD, "MaxPShaderInstructionsExecuted"),
409 (DWORD, "MaxVertexShader30InstructionSlots"),
410 (DWORD, "MaxPixelShader30InstructionSlots"),