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