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