2 * Copyright (C) 2002 Jason Edmeades
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_D3D8TYPES_H
20 #define __WINE_D3D8TYPES_H
23 /*****************************************************************************
24 * Direct 3D v8 #defines
27 #define D3DCLEAR_TARGET 1
28 #define D3DCLEAR_ZBUFFER 2
29 #define D3DCLEAR_STENCIL 4
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)
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)
43 #define D3DCS_LEFT 0x001
44 #define D3DCS_RIGHT 0x002
45 #define D3DCS_TOP 0x004
46 #define D3DCS_BOTTOM 0x008
47 #define D3DCS_FRONT 0x010
48 #define D3DCS_BACK 0x020
49 #define D3DCS_PLANE0 0x040
50 #define D3DCS_PLANE1 0x080
51 #define D3DCS_PLANE2 0x100
52 #define D3DCS_PLANE3 0x200
53 #define D3DCS_PLANE4 0x400
54 #define D3DCS_PLANE5 0x800
55 #define D3DCS_ALL 0xFFF
57 #define D3DFVF_TEXTUREFORMAT1 3
58 #define D3DFVF_TEXTUREFORMAT2 0
59 #define D3DFVF_TEXTUREFORMAT3 1
60 #define D3DFVF_TEXTUREFORMAT4 2
61 #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
62 #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
63 #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
64 #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
66 #define D3DLOCK_READONLY 0x0010
67 #define D3DLOCK_NOSYSLOCK 0x0800
68 #define D3DLOCK_NOOVERWRITE 0x1000
69 #define D3DLOCK_DISCARD 0x2000
70 #define D3DLOCK_NO_DIRTY_UPDATE 0x8000
72 #define D3DMAXUSERCLIPPLANES 32
74 #define D3DRENDERSTATE_WRAPBIAS 0x80
76 #define D3DTSS_TCI_PASSTHRU 0x00000
77 #define D3DTSS_TCI_CAMERASPACENORMAL 0x10000
78 #define D3DTSS_TCI_CAMERASPACEPOSITION 0x20000
79 #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x30000
82 #define D3DTS_WORLD D3DTS_WORLDMATRIX(0)
83 #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
84 #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2)
85 #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3)
86 #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
88 #define D3DUSAGE_RENDERTARGET 0x01
89 #define D3DUSAGE_DEPTHSTENCIL 0x02
90 #define D3DUSAGE_WRITEONLY 0x08
91 #define D3DUSAGE_SOFTWAREPROCESSING 0x10
92 #define D3DUSAGE_DONOTCLIP 0x20
93 #define D3DUSAGE_POINTS 0x40
94 #define D3DUSAGE_RTPATCHES 0x80
95 #define D3DUSAGE_NPATCHES 0x100
96 #define D3DUSAGE_DYNAMIC 0x200
101 #define D3DWRAPCOORD_0 1
102 #define D3DWRAPCOORD_1 2
103 #define D3DWRAPCOORD_2 4
104 #define D3DWRAPCOORD_3 8
106 #define MAX_DEVICE_IDENTIFIER_STRING 512
108 #define D3DFVF_RESERVED0 0x0001
109 #define D3DFVF_POSITION_MASK 0x000E
110 #define D3DFVF_XYZ 0x0002
111 #define D3DFVF_XYZRHW 0x0004
112 #define D3DFVF_XYZB1 0x0006
113 #define D3DFVF_XYZB2 0x0008
114 #define D3DFVF_XYZB3 0x000a
115 #define D3DFVF_XYZB4 0x000c
116 #define D3DFVF_XYZB5 0x000e
117 #define D3DFVF_NORMAL 0x0010
118 #define D3DFVF_PSIZE 0x0020
119 #define D3DFVF_DIFFUSE 0x0040
120 #define D3DFVF_SPECULAR 0x0080
121 #define D3DFVF_TEXCOUNT_MASK 0x0f00
122 #define D3DFVF_TEXCOUNT_SHIFT 8
123 #define D3DFVF_TEX0 0x0000
124 #define D3DFVF_TEX1 0x0100
125 #define D3DFVF_TEX2 0x0200
126 #define D3DFVF_TEX3 0x0300
127 #define D3DFVF_TEX4 0x0400
128 #define D3DFVF_TEX5 0x0500
129 #define D3DFVF_TEX6 0x0600
130 #define D3DFVF_TEX7 0x0700
131 #define D3DFVF_TEX8 0x0800
132 #define D3DFVF_LASTBETA_UBYTE4 0x1000
133 #define D3DFVF_RESERVED2 0xE000
135 #define D3DTA_SELECTMASK 0x0000000f
136 #define D3DTA_DIFFUSE 0x00000000
137 #define D3DTA_CURRENT 0x00000001
138 #define D3DTA_TEXTURE 0x00000002
139 #define D3DTA_TFACTOR 0x00000003
140 #define D3DTA_SPECULAR 0x00000004
141 #define D3DTA_COMPLEMENT 0x00000010
142 #define D3DTA_ALPHAREPLICATE 0x00000020
143 #define D3DTA_TEMP 0x00000005
145 #define D3DCOLORWRITEENABLE_RED (__MSABI_LONG(1)<<0)
146 #define D3DCOLORWRITEENABLE_GREEN (__MSABI_LONG(1)<<1)
147 #define D3DCOLORWRITEENABLE_BLUE (__MSABI_LONG(1)<<2)
148 #define D3DCOLORWRITEENABLE_ALPHA (__MSABI_LONG(1)<<3)
152 #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
153 ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
154 ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
157 /****************************
158 * Vertex Shaders Declaration
161 typedef enum _D3DVSD_TOKENTYPE
{
162 D3DVSD_TOKEN_NOP
= 0,
163 D3DVSD_TOKEN_STREAM
= 1,
164 D3DVSD_TOKEN_STREAMDATA
= 2,
165 D3DVSD_TOKEN_TESSELLATOR
= 3,
166 D3DVSD_TOKEN_CONSTMEM
= 4,
167 D3DVSD_TOKEN_EXT
= 5,
169 D3DVSD_TOKEN_END
= 7,
170 D3DVSD_FORCE_DWORD
= 0x7FFFFFFF
173 /** input registers for vertex shaders functions */
175 #define D3DVSDE_POSITION 0
176 #define D3DVSDE_BLENDWEIGHT 1
177 #define D3DVSDE_BLENDINDICES 2
178 #define D3DVSDE_NORMAL 3
179 #define D3DVSDE_PSIZE 4
180 #define D3DVSDE_DIFFUSE 5
181 #define D3DVSDE_SPECULAR 6
182 #define D3DVSDE_TEXCOORD0 7
183 #define D3DVSDE_TEXCOORD1 8
184 #define D3DVSDE_TEXCOORD2 9
185 #define D3DVSDE_TEXCOORD3 10
186 #define D3DVSDE_TEXCOORD4 11
187 #define D3DVSDE_TEXCOORD5 12
188 #define D3DVSDE_TEXCOORD6 13
189 #define D3DVSDE_TEXCOORD7 14
190 #define D3DVSDE_POSITION2 15
191 #define D3DVSDE_NORMAL2 16
193 /** Address of the vertex register. 0 - 16 */
194 typedef enum _D3DVSDE_REGISTER
{
195 D3DVSDE_POSITION
= 0,
196 D3DVSDE_BLENDWEIGHT
= 1,
197 D3DVSDE_BLENDINDICES
= 2,
201 D3DVSDE_SPECULAR
= 6,
202 D3DVSDE_TEXCOORD0
= 7,
203 D3DVSDE_TEXCOORD1
= 8,
204 D3DVSDE_TEXCOORD2
= 9,
205 D3DVSDE_TEXCOORD3
= 10,
206 D3DVSDE_TEXCOORD4
= 11,
207 D3DVSDE_TEXCOORD5
= 12,
208 D3DVSDE_TEXCOORD6
= 13,
209 D3DVSDE_TEXCOORD7
= 14,
210 D3DVSDE_POSITION2
= 15,
214 /** bit-field declaration for VertexRegister Type */
216 #define D3DVSDT_FLOAT1 0x00
217 #define D3DVSDT_FLOAT2 0x01
218 #define D3DVSDT_FLOAT3 0x02
219 #define D3DVSDT_FLOAT4 0x03
220 #define D3DVSDT_D3DCOLOR 0x04
221 #define D3DVSDT_UBYTE4 0x05
222 #define D3DVSDT_SHORT2 0x06
223 #define D3DVSDT_SHORT4 0x07
225 typedef enum _D3DVSDT_TYPE
{
226 D3DVSDT_FLOAT1
= 0x00,
227 D3DVSDT_FLOAT2
= 0x01,
228 D3DVSDT_FLOAT3
= 0x02,
229 D3DVSDT_FLOAT4
= 0x03,
230 D3DVSDT_D3DCOLOR
= 0x04,
231 D3DVSDT_UBYTE4
= 0x05,
232 D3DVSDT_SHORT2
= 0x06,
233 D3DVSDT_SHORT4
= 0x07
237 #define D3DVSD_CONSTADDRESSSHIFT 0
238 #define D3DVSD_EXTINFOSHIFT 0
239 #define D3DVSD_STREAMNUMBERSHIFT 0
240 #define D3DVSD_VERTEXREGSHIFT 0
241 #define D3DVSD_CONSTRSSHIFT 16
242 #define D3DVSD_DATATYPESHIFT 16
243 #define D3DVSD_SKIPCOUNTSHIFT 16
244 #define D3DVSD_VERTEXREGINSHIFT 20
245 #define D3DVSD_EXTCOUNTSHIFT 24
246 #define D3DVSD_CONSTCOUNTSHIFT 25
247 #define D3DVSD_DATALOADTYPESHIFT 28
248 #define D3DVSD_STREAMTESSSHIFT 28
249 #define D3DVSD_TOKENTYPESHIFT 29
251 #define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT)
252 #define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT)
253 #define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT)
254 #define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT)
255 #define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT)
256 #define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT)
257 #define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT)
258 #define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT)
259 #define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT)
260 #define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT)
261 #define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT)
262 #define D3DVSD_STREAMTESSMASK (0x1 << D3DVSD_STREAMTESSSHIFT)
263 #define D3DVSD_TOKENTYPEMASK (0x7 << D3DVSD_TOKENTYPESHIFT)
266 #define D3DVSD_MAKETOKENTYPE(TokenType) \
267 ((TokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK)
269 #define D3DVSD_CONST(ConstantAddress, Count) \
270 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | ((Count) << D3DVSD_CONSTCOUNTSHIFT) | (ConstantAddress))
272 #define D3DVSD_END() 0xFFFFFFFF
274 #define D3DVSD_NOP() 0x00000000
276 #define D3DVSD_REG(VertexRegister, Type) \
277 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | ((Type) << D3DVSD_DATATYPESHIFT) | (VertexRegister))
279 #define D3DVSD_SKIP(Count) \
280 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | ((Count) << D3DVSD_SKIPCOUNTSHIFT))
282 #define D3DVSD_STREAM(StreamNumber) \
283 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (StreamNumber))
285 #define D3DVSD_STREAM_TESS() \
286 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK))
288 #define D3DVSD_TESSNORMAL(RegisterIn, RegisterOut) \
289 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | ((RegisterIn) << D3DVSD_VERTEXREGINSHIFT) | ((0x02) << D3DVSD_DATATYPESHIFT) | (RegisterOut))
291 #define D3DVSD_TESSUV(Register) \
292 (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | ((0x01) << D3DVSD_DATATYPESHIFT) | (Register))
295 /********************************
296 * Pixel/Vertex Shaders Functions
299 /** Maximum number of supported texture coordinates sets operation */
300 #define D3DDP_MAXTEXCOORD 8
302 /** opcode token mask */
303 #define D3DSI_OPCODE_MASK 0x0000FFFF
305 /** opcodes types for PS and VS */
306 typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE
{
333 D3DSIO_TEXCOORD
= 64,
338 D3DSIO_TEXREG2AR
= 69,
339 D3DSIO_TEXREG2GB
= 70,
340 D3DSIO_TEXM3x2PAD
= 71,
341 D3DSIO_TEXM3x2TEX
= 72,
342 D3DSIO_TEXM3x3PAD
= 73,
343 D3DSIO_TEXM3x3TEX
= 74,
344 D3DSIO_TEXM3x3DIFF
= 75,
345 D3DSIO_TEXM3x3SPEC
= 76,
346 D3DSIO_TEXM3x3VSPEC
= 77,
351 D3DSIO_TEXREG2RGB
= 82,
352 D3DSIO_TEXDP3TEX
= 83,
353 D3DSIO_TEXM3x2DEPTH
= 84,
356 D3DSIO_TEXDEPTH
= 87,
360 D3DSIO_PHASE
= 0xFFFD,
361 D3DSIO_COMMENT
= 0xFFFE,
364 D3DSIO_FORCE_DWORD
= 0X7FFFFFFF /** for 32-bit alignment */
365 } D3DSHADER_INSTRUCTION_OPCODE_TYPE
;
367 /** for parallelism */
368 #define D3DSI_COISSUE 0x40000000
370 /** destination parameter modifiers (.xyzw) */
371 #define D3DSP_WRITEMASK_0 0x00010000 /* .x r */
372 #define D3DSP_WRITEMASK_1 0x00020000 /* .y g */
373 #define D3DSP_WRITEMASK_2 0x00040000 /* .z b */
374 #define D3DSP_WRITEMASK_3 0x00080000 /* .w a */
375 #define D3DSP_WRITEMASK_ALL 0x000F0000 /* all */
377 #define D3DSP_DSTMOD_SHIFT 20
378 #define D3DSP_DSTMOD_MASK (0xF << D3DSP_DSTMOD_SHIFT)
380 typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE
{
381 D3DSPDM_NONE
= 0 << D3DSP_DSTMOD_SHIFT
,
382 D3DSPDM_SATURATE
= 1 << D3DSP_DSTMOD_SHIFT
,
383 D3DSPDM_FORCE_DWORD
= 0X7FFFFFFF
384 } D3DSHADER_PARAM_DSTMOD_TYPE
;
386 /** destination param */
387 #define D3DSP_DSTSHIFT_SHIFT 24
388 #define D3DSP_DSTSHIFT_MASK (0xF << D3DSP_DSTSHIFT_SHIFT)
390 /** destination/source reg type */
391 #define D3DSP_REGTYPE_SHIFT 28
392 #define D3DSP_REGTYPE_MASK (0x7 << D3DSP_REGTYPE_SHIFT)
394 typedef enum _D3DSHADER_PARAM_REGISTER_TYPE
{
395 D3DSPR_TEMP
= 0 << D3DSP_REGTYPE_SHIFT
,
396 D3DSPR_INPUT
= 1 << D3DSP_REGTYPE_SHIFT
,
397 D3DSPR_CONST
= 2 << D3DSP_REGTYPE_SHIFT
,
398 D3DSPR_ADDR
= 3 << D3DSP_REGTYPE_SHIFT
,
399 D3DSPR_TEXTURE
= 3 << D3DSP_REGTYPE_SHIFT
,
400 D3DSPR_RASTOUT
= 4 << D3DSP_REGTYPE_SHIFT
,
401 D3DSPR_ATTROUT
= 5 << D3DSP_REGTYPE_SHIFT
,
402 D3DSPR_TEXCRDOUT
= 6 << D3DSP_REGTYPE_SHIFT
,
403 D3DSPR_FORCE_DWORD
= 0x7FFFFFFF
404 } D3DSHADER_PARAM_REGISTER_TYPE
;
406 typedef enum _D3DVS_RASTOUT_OFFSETS
{
409 D3DSRO_POINT_SIZE
= 2,
410 D3DSRO_FORCE_DWORD
= 0x7FFFFFFF
411 } D3DVS_RASTOUT_OFFSETS
;
413 #define D3DVS_ADDRESSMODE_SHIFT 13
414 #define D3DVS_ADDRESSMODE_MASK (0x1 << D3DVS_ADDRESSMODE_SHIFT)
416 typedef enum _D3DVS_ADDRESSMODE_TYPE
{
417 D3DVS_ADDRMODE_ABSOLUTE
= 0 << D3DVS_ADDRESSMODE_SHIFT
,
418 D3DVS_ADDRMODE_RELATIVE
= 1 << D3DVS_ADDRESSMODE_SHIFT
,
419 D3DVS_ADDRMODE_FORCE_DWORD
= 0x7FFFFFFF
420 } D3DVS_ADDRESSMODE_TYPE
;
422 #define D3DVS_SWIZZLE_SHIFT 16
423 #define D3DVS_SWIZZLE_MASK (0xFF << D3DVS_SWIZZLE_SHIFT)
425 #define D3DSP_SWIZZLE_SHIFT 16
426 #define D3DSP_SWIZZLE_MASK (0xFF << D3DSP_SWIZZLE_SHIFT)
428 #define D3DVS_X_X (0 << D3DVS_SWIZZLE_SHIFT)
429 #define D3DVS_X_Y (1 << D3DVS_SWIZZLE_SHIFT)
430 #define D3DVS_X_Z (2 << D3DVS_SWIZZLE_SHIFT)
431 #define D3DVS_X_W (3 << D3DVS_SWIZZLE_SHIFT)
433 #define D3DVS_Y_X (0 << (D3DVS_SWIZZLE_SHIFT + 2))
434 #define D3DVS_Y_Y (1 << (D3DVS_SWIZZLE_SHIFT + 2))
435 #define D3DVS_Y_Z (2 << (D3DVS_SWIZZLE_SHIFT + 2))
436 #define D3DVS_Y_W (3 << (D3DVS_SWIZZLE_SHIFT + 2))
438 #define D3DVS_Z_X (0 << (D3DVS_SWIZZLE_SHIFT + 4))
439 #define D3DVS_Z_Y (1 << (D3DVS_SWIZZLE_SHIFT + 4))
440 #define D3DVS_Z_Z (2 << (D3DVS_SWIZZLE_SHIFT + 4))
441 #define D3DVS_Z_W (3 << (D3DVS_SWIZZLE_SHIFT + 4))
443 #define D3DVS_W_X (0 << (D3DVS_SWIZZLE_SHIFT + 6))
444 #define D3DVS_W_Y (1 << (D3DVS_SWIZZLE_SHIFT + 6))
445 #define D3DVS_W_Z (2 << (D3DVS_SWIZZLE_SHIFT + 6))
446 #define D3DVS_W_W (3 << (D3DVS_SWIZZLE_SHIFT + 6))
448 #define D3DVS_NOSWIZZLE (D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W)
450 #define D3DSP_NOSWIZZLE \
451 ((0 << (D3DSP_SWIZZLE_SHIFT + 0)) | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) | (3 << (D3DSP_SWIZZLE_SHIFT + 6)))
453 #define D3DSP_SRCMOD_SHIFT 24
454 #define D3DSP_SRCMOD_MASK (0xF << D3DSP_SRCMOD_SHIFT)
456 typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE
{
457 D3DSPSM_NONE
= 0 << D3DSP_SRCMOD_SHIFT
,
458 D3DSPSM_NEG
= 1 << D3DSP_SRCMOD_SHIFT
,
459 D3DSPSM_BIAS
= 2 << D3DSP_SRCMOD_SHIFT
,
460 D3DSPSM_BIASNEG
= 3 << D3DSP_SRCMOD_SHIFT
,
461 D3DSPSM_SIGN
= 4 << D3DSP_SRCMOD_SHIFT
,
462 D3DSPSM_SIGNNEG
= 5 << D3DSP_SRCMOD_SHIFT
,
463 D3DSPSM_COMP
= 6 << D3DSP_SRCMOD_SHIFT
,
464 D3DSPSM_X2
= 7 << D3DSP_SRCMOD_SHIFT
,
465 D3DSPSM_X2NEG
= 8 << D3DSP_SRCMOD_SHIFT
,
466 D3DSPSM_DZ
= 9 << D3DSP_SRCMOD_SHIFT
,
467 D3DSPSM_DW
= 10 << D3DSP_SRCMOD_SHIFT
,
468 D3DSPSM_FORCE_DWORD
= 0x7FFFFFFF
469 } D3DSHADER_PARAM_SRCMOD_TYPE
;
471 #define D3DPS_VERSION(major, minor) (0xFFFF0000 | ((major) << 8) | (minor))
472 #define D3DVS_VERSION(major, minor) (0xFFFE0000 | ((major) << 8) | (minor))
473 #define D3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xFF)
474 #define D3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF)
476 #define D3DSI_COMMENTSIZE_SHIFT 16
477 #define D3DSI_COMMENTSIZE_MASK (0x7FFF << D3DSI_COMMENTSIZE_SHIFT)
479 #define D3DSHADER_COMMENT(commentSize) \
480 ((((commentSize) << D3DSI_COMMENTSIZE_SHIFT) & D3DSI_COMMENTSIZE_MASK) | D3DSIO_COMMENT)
482 #define D3DPS_END() 0x0000FFFF
483 #define D3DVS_END() 0x0000FFFF
486 /*****************************************************************************
487 * Direct 3D v8 enumerated types
489 typedef enum _D3DBACKBUFFER_TYPE
{
490 D3DBACKBUFFER_TYPE_MONO
= 0,
491 D3DBACKBUFFER_TYPE_LEFT
= 1,
492 D3DBACKBUFFER_TYPE_RIGHT
= 2,
494 D3DBACKBUFFER_TYPE_FORCE_DWORD
= 0x7fffffff
495 } D3DBACKBUFFER_TYPE
;
497 typedef enum _D3DBASISTYPE
{
499 D3DBASIS_BSPLINE
= 1,
500 D3DBASIS_INTERPOLATE
= 2,
502 D3DBASIS_FORCE_DWORD
= 0x7fffffff
505 typedef enum _D3DBLEND
{
508 D3DBLEND_SRCCOLOR
= 3,
509 D3DBLEND_INVSRCCOLOR
= 4,
510 D3DBLEND_SRCALPHA
= 5,
511 D3DBLEND_INVSRCALPHA
= 6,
512 D3DBLEND_DESTALPHA
= 7,
513 D3DBLEND_INVDESTALPHA
= 8,
514 D3DBLEND_DESTCOLOR
= 9,
515 D3DBLEND_INVDESTCOLOR
= 10,
516 D3DBLEND_SRCALPHASAT
= 11,
517 D3DBLEND_BOTHSRCALPHA
= 12,
518 D3DBLEND_BOTHINVSRCALPHA
= 13,
520 D3DBLEND_FORCE_DWORD
= 0x7fffffff
523 typedef enum _D3DBLENDOP
{
525 D3DBLENDOP_SUBTRACT
= 2,
526 D3DBLENDOP_REVSUBTRACT
= 3,
530 D3DBLENDOP_FORCE_DWORD
= 0x7fffffff
533 typedef enum _D3DCMPFUNC
{
537 D3DCMP_LESSEQUAL
= 4,
540 D3DCMP_GREATEREQUAL
= 7,
543 D3DCMP_FORCE_DWORD
= 0x7fffffff
546 typedef enum _D3DCUBEMAP_FACES
{
547 D3DCUBEMAP_FACE_POSITIVE_X
= 0,
548 D3DCUBEMAP_FACE_NEGATIVE_X
= 1,
549 D3DCUBEMAP_FACE_POSITIVE_Y
= 2,
550 D3DCUBEMAP_FACE_NEGATIVE_Y
= 3,
551 D3DCUBEMAP_FACE_POSITIVE_Z
= 4,
552 D3DCUBEMAP_FACE_NEGATIVE_Z
= 5,
554 D3DCUBEMAP_FACE_FORCE_DWORD
= 0xffffffff
557 typedef enum _D3DCULL
{
562 D3DCULL_FORCE_DWORD
= 0x7fffffff
565 typedef enum _D3DDEBUGMONITORTOKENS
{
569 D3DDMT_FORCE_DWORD
= 0x7fffffff
570 } D3DDEBUGMONITORTOKENS
;
572 typedef enum _D3DDEVTYPE
{
577 D3DDEVTYPE_FORCE_DWORD
= 0xffffffff
580 typedef enum _D3DFILLMODE
{
582 D3DFILL_WIREFRAME
= 2,
585 D3DFILL_FORCE_DWORD
= 0x7fffffff
588 typedef enum _D3DFOGMODE
{
594 D3DFOG_FORCE_DWORD
= 0x7fffffff
597 typedef enum _D3DFORMAT
{
601 D3DFMT_A8R8G8B8
= 21,
602 D3DFMT_X8R8G8B8
= 22,
604 D3DFMT_X1R5G5B5
= 24,
605 D3DFMT_A1R5G5B5
= 25,
606 D3DFMT_A4R4G4B4
= 26,
609 D3DFMT_A8R3G3B2
= 29,
610 D3DFMT_X4R4G4B4
= 30,
611 D3DFMT_A2B10G10R10
= 31,
623 D3DFMT_X8L8V8U8
= 62,
624 D3DFMT_Q8W8V8U8
= 63,
626 D3DFMT_W11V11U10
= 65,
627 D3DFMT_A2W10V10U10
= 67,
629 D3DFMT_UYVY
= MAKEFOURCC('U', 'Y', 'V', 'Y'),
630 D3DFMT_YUY2
= MAKEFOURCC('Y', 'U', 'Y', '2'),
631 D3DFMT_DXT1
= MAKEFOURCC('D', 'X', 'T', '1'),
632 D3DFMT_DXT2
= MAKEFOURCC('D', 'X', 'T', '2'),
633 D3DFMT_DXT3
= MAKEFOURCC('D', 'X', 'T', '3'),
634 D3DFMT_DXT4
= MAKEFOURCC('D', 'X', 'T', '4'),
635 D3DFMT_DXT5
= MAKEFOURCC('D', 'X', 'T', '5'),
637 D3DFMT_D16_LOCKABLE
= 70,
645 D3DFMT_VERTEXDATA
= 100,
646 D3DFMT_INDEX16
= 101,
647 D3DFMT_INDEX32
= 102,
649 D3DFMT_FORCE_DWORD
= 0xFFFFFFFF
652 typedef enum _D3DLIGHTTYPE
{
655 D3DLIGHT_DIRECTIONAL
= 3,
657 D3DLIGHT_FORCE_DWORD
= 0x7fffffff
660 typedef enum _D3DMATERIALCOLORSOURCE
{
665 D3DMCS_FORCE_DWORD
= 0x7fffffff
666 } D3DMATERIALCOLORSOURCE
;
668 typedef enum _D3DMULTISAMPLE_TYPE
{
669 D3DMULTISAMPLE_NONE
= 0,
670 D3DMULTISAMPLE_2_SAMPLES
= 2,
671 D3DMULTISAMPLE_3_SAMPLES
= 3,
672 D3DMULTISAMPLE_4_SAMPLES
= 4,
673 D3DMULTISAMPLE_5_SAMPLES
= 5,
674 D3DMULTISAMPLE_6_SAMPLES
= 6,
675 D3DMULTISAMPLE_7_SAMPLES
= 7,
676 D3DMULTISAMPLE_8_SAMPLES
= 8,
677 D3DMULTISAMPLE_9_SAMPLES
= 9,
678 D3DMULTISAMPLE_10_SAMPLES
= 10,
679 D3DMULTISAMPLE_11_SAMPLES
= 11,
680 D3DMULTISAMPLE_12_SAMPLES
= 12,
681 D3DMULTISAMPLE_13_SAMPLES
= 13,
682 D3DMULTISAMPLE_14_SAMPLES
= 14,
683 D3DMULTISAMPLE_15_SAMPLES
= 15,
684 D3DMULTISAMPLE_16_SAMPLES
= 16,
686 D3DMULTISAMPLE_FORCE_DWORD
= 0x7fffffff
687 } D3DMULTISAMPLE_TYPE
;
689 typedef enum _D3DORDERTYPE
{
691 D3DORDER_QUADRATIC
= 2,
693 D3DORDER_QUINTIC
= 5,
695 D3DORDER_FORCE_DWORD
= 0x7fffffff
698 typedef enum _D3DPATCHEDGESTYLE
{
699 D3DPATCHEDGE_DISCRETE
= 0,
700 D3DPATCHEDGE_CONTINUOUS
= 1,
702 D3DPATCHEDGE_FORCE_DWORD
= 0x7fffffff,
705 typedef enum _D3DPOOL
{
708 D3DPOOL_SYSTEMMEM
= 2,
711 D3DPOOL_FORCE_DWORD
= 0x7fffffff
714 typedef enum _D3DPRIMITIVETYPE
{
718 D3DPT_TRIANGLELIST
= 4,
719 D3DPT_TRIANGLESTRIP
= 5,
720 D3DPT_TRIANGLEFAN
= 6,
722 D3DPT_FORCE_DWORD
= 0x7fffffff
725 typedef enum _D3DRENDERSTATETYPE
{
729 D3DRS_LINEPATTERN
= 10,
730 D3DRS_ZWRITEENABLE
= 14,
731 D3DRS_ALPHATESTENABLE
= 15,
732 D3DRS_LASTPIXEL
= 16,
734 D3DRS_DESTBLEND
= 20,
738 D3DRS_ALPHAFUNC
= 25,
739 D3DRS_DITHERENABLE
= 26,
740 D3DRS_ALPHABLENDENABLE
= 27,
741 D3DRS_FOGENABLE
= 28,
742 D3DRS_SPECULARENABLE
= 29,
745 D3DRS_FOGTABLEMODE
= 35,
748 D3DRS_FOGDENSITY
= 38,
749 D3DRS_EDGEANTIALIAS
= 40,
751 D3DRS_RANGEFOGENABLE
= 48,
752 D3DRS_STENCILENABLE
= 52,
753 D3DRS_STENCILFAIL
= 53,
754 D3DRS_STENCILZFAIL
= 54,
755 D3DRS_STENCILPASS
= 55,
756 D3DRS_STENCILFUNC
= 56,
757 D3DRS_STENCILREF
= 57,
758 D3DRS_STENCILMASK
= 58,
759 D3DRS_STENCILWRITEMASK
= 59,
760 D3DRS_TEXTUREFACTOR
= 60,
769 D3DRS_CLIPPING
= 136,
770 D3DRS_LIGHTING
= 137,
772 D3DRS_FOGVERTEXMODE
= 140,
773 D3DRS_COLORVERTEX
= 141,
774 D3DRS_LOCALVIEWER
= 142,
775 D3DRS_NORMALIZENORMALS
= 143,
776 D3DRS_DIFFUSEMATERIALSOURCE
= 145,
777 D3DRS_SPECULARMATERIALSOURCE
= 146,
778 D3DRS_AMBIENTMATERIALSOURCE
= 147,
779 D3DRS_EMISSIVEMATERIALSOURCE
= 148,
780 D3DRS_VERTEXBLEND
= 151,
781 D3DRS_CLIPPLANEENABLE
= 152,
782 D3DRS_SOFTWAREVERTEXPROCESSING
= 153,
783 D3DRS_POINTSIZE
= 154,
784 D3DRS_POINTSIZE_MIN
= 155,
785 D3DRS_POINTSPRITEENABLE
= 156,
786 D3DRS_POINTSCALEENABLE
= 157,
787 D3DRS_POINTSCALE_A
= 158,
788 D3DRS_POINTSCALE_B
= 159,
789 D3DRS_POINTSCALE_C
= 160,
790 D3DRS_MULTISAMPLEANTIALIAS
= 161,
791 D3DRS_MULTISAMPLEMASK
= 162,
792 D3DRS_PATCHEDGESTYLE
= 163,
793 D3DRS_PATCHSEGMENTS
= 164,
794 D3DRS_DEBUGMONITORTOKEN
= 165,
795 D3DRS_POINTSIZE_MAX
= 166,
796 D3DRS_INDEXEDVERTEXBLENDENABLE
= 167,
797 D3DRS_COLORWRITEENABLE
= 168,
798 D3DRS_TWEENFACTOR
= 170,
800 D3DRS_POSITIONORDER
= 172,
801 D3DRS_NORMALORDER
= 173,
803 D3DRS_FORCE_DWORD
= 0x7fffffff
804 } D3DRENDERSTATETYPE
;
806 typedef enum _D3DRESOURCETYPE
{
807 D3DRTYPE_SURFACE
= 1,
809 D3DRTYPE_TEXTURE
= 3,
810 D3DRTYPE_VOLUMETEXTURE
= 4,
811 D3DRTYPE_CUBETEXTURE
= 5,
812 D3DRTYPE_VERTEXBUFFER
= 6,
813 D3DRTYPE_INDEXBUFFER
= 7,
815 D3DRTYPE_FORCE_DWORD
= 0x7fffffff
818 typedef enum _D3DSHADEMODE
{
820 D3DSHADE_GOURAUD
= 2,
823 D3DSHADE_FORCE_DWORD
= 0x7fffffff
826 typedef enum _D3DSTATEBLOCKTYPE
{
828 D3DSBT_PIXELSTATE
= 2,
829 D3DSBT_VERTEXSTATE
= 3,
831 D3DSBT_FORCE_DWORD
= 0xffffffff
834 typedef enum _D3DSTENCILOP
{
835 D3DSTENCILOP_KEEP
= 1,
836 D3DSTENCILOP_ZERO
= 2,
837 D3DSTENCILOP_REPLACE
= 3,
838 D3DSTENCILOP_INCRSAT
= 4,
839 D3DSTENCILOP_DECRSAT
= 5,
840 D3DSTENCILOP_INVERT
= 6,
841 D3DSTENCILOP_INCR
= 7,
842 D3DSTENCILOP_DECR
= 8,
844 D3DSTENCILOP_FORCE_DWORD
= 0x7fffffff
847 typedef enum _D3DSWAPEFFECT
{
848 D3DSWAPEFFECT_DISCARD
= 1,
849 D3DSWAPEFFECT_FLIP
= 2,
850 D3DSWAPEFFECT_COPY
= 3,
851 D3DSWAPEFFECT_COPY_VSYNC
= 4,
853 D3DSWAPEFFECT_FORCE_DWORD
= 0xFFFFFFFF
856 typedef enum _D3DTEXTUREADDRESS
{
857 D3DTADDRESS_WRAP
= 1,
858 D3DTADDRESS_MIRROR
= 2,
859 D3DTADDRESS_CLAMP
= 3,
860 D3DTADDRESS_BORDER
= 4,
861 D3DTADDRESS_MIRRORONCE
= 5,
863 D3DTADDRESS_FORCE_DWORD
= 0x7fffffff
866 typedef enum _D3DTEXTUREFILTERTYPE
{
870 D3DTEXF_ANISOTROPIC
= 3,
871 D3DTEXF_FLATCUBIC
= 4,
872 D3DTEXF_GAUSSIANCUBIC
= 5,
874 D3DTEXF_FORCE_DWORD
= 0x7fffffff
875 } D3DTEXTUREFILTERTYPE
;
877 typedef enum _D3DTEXTUREOP
{
879 D3DTOP_SELECTARG1
= 2,
880 D3DTOP_SELECTARG2
= 3,
882 D3DTOP_MODULATE2X
= 5,
883 D3DTOP_MODULATE4X
= 6,
885 D3DTOP_ADDSIGNED
= 8,
886 D3DTOP_ADDSIGNED2X
= 9,
887 D3DTOP_SUBTRACT
= 10,
888 D3DTOP_ADDSMOOTH
= 11,
889 D3DTOP_BLENDDIFFUSEALPHA
= 12,
890 D3DTOP_BLENDTEXTUREALPHA
= 13,
891 D3DTOP_BLENDFACTORALPHA
= 14,
892 D3DTOP_BLENDTEXTUREALPHAPM
= 15,
893 D3DTOP_BLENDCURRENTALPHA
= 16,
894 D3DTOP_PREMODULATE
= 17,
895 D3DTOP_MODULATEALPHA_ADDCOLOR
= 18,
896 D3DTOP_MODULATECOLOR_ADDALPHA
= 19,
897 D3DTOP_MODULATEINVALPHA_ADDCOLOR
= 20,
898 D3DTOP_MODULATEINVCOLOR_ADDALPHA
= 21,
899 D3DTOP_BUMPENVMAP
= 22,
900 D3DTOP_BUMPENVMAPLUMINANCE
= 23,
901 D3DTOP_DOTPRODUCT3
= 24,
902 D3DTOP_MULTIPLYADD
= 25,
905 D3DTOP_FORCE_DWORD
= 0x7fffffff,
908 typedef enum _D3DTEXTURESTAGESTATETYPE
{
910 D3DTSS_COLORARG1
= 2,
911 D3DTSS_COLORARG2
= 3,
913 D3DTSS_ALPHAARG1
= 5,
914 D3DTSS_ALPHAARG2
= 6,
915 D3DTSS_BUMPENVMAT00
= 7,
916 D3DTSS_BUMPENVMAT01
= 8,
917 D3DTSS_BUMPENVMAT10
= 9,
918 D3DTSS_BUMPENVMAT11
= 10,
919 D3DTSS_TEXCOORDINDEX
= 11,
920 D3DTSS_ADDRESSU
= 13,
921 D3DTSS_ADDRESSV
= 14,
922 D3DTSS_BORDERCOLOR
= 15,
923 D3DTSS_MAGFILTER
= 16,
924 D3DTSS_MINFILTER
= 17,
925 D3DTSS_MIPFILTER
= 18,
926 D3DTSS_MIPMAPLODBIAS
= 19,
927 D3DTSS_MAXMIPLEVEL
= 20,
928 D3DTSS_MAXANISOTROPY
= 21,
929 D3DTSS_BUMPENVLSCALE
= 22,
930 D3DTSS_BUMPENVLOFFSET
= 23,
931 D3DTSS_TEXTURETRANSFORMFLAGS
= 24,
932 D3DTSS_ADDRESSW
= 25,
933 D3DTSS_COLORARG0
= 26,
934 D3DTSS_ALPHAARG0
= 27,
935 D3DTSS_RESULTARG
= 28,
937 D3DTSS_FORCE_DWORD
= 0x7fffffff
938 } D3DTEXTURESTAGESTATETYPE
;
940 typedef enum _D3DTEXTURETRANSFORMFLAGS
{
946 D3DTTFF_PROJECTED
= 256,
948 D3DTTFF_FORCE_DWORD
= 0x7fffffff
949 } D3DTEXTURETRANSFORMFLAGS
;
951 typedef enum _D3DTRANSFORMSTATETYPE
{
953 D3DTS_PROJECTION
= 3,
963 D3DTS_FORCE_DWORD
= 0x7fffffff
964 } D3DTRANSFORMSTATETYPE
;
966 typedef enum _D3DVERTEXBLENDFLAGS
{
971 D3DVBF_TWEENING
= 255,
972 D3DVBF_0WEIGHTS
= 256
973 } D3DVERTEXBLENDFLAGS
;
975 typedef enum _D3DZBUFFERTYPE
{
980 D3DZB_FORCE_DWORD
= 0x7fffffff
984 /*****************************************************************************
985 * Direct 3D v8 typedefs
987 typedef DWORD D3DCOLOR
;
989 /*****************************************************************************
990 * Direct 3D v8 structures
992 typedef struct _D3DADAPTER_IDENTIFIER8
{
993 char Driver
[MAX_DEVICE_IDENTIFIER_STRING
];
994 char Description
[MAX_DEVICE_IDENTIFIER_STRING
];
996 LARGE_INTEGER DriverVersion
;
1002 GUID DeviceIdentifier
;
1005 } D3DADAPTER_IDENTIFIER8
;
1007 typedef struct _D3DBOX
{
1016 typedef struct _D3DCLIPSTATUS8
{
1018 DWORD ClipIntersection
;
1021 typedef struct _D3DCOLORVALUE
{
1028 typedef struct _D3DDEVICE_CREATION_PARAMETERS
{
1029 UINT AdapterOrdinal
;
1030 D3DDEVTYPE DeviceType
;
1032 DWORD BehaviorFlags
;
1033 } D3DDEVICE_CREATION_PARAMETERS
;
1035 typedef struct _D3DDISPLAYMODE
{
1042 typedef struct _D3DGAMMARAMP
{
1048 typedef struct _D3DINDEXBUFFER_DESC
{
1050 D3DRESOURCETYPE Type
;
1054 } D3DINDEXBUFFER_DESC
;
1056 #ifndef D3DVECTOR_DEFINED
1057 typedef struct _D3DVECTOR
{
1062 #define D3DVECTOR_DEFINED
1065 typedef struct _D3DLIGHT8
{
1067 D3DCOLORVALUE Diffuse
;
1068 D3DCOLORVALUE Specular
;
1069 D3DCOLORVALUE Ambient
;
1071 D3DVECTOR Direction
;
1081 typedef struct _D3DLINEPATTERN
{
1086 typedef struct _D3DLOCKED_BOX
{
1092 typedef struct _D3DLOCKED_RECT
{
1097 typedef struct _D3DMATERIAL8
{
1098 D3DCOLORVALUE Diffuse
;
1099 D3DCOLORVALUE Ambient
;
1100 D3DCOLORVALUE Specular
;
1101 D3DCOLORVALUE Emissive
;
1105 typedef struct _D3DMATRIX
{
1108 float _11
, _12
, _13
, _14
;
1109 float _21
, _22
, _23
, _24
;
1110 float _31
, _32
, _33
, _34
;
1111 float _41
, _42
, _43
, _44
;
1117 typedef struct _D3DPRESENT_PARAMETERS_
{
1118 UINT BackBufferWidth
;
1119 UINT BackBufferHeight
;
1120 D3DFORMAT BackBufferFormat
;
1121 UINT BackBufferCount
;
1123 D3DMULTISAMPLE_TYPE MultiSampleType
;
1125 D3DSWAPEFFECT SwapEffect
;
1128 BOOL EnableAutoDepthStencil
;
1129 D3DFORMAT AutoDepthStencilFormat
;
1132 UINT FullScreen_RefreshRateInHz
;
1133 UINT FullScreen_PresentationInterval
;
1135 } D3DPRESENT_PARAMETERS
;
1137 #define D3DPRESENTFLAG_LOCKABLE_BACKBUFFER 0x00000001
1139 typedef struct _D3DRANGE
{
1144 typedef struct _D3DRASTER_STATUS
{
1149 typedef struct _D3DRECT
{
1156 typedef struct _D3DRECTPATCH_INFO
{
1157 UINT StartVertexOffsetWidth
;
1158 UINT StartVertexOffsetHeight
;
1164 } D3DRECTPATCH_INFO
;
1166 typedef struct _D3DSURFACE_DESC
{
1168 D3DRESOURCETYPE Type
;
1172 D3DMULTISAMPLE_TYPE MultiSampleType
;
1177 typedef struct _D3DTRIPATCH_INFO
{
1178 UINT StartVertexOffset
;
1184 typedef struct _D3DVERTEXBUFFER_DESC
{
1186 D3DRESOURCETYPE Type
;
1191 } D3DVERTEXBUFFER_DESC
;
1193 typedef struct _D3DVIEWPORT8
{
1202 typedef struct _D3DVOLUME_DESC
{
1204 D3DRESOURCETYPE Type
;
1213 #endif /* __WINE_D3D8TYPES_H */