• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2002-2003 Jason Edmeades
3  * Copyright (C) 2002-2003 Raphael Junqueira
4  * Copyright (C) 2005 Oliver Stieber
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef __WINE_D3D9TYPES_H
22 #define __WINE_D3D9TYPES_H
23 
24 #ifdef __i386__
25 #include <pshpack4.h>
26 #endif
27 
28 /*****************************************************************************
29  * Direct 3D v9 #defines
30  */
31 #define D3DCLEAR_TARGET   __MSABI_LONG(0x00000001)
32 #define D3DCLEAR_ZBUFFER  __MSABI_LONG(0x00000002)
33 #define D3DCLEAR_STENCIL  __MSABI_LONG(0x00000004)
34 
35 #define D3DCLIPPLANE0 (1 << 0)
36 #define D3DCLIPPLANE1 (1 << 1)
37 #define D3DCLIPPLANE2 (1 << 2)
38 #define D3DCLIPPLANE3 (1 << 3)
39 #define D3DCLIPPLANE4 (1 << 4)
40 #define D3DCLIPPLANE5 (1 << 5)
41 
42 #define D3DCOLOR_ARGB(a,r,g,b)       ((D3DCOLOR)((((a)&0xffu)<<24)|(((r)&0xffu)<<16)|(((g)&0xffu)<<8)|((b)&0xffu)))
43 #define D3DCOLOR_COLORVALUE(r,g,b,a) D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
44 #define D3DCOLOR_RGBA(r,g,b,a)       D3DCOLOR_ARGB(a,r,g,b)
45 #define D3DCOLOR_XRGB(r,g,b)         D3DCOLOR_ARGB(0xff,r,g,b)
46 #define D3DCOLOR_XYUV(y,u,v)         D3DCOLOR_ARGB(0xFF,y,u,v)
47 #define D3DCOLOR_AYUV(a,y,u,v)       D3DCOLOR_ARGB(a,y,u,v)
48 
49 #define D3DCS_LEFT                   __MSABI_LONG(0x001)
50 #define D3DCS_RIGHT                  __MSABI_LONG(0x002)
51 #define D3DCS_TOP                    __MSABI_LONG(0x004)
52 #define D3DCS_BOTTOM                 __MSABI_LONG(0x008)
53 #define D3DCS_FRONT                  __MSABI_LONG(0x010)
54 #define D3DCS_BACK                   __MSABI_LONG(0x020)
55 #define D3DCS_PLANE0                 __MSABI_LONG(0x040)
56 #define D3DCS_PLANE1                 __MSABI_LONG(0x080)
57 #define D3DCS_PLANE2                 __MSABI_LONG(0x100)
58 #define D3DCS_PLANE3                 __MSABI_LONG(0x200)
59 #define D3DCS_PLANE4                 __MSABI_LONG(0x400)
60 #define D3DCS_PLANE5                 __MSABI_LONG(0x800)
61 #define D3DCS_ALL                    __MSABI_LONG(0xFFF)
62 
63 #define D3DFVF_TEXTUREFORMAT1 3u
64 #define D3DFVF_TEXTUREFORMAT2 0u
65 #define D3DFVF_TEXTUREFORMAT3 1u
66 #define D3DFVF_TEXTUREFORMAT4 2u
67 #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
68 #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
69 #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
70 #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
71 
72 #define D3DLOCK_READONLY           0x0010
73 #define D3DLOCK_NOSYSLOCK          0x0800
74 #define D3DLOCK_NOOVERWRITE        0x1000
75 #define D3DLOCK_DISCARD            0x2000
76 #define D3DLOCK_DONOTWAIT          0x4000
77 #define D3DLOCK_NO_DIRTY_UPDATE    0x8000
78 
79 #define D3DMAXUSERCLIPPLANES       32
80 #define D3DCLIPPLANE0              (1 << 0)
81 #define D3DCLIPPLANE1              (1 << 1)
82 #define D3DCLIPPLANE2              (1 << 2)
83 #define D3DCLIPPLANE3              (1 << 3)
84 #define D3DCLIPPLANE4              (1 << 4)
85 #define D3DCLIPPLANE5              (1 << 5)
86 
87 
88 #define D3DRENDERSTATE_WRAPBIAS    __MSABI_LONG(128U)
89 
90 /* MSDN has this in d3d9caps.h, but it should be here */
91 #define D3DTSS_TCI_PASSTHRU                       0x00000
92 #define D3DTSS_TCI_CAMERASPACENORMAL              0x10000
93 #define D3DTSS_TCI_CAMERASPACEPOSITION            0x20000
94 #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR    0x30000
95 #define D3DTSS_TCI_SPHEREMAP                      0x40000
96 
97 
98 #define D3DTS_WORLD  D3DTS_WORLDMATRIX(0)
99 #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
100 #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2)
101 #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3)
102 #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
103 
104 #define D3DUSAGE_RENDERTARGET       __MSABI_LONG(0x00000001)
105 #define D3DUSAGE_DEPTHSTENCIL       __MSABI_LONG(0x00000002)
106 #define D3DUSAGE_WRITEONLY          __MSABI_LONG(0x00000008)
107 #define D3DUSAGE_SOFTWAREPROCESSING __MSABI_LONG(0x00000010)
108 #define D3DUSAGE_DONOTCLIP          __MSABI_LONG(0x00000020)
109 #define D3DUSAGE_POINTS             __MSABI_LONG(0x00000040)
110 #define D3DUSAGE_RTPATCHES          __MSABI_LONG(0x00000080)
111 #define D3DUSAGE_NPATCHES           __MSABI_LONG(0x00000100)
112 #define D3DUSAGE_DYNAMIC            __MSABI_LONG(0x00000200)
113 #define D3DUSAGE_AUTOGENMIPMAP      __MSABI_LONG(0x00000400)
114 #define D3DUSAGE_DMAP               __MSABI_LONG(0x00004000)
115 
116 /* Parts added with d3d9ex */
117 #if !defined(D3D_DISABLE_9EX)
118 #define D3DUSAGE_RESTRICTED_CONTENT              __MSABI_LONG(0x00000800)
119 #define D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER __MSABI_LONG(0x00001000)
120 #define D3DUSAGE_RESTRICT_SHARED_RESOURCE        __MSABI_LONG(0x00002000)
121 #define D3DUSAGE_NONSECURE                       __MSABI_LONG(0x00800000)
122 #define D3DUSAGE_TEXTAPI                         __MSABI_LONG(0x10000000)
123 #endif /* D3D_DISABLE_9EX */
124 
125 #define D3DUSAGE_QUERY_LEGACYBUMPMAP            __MSABI_LONG(0x00008000)
126 #define D3DUSAGE_QUERY_SRGBREAD                 __MSABI_LONG(0x00010000)
127 #define D3DUSAGE_QUERY_FILTER                   __MSABI_LONG(0x00020000)
128 #define D3DUSAGE_QUERY_SRGBWRITE                __MSABI_LONG(0x00040000)
129 #define D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING __MSABI_LONG(0x00080000)
130 #define D3DUSAGE_QUERY_VERTEXTEXTURE            __MSABI_LONG(0x00100000)
131 #define D3DUSAGE_QUERY_WRAPANDMIP               __MSABI_LONG(0x00200000)
132 
133 #define D3DWRAP_U        1
134 #define D3DWRAP_V        2
135 #define D3DWRAP_W        4
136 #define D3DWRAPCOORD_0   1
137 #define D3DWRAPCOORD_1   2
138 #define D3DWRAPCOORD_2   4
139 #define D3DWRAPCOORD_3   8
140 
141 #define MAX_DEVICE_IDENTIFIER_STRING        512
142 
143 #define D3DFVF_RESERVED0           0x0001
144 #define D3DFVF_POSITION_MASK       0x400E
145 #define D3DFVF_XYZ                 0x0002
146 #define D3DFVF_XYZRHW              0x0004
147 #define D3DFVF_XYZB1               0x0006
148 #define D3DFVF_XYZB2               0x0008
149 #define D3DFVF_XYZB3               0x000a
150 #define D3DFVF_XYZB4               0x000c
151 #define D3DFVF_XYZB5               0x000e
152 #define D3DFVF_XYZW                0x4002
153 #define D3DFVF_NORMAL              0x0010
154 #define D3DFVF_PSIZE               0x0020
155 #define D3DFVF_DIFFUSE             0x0040
156 #define D3DFVF_SPECULAR            0x0080
157 #define D3DFVF_TEXCOUNT_MASK       0x0f00
158 #define D3DFVF_TEXCOUNT_SHIFT           8
159 #define D3DFVF_TEX0                0x0000
160 #define D3DFVF_TEX1                0x0100
161 #define D3DFVF_TEX2                0x0200
162 #define D3DFVF_TEX3                0x0300
163 #define D3DFVF_TEX4                0x0400
164 #define D3DFVF_TEX5                0x0500
165 #define D3DFVF_TEX6                0x0600
166 #define D3DFVF_TEX7                0x0700
167 #define D3DFVF_TEX8                0x0800
168 #define D3DFVF_LASTBETA_UBYTE4     0x1000
169 #define D3DFVF_LASTBETA_D3DCOLOR   0x8000
170 #define D3DFVF_RESERVED2           0x6000
171 
172 #define D3DTA_SELECTMASK        0x0000000f
173 #define D3DTA_DIFFUSE           0x00000000
174 #define D3DTA_CURRENT           0x00000001
175 #define D3DTA_TEXTURE           0x00000002
176 #define D3DTA_TFACTOR           0x00000003
177 #define D3DTA_SPECULAR          0x00000004
178 #define D3DTA_TEMP              0x00000005
179 #define D3DTA_CONSTANT          0x00000006
180 #define D3DTA_COMPLEMENT        0x00000010
181 #define D3DTA_ALPHAREPLICATE    0x00000020
182 
183 #define D3DCOLORWRITEENABLE_RED   (__MSABI_LONG(1)<<0)
184 #define D3DCOLORWRITEENABLE_GREEN (__MSABI_LONG(1)<<1)
185 #define D3DCOLORWRITEENABLE_BLUE  (__MSABI_LONG(1)<<2)
186 #define D3DCOLORWRITEENABLE_ALPHA (__MSABI_LONG(1)<<3)
187 
188 #define D3DPV_DONOTCOPYDATA         (1 << 0)
189 
190 #define D3DSTREAMSOURCE_INDEXEDDATA  (1u << 30)
191 #define D3DSTREAMSOURCE_INSTANCEDATA (2u << 30)
192 
193 #define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4
194 
195 #define MAXD3DDECLLENGTH         64 /* +end marker */
196 #define MAXD3DDECLMETHOD         D3DDECLMETHOD_LOOKUPPRESAMPLED
197 #define MAXD3DDECLTYPE           D3DDECLTYPE_UNUSED
198 #define MAXD3DDECLUSAGE          D3DDECLUSAGE_SAMPLE
199 #define MAXD3DDECLUSAGEINDEX     15
200 
201 #define D3DDMAPSAMPLER 256
202 #define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1)
203 #define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2)
204 #define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3)
205 #define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4)
206 
207 #ifndef MAKEFOURCC
208 #define MAKEFOURCC(ch0, ch1, ch2, ch3)  \
209     ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |  \
210     ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
211 #endif
212 
213 /* Constants used by D3DPRESENT_PARAMETERS. when creating a device or swapchain */
214 
215 #define D3DPRESENTFLAG_LOCKABLE_BACKBUFFER             0x00000001 /* Create a lockable backbuffer */
216 #define D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL            0x00000002 /* Discard Z buffer */
217 #define D3DPRESENTFLAG_DEVICECLIP                      0x00000004 /* Clip the window blited into the client area 2k + xp only */
218 #define D3DPRESENTFLAG_VIDEO                           0x00000010 /* backbuffer 'may' contain video data */
219 #ifndef D3D_DISABLE_9EX
220 #define D3DPRESENTFLAG_NOAUTOROTATE                    0x00000020 /* d3d9ex, ignore display rotation */
221 #define D3DPRESENTFLAG_UNPRUNEDMODE                    0x00000040 /* d3d9ex, specify invalid display modes */
222 #define D3DPRESENTFLAG_OVERLAY_LIMITEDRGB              0x00000080
223 #define D3DPRESENTFLAG_OVERLAY_YCbCr_BT709             0x00000100
224 #define D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC             0x00000200
225 #define D3DPRESENTFLAG_RESTRICTED_CONTENT              0x00000400
226 #define D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER 0x00000800
227 #endif
228 
229 #define D3DPRESENT_RATE_DEFAULT                        0x00000000
230 
231 /****************************
232  * Vertex Shaders Declaration
233  */
234 
235 typedef enum _D3DDECLUSAGE {
236   D3DDECLUSAGE_POSITION     = 0,
237   D3DDECLUSAGE_BLENDWEIGHT  = 1,
238   D3DDECLUSAGE_BLENDINDICES = 2,
239   D3DDECLUSAGE_NORMAL       = 3,
240   D3DDECLUSAGE_PSIZE        = 4,
241   D3DDECLUSAGE_TEXCOORD     = 5,
242   D3DDECLUSAGE_TANGENT      = 6,
243   D3DDECLUSAGE_BINORMAL     = 7,
244   D3DDECLUSAGE_TESSFACTOR   = 8,
245   D3DDECLUSAGE_POSITIONT    = 9,
246   D3DDECLUSAGE_COLOR        = 10,
247   D3DDECLUSAGE_FOG          = 11,
248   D3DDECLUSAGE_DEPTH        = 12,
249   D3DDECLUSAGE_SAMPLE       = 13
250 } D3DDECLUSAGE;
251 
252 #define D3DMAXDECLUSAGE         D3DDECLUSAGE_SAMPLE
253 #define D3DMAXDECLUSAGEINDEX    15
254 #define D3DMAXDECLLENGTH        18
255 #define D3DMAXDECLUSAGE_DX8     D3DDECLUSAGE_TEXCOORD
256 
257 typedef enum _D3DDECLMETHOD {
258   D3DDECLMETHOD_DEFAULT          = 0,
259   D3DDECLMETHOD_PARTIALU         = 1,
260   D3DDECLMETHOD_PARTIALV         = 2,
261   D3DDECLMETHOD_CROSSUV          = 3,
262   D3DDECLMETHOD_UV               = 4,
263   D3DDECLMETHOD_LOOKUP           = 5,
264   D3DDECLMETHOD_LOOKUPPRESAMPLED = 6
265 } D3DDECLMETHOD;
266 
267 
268 #define D3DMAXDECLMETHOD        D3DDECLMETHOD_LOOKUPPRESAMPLED
269 
270 typedef enum _D3DDECLTYPE {
271   D3DDECLTYPE_FLOAT1    =  0,
272   D3DDECLTYPE_FLOAT2    =  1,
273   D3DDECLTYPE_FLOAT3    =  2,
274   D3DDECLTYPE_FLOAT4    =  3,
275   D3DDECLTYPE_D3DCOLOR  =  4,
276   D3DDECLTYPE_UBYTE4    =  5,
277   D3DDECLTYPE_SHORT2    =  6,
278   D3DDECLTYPE_SHORT4    =  7,
279   /* VS 2.0 */
280   D3DDECLTYPE_UBYTE4N   =  8,
281   D3DDECLTYPE_SHORT2N   =  9,
282   D3DDECLTYPE_SHORT4N   = 10,
283   D3DDECLTYPE_USHORT2N  = 11,
284   D3DDECLTYPE_USHORT4N  = 12,
285   D3DDECLTYPE_UDEC3     = 13,
286   D3DDECLTYPE_DEC3N     = 14,
287   D3DDECLTYPE_FLOAT16_2 = 15,
288   D3DDECLTYPE_FLOAT16_4 = 16,
289   D3DDECLTYPE_UNUSED    = 17,
290 } D3DDECLTYPE;
291 
292 #define D3DMAXDECLTYPE          D3DDECLTYPE_UNUSED
293 
294 typedef struct _D3DVERTEXELEMENT9 {
295   WORD    Stream;
296   WORD    Offset;
297   BYTE    Type;
298   BYTE    Method;
299   BYTE    Usage;
300   BYTE    UsageIndex;
301 } D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9;
302 
303 
304 typedef enum _D3DQUERYTYPE {
305     D3DQUERYTYPE_VCACHE = 4,
306     D3DQUERYTYPE_RESOURCEMANAGER = 5,
307     D3DQUERYTYPE_VERTEXSTATS = 6,
308     D3DQUERYTYPE_EVENT = 8,
309     D3DQUERYTYPE_OCCLUSION = 9,
310     D3DQUERYTYPE_TIMESTAMP = 10,
311     D3DQUERYTYPE_TIMESTAMPDISJOINT = 11,
312     D3DQUERYTYPE_TIMESTAMPFREQ = 12,
313     D3DQUERYTYPE_PIPELINETIMINGS = 13,
314     D3DQUERYTYPE_INTERFACETIMINGS = 14,
315     D3DQUERYTYPE_VERTEXTIMINGS = 15,
316     D3DQUERYTYPE_PIXELTIMINGS = 16,
317     D3DQUERYTYPE_BANDWIDTHTIMINGS = 17,
318     D3DQUERYTYPE_CACHEUTILIZATION = 18,
319 #ifndef D3D_DISABLE_9EX
320     D3DQUERYTYPE_MEMORYPRESSURE = 19,
321 #endif
322 } D3DQUERYTYPE;
323 
324 #define D3DISSUE_BEGIN   (1 << 1)
325 #define D3DISSUE_END     (1 << 0)
326 #define D3DGETDATA_FLUSH (1 << 0)
327 
328 
329 #define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
330 #define D3DDP_MAXTEXCOORD   8
331 
332 
333 #define D3DVSD_MAKETOKENTYPE(TokenType) \
334   ((TokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK)
335 
336 #define D3DVSD_CONST(ConstantAddress, Count) \
337   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | ((Count) << D3DVSD_CONSTCOUNTSHIFT) | (ConstantAddress))
338 
339 #define D3DVSD_END() 0xFFFFFFFF
340 
341 #define D3DVSD_NOP() 0x00000000
342 
343 #define D3DVSD_REG(VertexRegister, Type) \
344   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | ((Type) << D3DVSD_DATATYPESHIFT) | (VertexRegister))
345 
346 #define D3DVSD_SKIP(Count) \
347   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | ((Count) << D3DVSD_SKIPCOUNTSHIFT))
348 
349 #define D3DVSD_STREAM(StreamNumber) \
350   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (StreamNumber))
351 
352 #define D3DVSD_STREAM_TESS() \
353   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK))
354 
355 #define D3DVSD_TESSNORMAL(RegisterIn, RegisterOut) \
356   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | ((RegisterIn) << D3DVSD_VERTEXREGINSHIFT) | ((0x02) << D3DVSD_DATATYPESHIFT) | (RegisterOut))
357 
358 #define D3DVSD_TESSUV(Register) \
359   (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | ((0x01) << D3DVSD_DATATYPESHIFT) | (Register))
360 
361 
362 /********************************
363  * Pixel/Vertex Shaders Functions
364  */
365 
366 /** Maximum number of supported texture coordinates sets operation */
367 #define D3DDP_MAXTEXCOORD   8
368 
369 /** opcode token mask */
370 #define D3DSI_OPCODE_MASK       0x0000FFFF
371 #define D3DSI_INSTLENGTH_MASK   0x0F000000
372 #define D3DSI_INSTLENGTH_SHIFT  24
373 
374 /** opcodes types for PS and VS */
375 typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE {
376   D3DSIO_NOP          =  0,
377   D3DSIO_MOV          =  1,
378   D3DSIO_ADD          =  2,
379   D3DSIO_SUB          =  3,
380   D3DSIO_MAD          =  4,
381   D3DSIO_MUL          =  5,
382   D3DSIO_RCP          =  6,
383   D3DSIO_RSQ          =  7,
384   D3DSIO_DP3          =  8,
385   D3DSIO_DP4          =  9,
386   D3DSIO_MIN          = 10,
387   D3DSIO_MAX          = 11,
388   D3DSIO_SLT          = 12,
389   D3DSIO_SGE          = 13,
390   D3DSIO_EXP          = 14,
391   D3DSIO_LOG          = 15,
392   D3DSIO_LIT          = 16,
393   D3DSIO_DST          = 17,
394   D3DSIO_LRP          = 18,
395   D3DSIO_FRC          = 19,
396   D3DSIO_M4x4         = 20,
397   D3DSIO_M4x3         = 21,
398   D3DSIO_M3x4         = 22,
399   D3DSIO_M3x3         = 23,
400   D3DSIO_M3x2         = 24,
401   D3DSIO_CALL         = 25,
402   D3DSIO_CALLNZ       = 26,
403   D3DSIO_LOOP         = 27,
404   D3DSIO_RET          = 28,
405   D3DSIO_ENDLOOP      = 29,
406   D3DSIO_LABEL        = 30,
407   D3DSIO_DCL          = 31,
408   D3DSIO_POW          = 32,
409   D3DSIO_CRS          = 33,
410   D3DSIO_SGN          = 34,
411   D3DSIO_ABS          = 35,
412   D3DSIO_NRM          = 36,
413   D3DSIO_SINCOS       = 37,
414   D3DSIO_REP          = 38,
415   D3DSIO_ENDREP       = 39,
416   D3DSIO_IF           = 40,
417   D3DSIO_IFC          = 41,
418   D3DSIO_ELSE         = 42,
419   D3DSIO_ENDIF        = 43,
420   D3DSIO_BREAK        = 44,
421   D3DSIO_BREAKC       = 45,
422   D3DSIO_MOVA         = 46,
423   D3DSIO_DEFB         = 47,
424   D3DSIO_DEFI         = 48,
425 
426   D3DSIO_TEXCOORD     = 64,
427   D3DSIO_TEXKILL      = 65,
428   D3DSIO_TEX          = 66,
429   D3DSIO_TEXBEM       = 67,
430   D3DSIO_TEXBEML      = 68,
431   D3DSIO_TEXREG2AR    = 69,
432   D3DSIO_TEXREG2GB    = 70,
433   D3DSIO_TEXM3x2PAD   = 71,
434   D3DSIO_TEXM3x2TEX   = 72,
435   D3DSIO_TEXM3x3PAD   = 73,
436   D3DSIO_TEXM3x3TEX   = 74,
437   D3DSIO_TEXM3x3DIFF  = 75,
438   D3DSIO_TEXM3x3SPEC  = 76,
439   D3DSIO_TEXM3x3VSPEC = 77,
440   D3DSIO_EXPP         = 78,
441   D3DSIO_LOGP         = 79,
442   D3DSIO_CND          = 80,
443   D3DSIO_DEF          = 81,
444   D3DSIO_TEXREG2RGB   = 82,
445   D3DSIO_TEXDP3TEX    = 83,
446   D3DSIO_TEXM3x2DEPTH = 84,
447   D3DSIO_TEXDP3       = 85,
448   D3DSIO_TEXM3x3      = 86,
449   D3DSIO_TEXDEPTH     = 87,
450   D3DSIO_CMP          = 88,
451   D3DSIO_BEM          = 89,
452   D3DSIO_DP2ADD       = 90,
453   D3DSIO_DSX          = 91,
454   D3DSIO_DSY          = 92,
455   D3DSIO_TEXLDD       = 93,
456   D3DSIO_SETP         = 94,
457   D3DSIO_TEXLDL       = 95,
458   D3DSIO_BREAKP       = 96,
459 
460   D3DSIO_PHASE        = 0xFFFD,
461   D3DSIO_COMMENT      = 0xFFFE,
462   D3DSIO_END          = 0XFFFF,
463 
464   D3DSIO_FORCE_DWORD  = 0X7FFFFFFF /** for 32-bit alignment */
465 } D3DSHADER_INSTRUCTION_OPCODE_TYPE;
466 
467 #define D3DSINCOSCONST1   -1.5500992e-006f, -2.1701389e-005f,  0.0026041667f, 0.00026041668f
468 #define D3DSINCOSCONST2   -0.020833334f,    -0.12500000f,      1.0f,          0.50000000f
469 
470 #define D3DSHADER_INSTRUCTION_PREDICATED    (1 << 28)
471 
472 #define D3DSI_TEXLD_PROJECT 0x00010000
473 #define D3DSI_TEXLD_BIAS    0x00020000
474 
475 /** for parallelism */
476 #define D3DSI_COISSUE 0x40000000
477 
478 #define D3DSP_DCL_USAGE_SHIFT 0
479 #define D3DSP_DCL_USAGE_MASK  0x0000000f
480 
481 #define D3DSP_DCL_USAGEINDEX_SHIFT 16
482 #define D3DSP_DCL_USAGEINDEX_MASK  0x000f0000
483 
484 #define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16
485 #define D3DSP_OPCODESPECIFICCONTROL_MASK  0x00ff0000
486 
487 #define D3DSP_TEXTURETYPE_SHIFT 27
488 #define D3DSP_TEXTURETYPE_MASK  0x78000000
489 
490 typedef enum _D3DSAMPLER_TEXTURE_TYPE {
491   D3DSTT_UNKNOWN      = 0 << D3DSP_TEXTURETYPE_SHIFT,
492   D3DSTT_1D           = 1 << D3DSP_TEXTURETYPE_SHIFT,
493   D3DSTT_2D           = 2 << D3DSP_TEXTURETYPE_SHIFT,
494   D3DSTT_CUBE         = 3 << D3DSP_TEXTURETYPE_SHIFT,
495   D3DSTT_VOLUME       = 4 << D3DSP_TEXTURETYPE_SHIFT,
496 
497   D3DSTT_FORCE_DWORD  = 0x7FFFFFFF
498 } D3DSAMPLER_TEXTURE_TYPE;
499 
500 #define D3DSP_REGNUM_MASK       0x000007FF
501 
502 /** destination parameter modifiers (.xyzw) */
503 #define D3DSP_WRITEMASK_0       0x00010000 /* .x r */
504 #define D3DSP_WRITEMASK_1       0x00020000 /* .y g */
505 #define D3DSP_WRITEMASK_2       0x00040000 /* .z b */
506 #define D3DSP_WRITEMASK_3       0x00080000 /* .w a */
507 #define D3DSP_WRITEMASK_ALL     0x000F0000 /* all */
508 
509 #define D3DSP_DSTMOD_SHIFT      20
510 #define D3DSP_DSTMOD_MASK       (0xF << D3DSP_DSTMOD_SHIFT)
511 
512 typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE {
513   D3DSPDM_NONE             = 0 << D3DSP_DSTMOD_SHIFT,
514   D3DSPDM_SATURATE         = 1 << D3DSP_DSTMOD_SHIFT,
515   D3DSPDM_PARTIALPRECISION = 2 << D3DSP_DSTMOD_SHIFT,
516   D3DSPDM_MSAMPCENTROID    = 4 << D3DSP_DSTMOD_SHIFT,
517 
518   D3DSPDM_FORCE_DWORD  = 0x7FFFFFFF
519 } D3DSHADER_PARAM_DSTMOD_TYPE;
520 
521 /** destination param */
522 #define D3DSP_DSTSHIFT_SHIFT     24
523 #define D3DSP_DSTSHIFT_MASK      (0xF << D3DSP_DSTSHIFT_SHIFT)
524 
525 /** destination/source reg type */
526 #define D3DSP_REGTYPE_SHIFT      28
527 #define D3DSP_REGTYPE_SHIFT2     8
528 #define D3DSP_REGTYPE_MASK       (0x7 << D3DSP_REGTYPE_SHIFT)
529 #define D3DSP_REGTYPE_MASK2      0x00001800
530 
531 typedef enum _D3DSHADER_PARAM_REGISTER_TYPE
532 {
533     D3DSPR_TEMP         =  0,
534     D3DSPR_INPUT        =  1,
535     D3DSPR_CONST        =  2,
536     D3DSPR_ADDR         =  3,
537     D3DSPR_TEXTURE      =  3,
538     D3DSPR_RASTOUT      =  4,
539     D3DSPR_ATTROUT      =  5,
540     D3DSPR_TEXCRDOUT    =  6,
541     D3DSPR_OUTPUT       =  6,
542     D3DSPR_CONSTINT     =  7,
543     D3DSPR_COLOROUT     =  8,
544     D3DSPR_DEPTHOUT     =  9,
545     D3DSPR_SAMPLER      = 10,
546     D3DSPR_CONST2       = 11,
547     D3DSPR_CONST3       = 12,
548     D3DSPR_CONST4       = 13,
549     D3DSPR_CONSTBOOL    = 14,
550     D3DSPR_LOOP         = 15,
551     D3DSPR_TEMPFLOAT16  = 16,
552     D3DSPR_MISCTYPE     = 17,
553     D3DSPR_LABEL        = 18,
554     D3DSPR_PREDICATE    = 19,
555 
556     D3DSPR_FORCE_DWORD  = 0x7fffffff
557 } D3DSHADER_PARAM_REGISTER_TYPE;
558 
559 typedef enum _D3DSHADER_MISCTYPE_OFFSETS {
560     D3DSMO_POSITION  = 0,
561     D3DSMO_FACE      = 1
562 } D3DSHADER_MISCTYPE_OFFSETS;
563 
564 typedef enum _D3DVS_RASTOUT_OFFSETS {
565   D3DSRO_POSITION     = 0,
566   D3DSRO_FOG          = 1,
567   D3DSRO_POINT_SIZE   = 2,
568 
569   D3DSRO_FORCE_DWORD  = 0x7FFFFFFF
570 } D3DVS_RASTOUT_OFFSETS;
571 
572 #define D3DVS_ADDRESSMODE_SHIFT  13
573 #define D3DVS_ADDRESSMODE_MASK   (0x1 << D3DVS_ADDRESSMODE_SHIFT)
574 
575 typedef enum _D3DVS_ADDRESSMODE_TYPE {
576   D3DVS_ADDRMODE_ABSOLUTE     = 0 << D3DVS_ADDRESSMODE_SHIFT,
577   D3DVS_ADDRMODE_RELATIVE     = 1 << D3DVS_ADDRESSMODE_SHIFT,
578 
579   D3DVS_ADDRMODE_FORCE_DWORD  = 0x7FFFFFFF
580 } D3DVS_ADDRESSMODE_TYPE;
581 
582 #define D3DSHADER_ADDRESSMODE_SHIFT 13
583 #define D3DSHADER_ADDRESSMODE_MASK  (1 << D3DSHADER_ADDRESSMODE_SHIFT)
584 
585 typedef enum _D3DSHADER_ADDRESSMODE_TYPE {
586   D3DSHADER_ADDRMODE_ABSOLUTE    = 0 << D3DSHADER_ADDRESSMODE_SHIFT,
587   D3DSHADER_ADDRMODE_RELATIVE    = 1 << D3DSHADER_ADDRESSMODE_SHIFT,
588 
589   D3DSHADER_ADDRMODE_FORCE_DWORD = 0x7FFFFFFF
590 } D3DSHADER_ADDRESSMODE_TYPE;
591 
592 
593 #define D3DVS_SWIZZLE_SHIFT      16
594 #define D3DVS_SWIZZLE_MASK       (0xFF << D3DVS_SWIZZLE_SHIFT)
595 
596 #define D3DSP_SWIZZLE_SHIFT      16
597 #define D3DSP_SWIZZLE_MASK       (0xFF << D3DSP_SWIZZLE_SHIFT)
598 
599 #define D3DVS_X_X       (0 << D3DVS_SWIZZLE_SHIFT)
600 #define D3DVS_X_Y       (1 << D3DVS_SWIZZLE_SHIFT)
601 #define D3DVS_X_Z       (2 << D3DVS_SWIZZLE_SHIFT)
602 #define D3DVS_X_W       (3 << D3DVS_SWIZZLE_SHIFT)
603 
604 #define D3DVS_Y_X       (0 << (D3DVS_SWIZZLE_SHIFT + 2))
605 #define D3DVS_Y_Y       (1 << (D3DVS_SWIZZLE_SHIFT + 2))
606 #define D3DVS_Y_Z       (2 << (D3DVS_SWIZZLE_SHIFT + 2))
607 #define D3DVS_Y_W       (3 << (D3DVS_SWIZZLE_SHIFT + 2))
608 
609 #define D3DVS_Z_X       (0 << (D3DVS_SWIZZLE_SHIFT + 4))
610 #define D3DVS_Z_Y       (1 << (D3DVS_SWIZZLE_SHIFT + 4))
611 #define D3DVS_Z_Z       (2 << (D3DVS_SWIZZLE_SHIFT + 4))
612 #define D3DVS_Z_W       (3 << (D3DVS_SWIZZLE_SHIFT + 4))
613 
614 #define D3DVS_W_X       (0 << (D3DVS_SWIZZLE_SHIFT + 6))
615 #define D3DVS_W_Y       (1 << (D3DVS_SWIZZLE_SHIFT + 6))
616 #define D3DVS_W_Z       (2 << (D3DVS_SWIZZLE_SHIFT + 6))
617 #define D3DVS_W_W       (3 << (D3DVS_SWIZZLE_SHIFT + 6))
618 
619 #define D3DVS_NOSWIZZLE (D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W)
620 
621 #define D3DSP_NOSWIZZLE \
622     ((0 << (D3DSP_SWIZZLE_SHIFT + 0)) | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) | (3 << (D3DSP_SWIZZLE_SHIFT + 6)))
623 
624 #define D3DSP_SRCMOD_SHIFT      24
625 #define D3DSP_SRCMOD_MASK       (0xF << D3DSP_SRCMOD_SHIFT)
626 
627 typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE {
628   D3DSPSM_NONE         =  0 << D3DSP_SRCMOD_SHIFT,
629   D3DSPSM_NEG          =  1 << D3DSP_SRCMOD_SHIFT,
630   D3DSPSM_BIAS         =  2 << D3DSP_SRCMOD_SHIFT,
631   D3DSPSM_BIASNEG      =  3 << D3DSP_SRCMOD_SHIFT,
632   D3DSPSM_SIGN         =  4 << D3DSP_SRCMOD_SHIFT,
633   D3DSPSM_SIGNNEG      =  5 << D3DSP_SRCMOD_SHIFT,
634   D3DSPSM_COMP         =  6 << D3DSP_SRCMOD_SHIFT,
635   D3DSPSM_X2           =  7 << D3DSP_SRCMOD_SHIFT,
636   D3DSPSM_X2NEG        =  8 << D3DSP_SRCMOD_SHIFT,
637   D3DSPSM_DZ           =  9 << D3DSP_SRCMOD_SHIFT,
638   D3DSPSM_DW           = 10 << D3DSP_SRCMOD_SHIFT,
639   D3DSPSM_ABS          = 11 << D3DSP_SRCMOD_SHIFT,
640   D3DSPSM_ABSNEG       = 12 << D3DSP_SRCMOD_SHIFT,
641   D3DSPSM_NOT          = 13 << D3DSP_SRCMOD_SHIFT,
642 
643   D3DSPSM_FORCE_DWORD  = 0x7FFFFFFF
644 } D3DSHADER_PARAM_SRCMOD_TYPE;
645 
646 #define D3DPS_VERSION(major, minor) (0xFFFF0000 | ((major) << 8) | (minor))
647 #define D3DVS_VERSION(major, minor) (0xFFFE0000 | ((major) << 8) | (minor))
648 #define D3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xFF)
649 #define D3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF)
650 
651 #define D3DSI_COMMENTSIZE_SHIFT 16
652 #define D3DSI_COMMENTSIZE_MASK (0x7FFF << D3DSI_COMMENTSIZE_SHIFT)
653 
654 #define D3DSHADER_COMMENT(commentSize) \
655   ((((commentSize) << D3DSI_COMMENTSIZE_SHIFT) & D3DSI_COMMENTSIZE_MASK) | D3DSIO_COMMENT)
656 
657 #define D3DPS_END() 0x0000FFFF
658 #define D3DVS_END() 0x0000FFFF
659 
660 
661 /*****************************************************************************
662  * Direct 3D v8 enumerated types
663  */
664 typedef enum _D3DBACKBUFFER_TYPE {
665     D3DBACKBUFFER_TYPE_MONO         = 0,
666     D3DBACKBUFFER_TYPE_LEFT         = 1,
667     D3DBACKBUFFER_TYPE_RIGHT        = 2,
668 
669     D3DBACKBUFFER_TYPE_FORCE_DWORD  = 0x7fffffff
670 } D3DBACKBUFFER_TYPE;
671 
672 typedef enum _D3DBASISTYPE {
673    D3DBASIS_BEZIER        = 0,
674    D3DBASIS_BSPLINE       = 1,
675    D3DBASIS_INTERPOLATE   = 2,
676 
677    D3DBASIS_FORCE_DWORD   = 0x7fffffff
678 } D3DBASISTYPE;
679 
680 typedef enum _D3DBLEND {
681     D3DBLEND_ZERO               =  1,
682     D3DBLEND_ONE                =  2,
683     D3DBLEND_SRCCOLOR           =  3,
684     D3DBLEND_INVSRCCOLOR        =  4,
685     D3DBLEND_SRCALPHA           =  5,
686     D3DBLEND_INVSRCALPHA        =  6,
687     D3DBLEND_DESTALPHA          =  7,
688     D3DBLEND_INVDESTALPHA       =  8,
689     D3DBLEND_DESTCOLOR          =  9,
690     D3DBLEND_INVDESTCOLOR       = 10,
691     D3DBLEND_SRCALPHASAT        = 11,
692     D3DBLEND_BOTHSRCALPHA       = 12,
693     D3DBLEND_BOTHINVSRCALPHA    = 13,
694     D3DBLEND_BLENDFACTOR        = 14,
695     D3DBLEND_INVBLENDFACTOR     = 15,
696 #ifndef D3D_DISABLE_9EX
697     D3DBLEND_SRCCOLOR2          = 16,
698     D3DBLEND_INVSRCCOLOR2       = 17,
699 #endif
700     D3DBLEND_FORCE_DWORD        = 0x7fffffff
701 } D3DBLEND;
702 
703 typedef enum _D3DBLENDOP {
704     D3DBLENDOP_ADD              = 1,
705     D3DBLENDOP_SUBTRACT         = 2,
706     D3DBLENDOP_REVSUBTRACT      = 3,
707     D3DBLENDOP_MIN              = 4,
708     D3DBLENDOP_MAX              = 5,
709 
710     D3DBLENDOP_FORCE_DWORD      = 0x7fffffff
711 } D3DBLENDOP;
712 
713 typedef enum _D3DCMPFUNC {
714     D3DCMP_NEVER                = 1,
715     D3DCMP_LESS                 = 2,
716     D3DCMP_EQUAL                = 3,
717     D3DCMP_LESSEQUAL            = 4,
718     D3DCMP_GREATER              = 5,
719     D3DCMP_NOTEQUAL             = 6,
720     D3DCMP_GREATEREQUAL         = 7,
721     D3DCMP_ALWAYS               = 8,
722 
723     D3DCMP_FORCE_DWORD          = 0x7fffffff
724 } D3DCMPFUNC;
725 
726 typedef enum _D3DCUBEMAP_FACES {
727     D3DCUBEMAP_FACE_POSITIVE_X     = 0,
728     D3DCUBEMAP_FACE_NEGATIVE_X     = 1,
729     D3DCUBEMAP_FACE_POSITIVE_Y     = 2,
730     D3DCUBEMAP_FACE_NEGATIVE_Y     = 3,
731     D3DCUBEMAP_FACE_POSITIVE_Z     = 4,
732     D3DCUBEMAP_FACE_NEGATIVE_Z     = 5,
733 
734     D3DCUBEMAP_FACE_FORCE_DWORD    = 0xffffffff
735 } D3DCUBEMAP_FACES;
736 
737 typedef enum _D3DCULL {
738     D3DCULL_NONE                = 1,
739     D3DCULL_CW                  = 2,
740     D3DCULL_CCW                 = 3,
741 
742     D3DCULL_FORCE_DWORD         = 0x7fffffff
743 } D3DCULL;
744 
745 typedef enum _D3DDEBUGMONITORTOKENS {
746     D3DDMT_ENABLE          = 0,
747     D3DDMT_DISABLE         = 1,
748 
749     D3DDMT_FORCE_DWORD     = 0x7fffffff
750 } D3DDEBUGMONITORTOKENS;
751 
752 typedef enum _D3DDEGREETYPE {
753     D3DDEGREE_LINEAR      = 1,
754     D3DDEGREE_QUADRATIC   = 2,
755     D3DDEGREE_CUBIC       = 3,
756     D3DDEGREE_QUINTIC     = 5,
757 
758     D3DDEGREE_FORCE_DWORD   = 0x7fffffff
759 } D3DDEGREETYPE;
760 
761 typedef enum _D3DDEVTYPE {
762     D3DDEVTYPE_HAL         = 1,
763     D3DDEVTYPE_REF         = 2,
764     D3DDEVTYPE_SW          = 3,
765     D3DDEVTYPE_NULLREF     = 4,
766 
767     D3DDEVTYPE_FORCE_DWORD = 0xffffffff
768 } D3DDEVTYPE;
769 
770 typedef enum _D3DFILLMODE {
771     D3DFILL_POINT               = 1,
772     D3DFILL_WIREFRAME           = 2,
773     D3DFILL_SOLID               = 3,
774 
775     D3DFILL_FORCE_DWORD         = 0x7fffffff
776 } D3DFILLMODE;
777 
778 typedef enum _D3DFOGMODE {
779     D3DFOG_NONE                 = 0,
780     D3DFOG_EXP                  = 1,
781     D3DFOG_EXP2                 = 2,
782     D3DFOG_LINEAR               = 3,
783 
784     D3DFOG_FORCE_DWORD          = 0x7fffffff
785 } D3DFOGMODE;
786 
787 typedef enum _D3DFORMAT {
788     D3DFMT_UNKNOWN              =   0,
789 
790     D3DFMT_R8G8B8               =  20,
791     D3DFMT_A8R8G8B8             =  21,
792     D3DFMT_X8R8G8B8             =  22,
793     D3DFMT_R5G6B5               =  23,
794     D3DFMT_X1R5G5B5             =  24,
795     D3DFMT_A1R5G5B5             =  25,
796     D3DFMT_A4R4G4B4             =  26,
797     D3DFMT_R3G3B2               =  27,
798     D3DFMT_A8                   =  28,
799     D3DFMT_A8R3G3B2             =  29,
800     D3DFMT_X4R4G4B4             =  30,
801     D3DFMT_A2B10G10R10          =  31,
802     D3DFMT_A8B8G8R8             =  32,
803     D3DFMT_X8B8G8R8             =  33,
804     D3DFMT_G16R16               =  34,
805     D3DFMT_A2R10G10B10          =  35,
806     D3DFMT_A16B16G16R16         =  36,
807 
808 
809     D3DFMT_A8P8                 =  40,
810     D3DFMT_P8                   =  41,
811 
812     D3DFMT_L8                   =  50,
813     D3DFMT_A8L8                 =  51,
814     D3DFMT_A4L4                 =  52,
815 
816     D3DFMT_V8U8                 =  60,
817     D3DFMT_L6V5U5               =  61,
818     D3DFMT_X8L8V8U8             =  62,
819     D3DFMT_Q8W8V8U8             =  63,
820     D3DFMT_V16U16               =  64,
821     D3DFMT_A2W10V10U10          =  67,
822 
823     D3DFMT_UYVY                 =  MAKEFOURCC('U', 'Y', 'V', 'Y'),
824     D3DFMT_YUY2                 =  MAKEFOURCC('Y', 'U', 'Y', '2'),
825     D3DFMT_DXT1                 =  MAKEFOURCC('D', 'X', 'T', '1'),
826     D3DFMT_DXT2                 =  MAKEFOURCC('D', 'X', 'T', '2'),
827     D3DFMT_DXT3                 =  MAKEFOURCC('D', 'X', 'T', '3'),
828     D3DFMT_DXT4                 =  MAKEFOURCC('D', 'X', 'T', '4'),
829     D3DFMT_DXT5                 =  MAKEFOURCC('D', 'X', 'T', '5'),
830     D3DFMT_MULTI2_ARGB8         =  MAKEFOURCC('M', 'E', 'T', '1'),
831     D3DFMT_G8R8_G8B8            =  MAKEFOURCC('G', 'R', 'G', 'B'),
832     D3DFMT_R8G8_B8G8            =  MAKEFOURCC('R', 'G', 'B', 'G'),
833 
834     D3DFMT_D16_LOCKABLE         =  70,
835     D3DFMT_D32                  =  71,
836     D3DFMT_D15S1                =  73,
837     D3DFMT_D24S8                =  75,
838     D3DFMT_D24X8                =  77,
839     D3DFMT_D24X4S4              =  79,
840     D3DFMT_D16                  =  80,
841     D3DFMT_L16                  =  81,
842     D3DFMT_D32F_LOCKABLE        =  82,
843     D3DFMT_D24FS8               =  83,
844 #ifndef D3D_DISABLE_9EX
845     D3DFMT_D32_LOCKABLE         =  84,
846     D3DFMT_S8_LOCKABLE          =  85,
847 #endif
848 
849     D3DFMT_VERTEXDATA           = 100,
850     D3DFMT_INDEX16              = 101,
851     D3DFMT_INDEX32              = 102,
852     D3DFMT_Q16W16V16U16         = 110,
853     /* Floating point formats */
854     D3DFMT_R16F                 = 111,
855     D3DFMT_G16R16F              = 112,
856     D3DFMT_A16B16G16R16F        = 113,
857 
858     /* IEEE formats */
859     D3DFMT_R32F                 = 114,
860     D3DFMT_G32R32F              = 115,
861     D3DFMT_A32B32G32R32F        = 116,
862 
863     D3DFMT_CxV8U8               = 117,
864 #ifndef D3D_DISABLE_9EX
865     D3DFMT_A1                   = 118,
866     D3DFMT_A2B10G10R10_XR_BIAS  = 119,
867     D3DFMT_BINARYBUFFER         = 199,
868 #endif
869 
870     D3DFMT_FORCE_DWORD          = 0xFFFFFFFF
871 } D3DFORMAT;
872 
873 typedef enum _D3DLIGHTTYPE {
874     D3DLIGHT_POINT          = 1,
875     D3DLIGHT_SPOT           = 2,
876     D3DLIGHT_DIRECTIONAL    = 3,
877 
878     D3DLIGHT_FORCE_DWORD    = 0x7fffffff
879 } D3DLIGHTTYPE;
880 
881 typedef enum _D3DMATERIALCOLORSOURCE {
882     D3DMCS_MATERIAL         = 0,
883     D3DMCS_COLOR1           = 1,
884     D3DMCS_COLOR2           = 2,
885 
886     D3DMCS_FORCE_DWORD      = 0x7fffffff
887 } D3DMATERIALCOLORSOURCE;
888 
889 typedef enum _D3DMULTISAMPLE_TYPE {
890     D3DMULTISAMPLE_NONE            =  0,
891     D3DMULTISAMPLE_NONMASKABLE     =  1,
892     D3DMULTISAMPLE_2_SAMPLES       =  2,
893     D3DMULTISAMPLE_3_SAMPLES       =  3,
894     D3DMULTISAMPLE_4_SAMPLES       =  4,
895     D3DMULTISAMPLE_5_SAMPLES       =  5,
896     D3DMULTISAMPLE_6_SAMPLES       =  6,
897     D3DMULTISAMPLE_7_SAMPLES       =  7,
898     D3DMULTISAMPLE_8_SAMPLES       =  8,
899     D3DMULTISAMPLE_9_SAMPLES       =  9,
900     D3DMULTISAMPLE_10_SAMPLES      = 10,
901     D3DMULTISAMPLE_11_SAMPLES      = 11,
902     D3DMULTISAMPLE_12_SAMPLES      = 12,
903     D3DMULTISAMPLE_13_SAMPLES      = 13,
904     D3DMULTISAMPLE_14_SAMPLES      = 14,
905     D3DMULTISAMPLE_15_SAMPLES      = 15,
906     D3DMULTISAMPLE_16_SAMPLES      = 16,
907 
908     D3DMULTISAMPLE_FORCE_DWORD     = 0x7fffffff
909 } D3DMULTISAMPLE_TYPE;
910 
911 #if 0
912 typedef enum _D3DORDERTYPE {
913    D3DORDER_LINEAR      = 1,
914    D3DORDER_QUADRATIC   = 2,
915    D3DORDER_CUBIC       = 3,
916    D3DORDER_QUINTIC     = 5,
917 
918    D3DORDER_FORCE_DWORD = 0x7fffffff
919 } D3DORDERTYPE;
920 #endif
921 typedef enum _D3DPATCHEDGESTYLE {
922    D3DPATCHEDGE_DISCRETE    = 0,
923    D3DPATCHEDGE_CONTINUOUS  = 1,
924 
925    D3DPATCHEDGE_FORCE_DWORD = 0x7fffffff,
926 } D3DPATCHEDGESTYLE;
927 
928 typedef enum _D3DPOOL {
929     D3DPOOL_DEFAULT                 = 0,
930     D3DPOOL_MANAGED                 = 1,
931     D3DPOOL_SYSTEMMEM               = 2,
932     D3DPOOL_SCRATCH                 = 3,
933 
934     D3DPOOL_FORCE_DWORD             = 0x7fffffff
935 } D3DPOOL;
936 
937 typedef enum _D3DPRIMITIVETYPE {
938     D3DPT_POINTLIST             = 1,
939     D3DPT_LINELIST              = 2,
940     D3DPT_LINESTRIP             = 3,
941     D3DPT_TRIANGLELIST          = 4,
942     D3DPT_TRIANGLESTRIP         = 5,
943     D3DPT_TRIANGLEFAN           = 6,
944 
945     D3DPT_FORCE_DWORD           = 0x7fffffff
946 } D3DPRIMITIVETYPE;
947 
948 typedef enum _D3DRENDERSTATETYPE {
949     D3DRS_ZENABLE                   =   7,
950     D3DRS_FILLMODE                  =   8,
951     D3DRS_SHADEMODE                 =   9,
952     D3DRS_ZWRITEENABLE              =  14,
953     D3DRS_ALPHATESTENABLE           =  15,
954     D3DRS_LASTPIXEL                 =  16,
955     D3DRS_SRCBLEND                  =  19,
956     D3DRS_DESTBLEND                 =  20,
957     D3DRS_CULLMODE                  =  22,
958     D3DRS_ZFUNC                     =  23,
959     D3DRS_ALPHAREF                  =  24,
960     D3DRS_ALPHAFUNC                 =  25,
961     D3DRS_DITHERENABLE              =  26,
962     D3DRS_ALPHABLENDENABLE          =  27,
963     D3DRS_FOGENABLE                 =  28,
964     D3DRS_SPECULARENABLE            =  29,
965     D3DRS_FOGCOLOR                  =  34,
966     D3DRS_FOGTABLEMODE              =  35,
967     D3DRS_FOGSTART                  =  36,
968     D3DRS_FOGEND                    =  37,
969     D3DRS_FOGDENSITY                =  38,
970     D3DRS_RANGEFOGENABLE            =  48,
971     D3DRS_STENCILENABLE             =  52,
972     D3DRS_STENCILFAIL               =  53,
973     D3DRS_STENCILZFAIL              =  54,
974     D3DRS_STENCILPASS               =  55,
975     D3DRS_STENCILFUNC               =  56,
976     D3DRS_STENCILREF                =  57,
977     D3DRS_STENCILMASK               =  58,
978     D3DRS_STENCILWRITEMASK          =  59,
979     D3DRS_TEXTUREFACTOR             =  60,
980     D3DRS_WRAP0                     = 128,
981     D3DRS_WRAP1                     = 129,
982     D3DRS_WRAP2                     = 130,
983     D3DRS_WRAP3                     = 131,
984     D3DRS_WRAP4                     = 132,
985     D3DRS_WRAP5                     = 133,
986     D3DRS_WRAP6                     = 134,
987     D3DRS_WRAP7                     = 135,
988     D3DRS_CLIPPING                  = 136,
989     D3DRS_LIGHTING                  = 137,
990     D3DRS_AMBIENT                   = 139,
991     D3DRS_FOGVERTEXMODE             = 140,
992     D3DRS_COLORVERTEX               = 141,
993     D3DRS_LOCALVIEWER               = 142,
994     D3DRS_NORMALIZENORMALS          = 143,
995     D3DRS_DIFFUSEMATERIALSOURCE     = 145,
996     D3DRS_SPECULARMATERIALSOURCE    = 146,
997     D3DRS_AMBIENTMATERIALSOURCE     = 147,
998     D3DRS_EMISSIVEMATERIALSOURCE    = 148,
999     D3DRS_VERTEXBLEND               = 151,
1000     D3DRS_CLIPPLANEENABLE           = 152,
1001     D3DRS_POINTSIZE                 = 154,
1002     D3DRS_POINTSIZE_MIN             = 155,
1003     D3DRS_POINTSPRITEENABLE         = 156,
1004     D3DRS_POINTSCALEENABLE          = 157,
1005     D3DRS_POINTSCALE_A              = 158,
1006     D3DRS_POINTSCALE_B              = 159,
1007     D3DRS_POINTSCALE_C              = 160,
1008     D3DRS_MULTISAMPLEANTIALIAS      = 161,
1009     D3DRS_MULTISAMPLEMASK           = 162,
1010     D3DRS_PATCHEDGESTYLE            = 163,
1011     D3DRS_DEBUGMONITORTOKEN         = 165,
1012     D3DRS_POINTSIZE_MAX             = 166,
1013     D3DRS_INDEXEDVERTEXBLENDENABLE  = 167,
1014     D3DRS_COLORWRITEENABLE          = 168,
1015     D3DRS_TWEENFACTOR               = 170,
1016     D3DRS_BLENDOP                   = 171,
1017     D3DRS_POSITIONDEGREE            = 172,
1018     D3DRS_NORMALDEGREE              = 173,
1019     D3DRS_SCISSORTESTENABLE         = 174,
1020     D3DRS_SLOPESCALEDEPTHBIAS       = 175,
1021     D3DRS_ANTIALIASEDLINEENABLE     = 176,
1022     D3DRS_MINTESSELLATIONLEVEL      = 178,
1023     D3DRS_MAXTESSELLATIONLEVEL      = 179,
1024     D3DRS_ADAPTIVETESS_X            = 180,
1025     D3DRS_ADAPTIVETESS_Y            = 181,
1026     D3DRS_ADAPTIVETESS_Z            = 182,
1027     D3DRS_ADAPTIVETESS_W            = 183,
1028     D3DRS_ENABLEADAPTIVETESSELLATION= 184,
1029     D3DRS_TWOSIDEDSTENCILMODE       = 185,
1030     D3DRS_CCW_STENCILFAIL           = 186,
1031     D3DRS_CCW_STENCILZFAIL          = 187,
1032     D3DRS_CCW_STENCILPASS           = 188,
1033     D3DRS_CCW_STENCILFUNC           = 189,
1034     D3DRS_COLORWRITEENABLE1         = 190,
1035     D3DRS_COLORWRITEENABLE2         = 191,
1036     D3DRS_COLORWRITEENABLE3         = 192,
1037     D3DRS_BLENDFACTOR               = 193,
1038     D3DRS_SRGBWRITEENABLE           = 194,
1039     D3DRS_DEPTHBIAS                 = 195,
1040     D3DRS_WRAP8                     = 198,
1041     D3DRS_WRAP9                     = 199,
1042     D3DRS_WRAP10                    = 200,
1043     D3DRS_WRAP11                    = 201,
1044     D3DRS_WRAP12                    = 202,
1045     D3DRS_WRAP13                    = 203,
1046     D3DRS_WRAP14                    = 204,
1047     D3DRS_WRAP15                    = 205,
1048     D3DRS_SEPARATEALPHABLENDENABLE  = 206,
1049     D3DRS_SRCBLENDALPHA             = 207,
1050     D3DRS_DESTBLENDALPHA            = 208,
1051     D3DRS_BLENDOPALPHA              = 209,
1052 
1053     D3DRS_FORCE_DWORD               = 0x7fffffff
1054 } D3DRENDERSTATETYPE;
1055 
1056 typedef enum _D3DRESOURCETYPE {
1057     D3DRTYPE_SURFACE                =  1,
1058     D3DRTYPE_VOLUME                 =  2,
1059     D3DRTYPE_TEXTURE                =  3,
1060     D3DRTYPE_VOLUMETEXTURE          =  4,
1061     D3DRTYPE_CUBETEXTURE            =  5,
1062     D3DRTYPE_VERTEXBUFFER           =  6,
1063     D3DRTYPE_INDEXBUFFER            =  7,
1064 
1065     D3DRTYPE_FORCE_DWORD            = 0x7fffffff
1066 } D3DRESOURCETYPE;
1067 
1068 #define D3DRTYPECOUNT (D3DRTYPE_INDEXBUFFER+1)
1069 
1070 typedef enum _D3DSHADEMODE {
1071     D3DSHADE_FLAT               = 1,
1072     D3DSHADE_GOURAUD            = 2,
1073     D3DSHADE_PHONG              = 3,
1074 
1075     D3DSHADE_FORCE_DWORD        = 0x7fffffff
1076 } D3DSHADEMODE;
1077 
1078 typedef enum _D3DSTATEBLOCKTYPE {
1079     D3DSBT_ALL           = 1,
1080     D3DSBT_PIXELSTATE    = 2,
1081     D3DSBT_VERTEXSTATE   = 3,
1082 
1083     D3DSBT_FORCE_DWORD   = 0xffffffff
1084 } D3DSTATEBLOCKTYPE;
1085 
1086 typedef enum _D3DSTENCILOP {
1087     D3DSTENCILOP_KEEP           = 1,
1088     D3DSTENCILOP_ZERO           = 2,
1089     D3DSTENCILOP_REPLACE        = 3,
1090     D3DSTENCILOP_INCRSAT        = 4,
1091     D3DSTENCILOP_DECRSAT        = 5,
1092     D3DSTENCILOP_INVERT         = 6,
1093     D3DSTENCILOP_INCR           = 7,
1094     D3DSTENCILOP_DECR           = 8,
1095 
1096     D3DSTENCILOP_FORCE_DWORD    = 0x7fffffff
1097 } D3DSTENCILOP;
1098 
1099 typedef enum _D3DSWAPEFFECT {
1100     D3DSWAPEFFECT_DISCARD         = 1,
1101     D3DSWAPEFFECT_FLIP            = 2,
1102     D3DSWAPEFFECT_COPY            = 3,
1103 #ifndef D3D_DISABLE_9EX
1104     D3DSWAPEFFECT_OVERLAY         = 4,
1105     D3DSWAPEFFECT_FLIPEX          = 5,
1106 #endif
1107     D3DSWAPEFFECT_FORCE_DWORD     = 0xFFFFFFFF
1108 } D3DSWAPEFFECT;
1109 
1110 typedef enum _D3DTEXTUREADDRESS {
1111     D3DTADDRESS_WRAP            = 1,
1112     D3DTADDRESS_MIRROR          = 2,
1113     D3DTADDRESS_CLAMP           = 3,
1114     D3DTADDRESS_BORDER          = 4,
1115     D3DTADDRESS_MIRRORONCE      = 5,
1116 
1117     D3DTADDRESS_FORCE_DWORD     = 0x7fffffff
1118 } D3DTEXTUREADDRESS;
1119 
1120 typedef enum _D3DTEXTUREFILTERTYPE {
1121     D3DTEXF_NONE            = 0,
1122     D3DTEXF_POINT           = 1,
1123     D3DTEXF_LINEAR          = 2,
1124     D3DTEXF_ANISOTROPIC     = 3,
1125     D3DTEXF_FLATCUBIC       = 4,
1126     D3DTEXF_GAUSSIANCUBIC   = 5,
1127     D3DTEXF_PYRAMIDALQUAD   = 6,
1128     D3DTEXF_GAUSSIANQUAD    = 7,
1129 #ifndef D3D_DISABLE_9EX
1130     D3DTEXF_CONVOLUTIONMONO = 8,
1131 #endif
1132     D3DTEXF_FORCE_DWORD     = 0x7fffffff
1133 } D3DTEXTUREFILTERTYPE;
1134 
1135 typedef enum _D3DTEXTUREOP {
1136     D3DTOP_DISABLE                   =  1,
1137     D3DTOP_SELECTARG1                =  2,
1138     D3DTOP_SELECTARG2                =  3,
1139     D3DTOP_MODULATE                  =  4,
1140     D3DTOP_MODULATE2X                =  5,
1141     D3DTOP_MODULATE4X                =  6,
1142     D3DTOP_ADD                       =  7,
1143     D3DTOP_ADDSIGNED                 =  8,
1144     D3DTOP_ADDSIGNED2X               =  9,
1145     D3DTOP_SUBTRACT                  = 10,
1146     D3DTOP_ADDSMOOTH                 = 11,
1147     D3DTOP_BLENDDIFFUSEALPHA         = 12,
1148     D3DTOP_BLENDTEXTUREALPHA         = 13,
1149     D3DTOP_BLENDFACTORALPHA          = 14,
1150     D3DTOP_BLENDTEXTUREALPHAPM       = 15,
1151     D3DTOP_BLENDCURRENTALPHA         = 16,
1152     D3DTOP_PREMODULATE               = 17,
1153     D3DTOP_MODULATEALPHA_ADDCOLOR    = 18,
1154     D3DTOP_MODULATECOLOR_ADDALPHA    = 19,
1155     D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,
1156     D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,
1157     D3DTOP_BUMPENVMAP                = 22,
1158     D3DTOP_BUMPENVMAPLUMINANCE       = 23,
1159     D3DTOP_DOTPRODUCT3               = 24,
1160     D3DTOP_MULTIPLYADD               = 25,
1161     D3DTOP_LERP                      = 26,
1162 
1163     D3DTOP_FORCE_DWORD               = 0x7fffffff,
1164 } D3DTEXTUREOP;
1165 
1166 typedef enum _D3DTEXTURESTAGESTATETYPE {
1167     D3DTSS_COLOROP               =  1,
1168     D3DTSS_COLORARG1             =  2,
1169     D3DTSS_COLORARG2             =  3,
1170     D3DTSS_ALPHAOP               =  4,
1171     D3DTSS_ALPHAARG1             =  5,
1172     D3DTSS_ALPHAARG2             =  6,
1173     D3DTSS_BUMPENVMAT00          =  7,
1174     D3DTSS_BUMPENVMAT01          =  8,
1175     D3DTSS_BUMPENVMAT10          =  9,
1176     D3DTSS_BUMPENVMAT11          = 10,
1177     D3DTSS_TEXCOORDINDEX         = 11,
1178     D3DTSS_BUMPENVLSCALE         = 22,
1179     D3DTSS_BUMPENVLOFFSET        = 23,
1180     D3DTSS_TEXTURETRANSFORMFLAGS = 24,
1181     D3DTSS_COLORARG0             = 26,
1182     D3DTSS_ALPHAARG0             = 27,
1183     D3DTSS_RESULTARG             = 28,
1184     D3DTSS_CONSTANT              = 32,
1185 
1186     D3DTSS_FORCE_DWORD           = 0x7fffffff
1187 } D3DTEXTURESTAGESTATETYPE;
1188 
1189 typedef enum _D3DTEXTURETRANSFORMFLAGS {
1190     D3DTTFF_DISABLE         =   0,
1191     D3DTTFF_COUNT1          =   1,
1192     D3DTTFF_COUNT2          =   2,
1193     D3DTTFF_COUNT3          =   3,
1194     D3DTTFF_COUNT4          =   4,
1195     D3DTTFF_PROJECTED       = 256,
1196 
1197     D3DTTFF_FORCE_DWORD     = 0x7fffffff
1198 } D3DTEXTURETRANSFORMFLAGS;
1199 
1200 typedef enum _D3DTRANSFORMSTATETYPE {
1201     D3DTS_VIEW            =  2,
1202     D3DTS_PROJECTION      =  3,
1203     D3DTS_TEXTURE0        = 16,
1204     D3DTS_TEXTURE1        = 17,
1205     D3DTS_TEXTURE2        = 18,
1206     D3DTS_TEXTURE3        = 19,
1207     D3DTS_TEXTURE4        = 20,
1208     D3DTS_TEXTURE5        = 21,
1209     D3DTS_TEXTURE6        = 22,
1210     D3DTS_TEXTURE7        = 23,
1211 
1212     D3DTS_FORCE_DWORD     = 0x7fffffff
1213 } D3DTRANSFORMSTATETYPE;
1214 
1215 typedef enum _D3DVERTEXBLENDFLAGS {
1216     D3DVBF_DISABLE  =   0,
1217     D3DVBF_1WEIGHTS =   1,
1218     D3DVBF_2WEIGHTS =   2,
1219     D3DVBF_3WEIGHTS =   3,
1220     D3DVBF_TWEENING = 255,
1221     D3DVBF_0WEIGHTS = 256
1222 } D3DVERTEXBLENDFLAGS;
1223 
1224 typedef enum _D3DZBUFFERTYPE {
1225     D3DZB_FALSE                 = 0,
1226     D3DZB_TRUE                  = 1,
1227     D3DZB_USEW                  = 2,
1228 
1229     D3DZB_FORCE_DWORD           = 0x7fffffff
1230 } D3DZBUFFERTYPE;
1231 
1232 typedef enum _D3DSAMPLERSTATETYPE {
1233     D3DSAMP_ADDRESSU       = 1,
1234     D3DSAMP_ADDRESSV       = 2,
1235     D3DSAMP_ADDRESSW       = 3,
1236     D3DSAMP_BORDERCOLOR    = 4,
1237     D3DSAMP_MAGFILTER      = 5,
1238     D3DSAMP_MINFILTER      = 6,
1239     D3DSAMP_MIPFILTER      = 7,
1240     D3DSAMP_MIPMAPLODBIAS  = 8,
1241     D3DSAMP_MAXMIPLEVEL    = 9,
1242     D3DSAMP_MAXANISOTROPY  = 10,
1243     D3DSAMP_SRGBTEXTURE    = 11,
1244     D3DSAMP_ELEMENTINDEX   = 12,
1245     D3DSAMP_DMAPOFFSET     = 13,
1246 
1247     D3DSAMP_FORCE_DWORD   = 0x7fffffff,
1248 } D3DSAMPLERSTATETYPE;
1249 
1250 
1251 /*****************************************************************************
1252  * Direct 3D v9 typedefs
1253  */
1254 #ifndef D3DCOLOR_DEFINED
1255 typedef DWORD D3DCOLOR;
1256 #define D3DCOLOR_DEFINED
1257 #endif
1258 
1259 /*****************************************************************************
1260  * Direct 3D v9 structures
1261  */
1262 typedef struct _D3DADAPTER_IDENTIFIER9 {
1263     char            Driver[MAX_DEVICE_IDENTIFIER_STRING];
1264     char            Description[MAX_DEVICE_IDENTIFIER_STRING];
1265     char            DeviceName[32];
1266     LARGE_INTEGER   DriverVersion;
1267 
1268     DWORD           VendorId;
1269     DWORD           DeviceId;
1270     DWORD           SubSysId;
1271     DWORD           Revision;
1272 
1273     GUID            DeviceIdentifier;
1274 
1275     DWORD           WHQLLevel;
1276 } D3DADAPTER_IDENTIFIER9;
1277 
1278 typedef struct _D3DBOX {
1279     UINT                Left;
1280     UINT                Top;
1281     UINT                Right;
1282     UINT                Bottom;
1283     UINT                Front;
1284     UINT                Back;
1285 } D3DBOX;
1286 
1287 typedef struct _D3DCLIPSTATUS9 {
1288    DWORD ClipUnion;
1289    DWORD ClipIntersection;
1290 } D3DCLIPSTATUS9;
1291 
1292 #ifndef D3DCOLORVALUE_DEFINED
1293 typedef struct _D3DCOLORVALUE {
1294     float r;
1295     float g;
1296     float b;
1297     float a;
1298 } D3DCOLORVALUE;
1299 #define D3DCOLORVALUE_DEFINED
1300 #endif
1301 
1302 typedef struct _D3DDEVICE_CREATION_PARAMETERS {
1303     UINT          AdapterOrdinal;
1304     D3DDEVTYPE    DeviceType;
1305     HWND          hFocusWindow;
1306     DWORD         BehaviorFlags;
1307 } D3DDEVICE_CREATION_PARAMETERS;
1308 
1309 typedef struct _D3DDEVINFO_D3D9BANDWIDTHTIMINGS {
1310     float         MaxBandwidthUtilized;
1311     float         FrontEndUploadMemoryUtilizedPercent;
1312     float         VertexRateUtilizedPercent;
1313     float         TriangleSetupRateUtilizedPercent;
1314     float         FillRateUtilizedPercent;
1315 } D3DDEVINFO_D3D9BANDWIDTHTIMINGS;
1316 
1317 typedef struct _D3DDEVINFO_D3D9CACHEUTILIZATION {
1318     float         TextureCacheHitRate;
1319     float         PostTransformVertexCacheHitRate;
1320 } D3DDEVINFO_D3D9CACHEUTILIZATION;
1321 
1322 typedef struct _D3DDEVINFO_D3D9INTERFACETIMINGS {
1323     float         WaitingForGPUToUseApplicationResourceTimePercent;
1324     float         WaitingForGPUToAcceptMoreCommandsTimePercent;
1325     float         WaitingForGPUToStayWithinLatencyTimePercent;
1326     float         WaitingForGPUExclusiveResourceTimePercent;
1327     float         WaitingForGPUOtherTimePercent;
1328 } D3DDEVINFO_D3D9INTERFACETIMINGS;
1329 
1330 typedef struct _D3DDEVINFO_D3D9PIPELINETIMINGS {
1331     float         VertexProcessingTimePercent;
1332     float         PixelProcessingTimePercent;
1333     float         OtherGPUProcessingTimePercent;
1334     float         GPUIdleTimePercent;
1335 } D3DDEVINFO_D3D9PIPELINETIMINGS;
1336 
1337 typedef struct _D3DDEVINFO_D3D9STAGETIMINGS {
1338     float         MemoryProcessingPercent;
1339     float         ComputationProcessingPercent;
1340 } D3DDEVINFO_D3D9STAGETIMINGS;
1341 
1342 
1343 /* Vertex cache optimization hints. */
1344 typedef struct D3DDEVINFO_VCACHE {
1345     /* Must be a 4 char code FOURCC (e.g. CACH) */
1346     DWORD         Pattern;
1347     /* 0 to get the longest  strips, 1 vertex cache */
1348     DWORD         OptMethod;
1349      /* Cache size to use (only valid if OptMethod==1) */
1350     DWORD         CacheSize;
1351     /* internal for deciding when to restart strips, non user modifiable (only valid if OptMethod==1) */
1352     DWORD         MagicNumber;
1353 } D3DDEVINFO_VCACHE;
1354 
1355 typedef struct D3DRESOURCESTATS {
1356     WINBOOL             bThrashing;
1357     DWORD               ApproxBytesDownloaded;
1358     DWORD               NumEvicts;
1359     DWORD               NumVidCreates;
1360     DWORD               LastPri;
1361     DWORD               NumUsed;
1362     DWORD               NumUsedInVidMem;
1363     DWORD               WorkingSet;
1364     DWORD               WorkingSetBytes;
1365     DWORD               TotalManaged;
1366     DWORD               TotalBytes;
1367 } D3DRESOURCESTATS;
1368 
1369 typedef struct _D3DDEVINFO_D3DRESOURCEMANAGER {
1370     D3DRESOURCESTATS stats[D3DRTYPECOUNT];
1371 } D3DDEVINFO_D3DRESOURCEMANAGER;
1372 
1373 typedef struct _D3DDEVINFO_D3DVERTEXSTATS {
1374     DWORD NumRenderedTriangles;
1375     DWORD NumExtraClippingTriangles;
1376 } D3DDEVINFO_D3DVERTEXSTATS;
1377 
1378 typedef struct _D3DDISPLAYMODE {
1379     UINT            Width;
1380     UINT            Height;
1381     UINT            RefreshRate;
1382     D3DFORMAT       Format;
1383 } D3DDISPLAYMODE;
1384 
1385 typedef struct _D3DGAMMARAMP {
1386     WORD                red  [256];
1387     WORD                green[256];
1388     WORD                blue [256];
1389 } D3DGAMMARAMP;
1390 
1391 typedef struct _D3DINDEXBUFFER_DESC {
1392     D3DFORMAT           Format;
1393     D3DRESOURCETYPE     Type;
1394     DWORD               Usage;
1395     D3DPOOL             Pool;
1396     UINT                Size;
1397 } D3DINDEXBUFFER_DESC;
1398 
1399 #ifndef D3DVECTOR_DEFINED
1400 typedef struct _D3DVECTOR {
1401     float x;
1402     float y;
1403     float z;
1404 } D3DVECTOR;
1405 #define D3DVECTOR_DEFINED
1406 #endif
1407 
1408 typedef struct _D3DLIGHT9 {
1409     D3DLIGHTTYPE    Type;
1410     D3DCOLORVALUE   Diffuse;
1411     D3DCOLORVALUE   Specular;
1412     D3DCOLORVALUE   Ambient;
1413     D3DVECTOR       Position;
1414     D3DVECTOR       Direction;
1415     float           Range;
1416     float           Falloff;
1417     float           Attenuation0;
1418     float           Attenuation1;
1419     float           Attenuation2;
1420     float           Theta;
1421     float           Phi;
1422 } D3DLIGHT9;
1423 
1424 typedef struct _D3DLINEPATTERN {
1425     WORD    wRepeatFactor;
1426     WORD    wLinePattern;
1427 } D3DLINEPATTERN;
1428 
1429 typedef struct _D3DLOCKED_BOX {
1430     INT                 RowPitch;
1431     INT                 SlicePitch;
1432     void*               pBits;
1433 } D3DLOCKED_BOX;
1434 
1435 typedef struct _D3DLOCKED_RECT {
1436     INT                 Pitch;
1437     void*               pBits;
1438 } D3DLOCKED_RECT;
1439 
1440 typedef struct _D3DMATERIAL9 {
1441     D3DCOLORVALUE   Diffuse;
1442     D3DCOLORVALUE   Ambient;
1443     D3DCOLORVALUE   Specular;
1444     D3DCOLORVALUE   Emissive;
1445     float           Power;
1446 } D3DMATERIAL9;
1447 
1448 #ifndef D3DMATRIX_DEFINED
1449 typedef struct _D3DMATRIX {
1450     union {
1451         struct {
1452             float        _11, _12, _13, _14;
1453             float        _21, _22, _23, _24;
1454             float        _31, _32, _33, _34;
1455             float        _41, _42, _43, _44;
1456         } DUMMYSTRUCTNAME;
1457         float m[4][4];
1458     } DUMMYUNIONNAME;
1459 } D3DMATRIX;
1460 #define D3DMATRIX_DEFINED
1461 #endif
1462 
1463 typedef struct _D3DPRESENT_PARAMETERS_ {
1464     UINT                    BackBufferWidth;
1465     UINT                    BackBufferHeight;
1466     D3DFORMAT               BackBufferFormat;
1467     UINT                    BackBufferCount;
1468 
1469     D3DMULTISAMPLE_TYPE     MultiSampleType;
1470     DWORD                   MultiSampleQuality;
1471 
1472     D3DSWAPEFFECT           SwapEffect;
1473     HWND                    hDeviceWindow;
1474     WINBOOL                 Windowed;
1475     WINBOOL                 EnableAutoDepthStencil;
1476     D3DFORMAT               AutoDepthStencilFormat;
1477     DWORD                   Flags;
1478 
1479     UINT                    FullScreen_RefreshRateInHz;
1480     UINT                    PresentationInterval;
1481 
1482 } D3DPRESENT_PARAMETERS;
1483 
1484 typedef struct _D3DRANGE {
1485     UINT                Offset;
1486     UINT                Size;
1487 } D3DRANGE;
1488 
1489 typedef struct _D3DRASTER_STATUS {
1490     WINBOOL         InVBlank;
1491     UINT            ScanLine;
1492 } D3DRASTER_STATUS;
1493 
1494 #ifndef D3DRECT_DEFINED
1495 typedef struct _D3DRECT {
1496     LONG x1;
1497     LONG y1;
1498     LONG x2;
1499     LONG y2;
1500 } D3DRECT;
1501 #define D3DRECT_DEFINED
1502 #endif
1503 
1504 typedef struct _D3DRECTPATCH_INFO {
1505     UINT                StartVertexOffsetWidth;
1506     UINT                StartVertexOffsetHeight;
1507     UINT                Width;
1508     UINT                Height;
1509     UINT                Stride;
1510     D3DBASISTYPE        Basis;
1511     D3DDEGREETYPE       Degree;
1512 } D3DRECTPATCH_INFO;
1513 
1514 typedef struct _D3DSURFACE_DESC {
1515     D3DFORMAT           Format;
1516     D3DRESOURCETYPE     Type;
1517     DWORD               Usage;
1518     D3DPOOL             Pool;
1519     D3DMULTISAMPLE_TYPE MultiSampleType;
1520     DWORD               MultiSampleQuality;
1521     UINT                Width;
1522     UINT                Height;
1523 } D3DSURFACE_DESC;
1524 
1525 typedef struct _D3DTRIPATCH_INFO {
1526     UINT                StartVertexOffset;
1527     UINT                NumVertices;
1528     D3DBASISTYPE        Basis;
1529     D3DDEGREETYPE       Degree;
1530 } D3DTRIPATCH_INFO;
1531 
1532 typedef struct _D3DVERTEXBUFFER_DESC {
1533     D3DFORMAT           Format;
1534     D3DRESOURCETYPE     Type;
1535     DWORD               Usage;
1536     D3DPOOL             Pool;
1537     UINT                Size;
1538     DWORD               FVF;
1539 } D3DVERTEXBUFFER_DESC;
1540 
1541 typedef struct _D3DVIEWPORT9 {
1542     DWORD       X;
1543     DWORD       Y;
1544     DWORD       Width;
1545     DWORD       Height;
1546     float       MinZ;
1547     float       MaxZ;
1548 } D3DVIEWPORT9;
1549 
1550 typedef struct _D3DVOLUME_DESC {
1551     D3DFORMAT           Format;
1552     D3DRESOURCETYPE     Type;
1553     DWORD               Usage;
1554     D3DPOOL             Pool;
1555 
1556     UINT                Width;
1557     UINT                Height;
1558     UINT                Depth;
1559 } D3DVOLUME_DESC;
1560 
1561 /* Parts added with d3d9ex */
1562 #if !defined(D3D_DISABLE_9EX)
1563 typedef enum D3DSCANLINEORDERING
1564 {
1565     D3DSCANLINEORDERING_UNKNOWN,
1566     D3DSCANLINEORDERING_PROGRESSIVE,
1567     D3DSCANLINEORDERING_INTERLACED,
1568 } D3DSCANLINEORDERING;
1569 
1570 
1571 typedef struct D3DDISPLAYMODEFILTER
1572 {
1573     UINT                Size;
1574     D3DFORMAT           Format;
1575     D3DSCANLINEORDERING ScanLineOrdering;
1576 } D3DDISPLAYMODEFILTER;
1577 
1578 typedef struct D3DDISPLAYMODEEX
1579 {
1580     UINT                Size;
1581     UINT                Width;
1582     UINT                Height;
1583     UINT                RefreshRate;
1584     D3DFORMAT           Format;
1585     D3DSCANLINEORDERING ScanLineOrdering;
1586 } D3DDISPLAYMODEEX;
1587 
1588 typedef enum D3DDISPLAYROTATION
1589 {
1590     D3DDISPLAYROTATION_IDENTITY = 1,
1591     D3DDISPLAYROTATION_90,
1592     D3DDISPLAYROTATION_180,
1593     D3DDISPLAYROTATION_270
1594 } D3DDISPLAYROTATION;
1595 
1596 typedef struct _D3DMEMORYPRESSURE
1597 {
1598     UINT64 BytesEvictedFromProcess;
1599     UINT64 SizeOfInefficientAllocation;
1600     DWORD  LevelOfEfficiency;
1601 } D3DMEMORYPRESSURE;
1602 
1603 typedef enum _D3DCOMPOSERECTSOP{
1604     D3DCOMPOSERECTS_COPY        = 1,
1605     D3DCOMPOSERECTS_OR,
1606     D3DCOMPOSERECTS_AND,
1607     D3DCOMPOSERECTS_NEG,
1608     D3DCOMPOSERECTS_FORCE_DWORD = 0x7fffffff
1609 } D3DCOMPOSERECTSOP;
1610 
1611 typedef struct _D3DPRESENTSTATS
1612 {
1613     UINT          PresentCount;
1614     UINT          PresentRefreshCount;
1615     UINT          SyncRefreshCount;
1616     LARGE_INTEGER SyncQPCTime;
1617     LARGE_INTEGER SyncGPUTime;
1618 } D3DPRESENTSTATS;
1619 
1620 #endif /* D3D_DISABLE_9EX */
1621 
1622 typedef enum _D3DSHADER_COMPARISON
1623 {
1624     D3DSPC_RESERVED0 = 0,
1625     D3DSPC_GT,
1626     D3DSPC_EQ,
1627     D3DSPC_GE,
1628     D3DSPC_LT,
1629     D3DSPC_NE,
1630     D3DSPC_LE,
1631     D3DSPC_RESERVED1,
1632 } D3DSHADER_COMPARISON;
1633 
1634 #ifdef __i386__
1635 #include <poppack.h>
1636 #endif
1637 
1638 #endif /* __WINE_D3D9TYPES_H */
1639