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