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