2 * Direct3D driver interface
5 * Copyright (C) 2001 Ove Kaaven
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_D3DHAL_H
23 #define __WINE_D3DHAL_H
31 /*****************************************************************************
32 * device info structures
34 typedef struct _D3DDeviceDesc_V1
{
37 D3DCOLORMODEL dcmColorModel
;
39 D3DTRANSFORMCAPS dtcTransformCaps
;
41 D3DLIGHTINGCAPS dlcLightingCaps
;
42 D3DPRIMCAPS dpcLineCaps
;
43 D3DPRIMCAPS dpcTriCaps
;
44 DWORD dwDeviceRenderBitDepth
;
45 DWORD dwDeviceZBufferBitDepth
;
46 DWORD dwMaxBufferSize
;
47 DWORD dwMaxVertexCount
;
48 } D3DDEVICEDESC_V1
,*LPD3DDEVICEDESC_V1
;
50 typedef struct _D3DHAL_GLOBALDRIVERDATA
{
52 D3DDEVICEDESC_V1 hwCaps
;
54 DWORD dwNumClipVertices
;
55 DWORD dwNumTextureFormats
;
56 LPDDSURFACEDESC lpTextureFormats
;
57 } D3DHAL_GLOBALDRIVERDATA
,*LPD3DHAL_GLOBALDRIVERDATA
;
59 typedef struct _D3DHAL_D3DEXTENDEDCAPS
{
62 DWORD dwMinTextureWidth
, dwMaxTextureWidth
;
63 DWORD dwMinTextureHeight
, dwMaxTextureHeight
;
64 DWORD dwMinStippleWidth
, dwMaxStippleWidth
;
65 DWORD dwMinStippleHeight
, dwMaxStippleHeight
;
67 DWORD dwMaxTextureRepeat
;
68 DWORD dwMaxTextureAspectRatio
;
69 DWORD dwMaxAnisotropy
;
70 D3DVALUE dvGuardBandLeft
;
71 D3DVALUE dvGuardBandTop
;
72 D3DVALUE dvGuardBandRight
;
73 D3DVALUE dvGuardBandBottom
;
74 D3DVALUE dvExtentsAdjust
;
77 DWORD dwTextureOpCaps
;
78 WORD wMaxTextureBlendStages
;
79 WORD wMaxSimultaneousTextures
;
81 DWORD dwMaxActiveLights
;
82 D3DVALUE dvMaxVertexW
;
83 WORD wMaxUserClipPlanes
;
84 WORD wMaxVertexBlendMatrices
;
85 DWORD dwVertexProcessingCaps
;
90 } D3DHAL_D3DEXTENDEDCAPS
,*LPD3DHAL_D3DEXTENDEDCAPS
;
92 /*****************************************************************************
93 * d3d->driver callbacks
95 typedef struct _D3DHAL_CONTEXTCREATEDATA
*LPD3DHAL_CONTEXTCREATEDATA
;
96 typedef struct _D3DHAL_CONTEXTDESTROYDATA
*LPD3DHAL_CONTEXTDESTROYDATA
;
97 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA
*LPD3DHAL_CONTEXTDESTROYALLDATA
;
98 typedef struct _D3DHAL_SCENECAPTUREDATA
*LPD3DHAL_SCENECAPTUREDATA
;
99 typedef struct _D3DHAL_RENDERSTATEDATA
*LPD3DHAL_RENDERSTATEDATA
;
100 typedef struct _D3DHAL_RENDERPRIMITIVEDATA
*LPD3DHAL_RENDERPRIMITIVEDATA
;
101 typedef struct _D3DHAL_TEXTURECREATEDATA
*LPD3DHAL_TEXTURECREATEDATA
;
102 typedef struct _D3DHAL_TEXTUREDESTROYDATA
*LPD3DHAL_TEXTUREDESTROYDATA
;
103 typedef struct _D3DHAL_TEXTURESWAPDATA
*LPD3DHAL_TEXTURESWAPDATA
;
104 typedef struct _D3DHAL_TEXTUREGETSURFDATA
*LPD3DHAL_TEXTUREGETSURFDATA
;
105 typedef struct _D3DHAL_GETSTATEDATA
*LPD3DHAL_GETSTATEDATA
;
107 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTCREATECB
) (LPD3DHAL_CONTEXTCREATEDATA
);
108 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTDESTROYCB
) (LPD3DHAL_CONTEXTDESTROYDATA
);
109 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTDESTROYALLCB
)(LPD3DHAL_CONTEXTDESTROYALLDATA
);
110 typedef DWORD (PASCAL
*LPD3DHAL_SCENECAPTURECB
) (LPD3DHAL_SCENECAPTUREDATA
);
111 typedef DWORD (PASCAL
*LPD3DHAL_RENDERSTATECB
) (LPD3DHAL_RENDERSTATEDATA
);
112 typedef DWORD (PASCAL
*LPD3DHAL_RENDERPRIMITIVECB
) (LPD3DHAL_RENDERPRIMITIVEDATA
);
113 typedef DWORD (PASCAL
*LPD3DHAL_TEXTURECREATECB
) (LPD3DHAL_TEXTURECREATEDATA
);
114 typedef DWORD (PASCAL
*LPD3DHAL_TEXTUREDESTROYCB
) (LPD3DHAL_TEXTUREDESTROYDATA
);
115 typedef DWORD (PASCAL
*LPD3DHAL_TEXTURESWAPCB
) (LPD3DHAL_TEXTURESWAPDATA
);
116 typedef DWORD (PASCAL
*LPD3DHAL_TEXTUREGETSURFCB
) (LPD3DHAL_TEXTUREGETSURFDATA
);
117 typedef DWORD (PASCAL
*LPD3DHAL_GETSTATECB
) (LPD3DHAL_GETSTATEDATA
);
119 typedef struct _D3DHAL_CALLBACKS
{
121 LPD3DHAL_CONTEXTCREATECB ContextCreate
;
122 LPD3DHAL_CONTEXTDESTROYCB ContextDestroy
;
123 LPD3DHAL_CONTEXTDESTROYALLCB ContextDestroyAll
;
124 LPD3DHAL_SCENECAPTURECB SceneCapture
;
127 LPD3DHAL_RENDERSTATECB RenderState
;
128 LPD3DHAL_RENDERPRIMITIVECB RenderPrimitive
;
130 LPD3DHAL_TEXTURECREATECB TextureCreate
;
131 LPD3DHAL_TEXTUREDESTROYCB TextureDestroy
;
132 LPD3DHAL_TEXTURESWAPCB TextureSwap
;
133 LPD3DHAL_TEXTUREGETSURFCB TextureGetSurf
;
134 /* now why did MS create CALLBACKS2 and CALLBACKS3 structures if
135 * all these reserved fields were available? we may never know */
146 LPD3DHAL_GETSTATECB GetState
;
157 } D3DHAL_CALLBACKS
,*LPD3DHAL_CALLBACKS
;
159 typedef struct _D3DHAL_SETRENDERTARGETDATA
*LPD3DHAL_SETRENDERTARGETDATA
;
160 typedef struct _D3DHAL_CLEARDATA
*LPD3DHAL_CLEARDATA
;
161 typedef struct _D3DHAL_DRAWONEPRIMITIVEDATA
*LPD3DHAL_DRAWONEPRIMITIVEDATA
;
162 typedef struct _D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
*LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
;
163 typedef struct _D3DHAL_DRAWPRIMITIVESDATA
*LPD3DHAL_DRAWPRIMITIVESDATA
;
165 typedef DWORD (PASCAL
*LPD3DHAL_SETRENDERTARGETCB
) (LPD3DHAL_SETRENDERTARGETDATA
);
166 typedef DWORD (PASCAL
*LPD3DHAL_CLEARCB
) (LPD3DHAL_CLEARDATA
);
167 typedef DWORD (PASCAL
*LPD3DHAL_DRAWONEPRIMITIVECB
) (LPD3DHAL_DRAWONEPRIMITIVEDATA
);
168 typedef DWORD (PASCAL
*LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB
)(LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
);
169 typedef DWORD (PASCAL
*LPD3DHAL_DRAWPRIMITIVESCB
) (LPD3DHAL_DRAWPRIMITIVESDATA
);
171 typedef struct _D3DHAL_CALLBACKS2
{
174 LPD3DHAL_SETRENDERTARGETCB SetRenderTarget
;
175 LPD3DHAL_CLEARCB Clear
;
176 LPD3DHAL_DRAWONEPRIMITIVECB DrawOnePrimitive
;
177 LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB DrawOneIndexedPrimitive
;
178 LPD3DHAL_DRAWPRIMITIVESCB DrawPrimitives
;
179 } D3DHAL_CALLBACKS2
,*LPD3DHAL_CALLBACKS2
;
181 typedef struct _D3DHAL_CLEAR2DATA
*LPD3DHAL_CLEAR2DATA
;
182 typedef struct _D3DHAL_VALIDATETEXTURESTAGESTATEDATA
*LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA
;
183 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA
*LPD3DHAL_DRAWPRIMITIVES2DATA
;
185 typedef DWORD (PASCAL
*LPD3DHAL_CLEAR2CB
) (LPD3DHAL_CLEAR2DATA
);
186 typedef DWORD (PASCAL
*LPD3DHAL_VALIDATETEXTURESTAGESTATECB
)(LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA
);
187 typedef DWORD (PASCAL
*LPD3DHAL_DRAWPRIMITIVES2CB
) (LPD3DHAL_DRAWPRIMITIVES2DATA
);
189 typedef struct _D3DHAL_CALLBACKS3
{
192 LPD3DHAL_CLEAR2CB Clear2
;
194 LPD3DHAL_VALIDATETEXTURESTAGESTATECB ValidateTextureStageState
;
195 LPD3DHAL_DRAWPRIMITIVES2CB DrawPrimitives2
;
196 } D3DHAL_CALLBACKS3
,*LPD3DHAL_CALLBACKS3
;
198 /*****************************************************************************
199 * parameter structures
201 typedef struct _D3DHAL_CONTEXTCREATEDATA
{
203 LPDDRAWI_DIRECTDRAW_GBL lpDDGbl
; /* pre-DirectX 7 */
204 LPDDRAWI_DIRECTDRAW_LCL lpDDLcl
; /* DirectX 7 */
207 LPDIRECTDRAWSURFACE lpDDS
;
208 LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl
; /* DirectX 7 */
211 LPDIRECTDRAWSURFACE lpDDSZ
;
212 LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl
; /* DirectX 7 */
218 ULONG_PTR dwhContext
;
220 } D3DHAL_CONTEXTCREATEDATA
;
222 typedef struct _D3DHAL_CONTEXTDESTROYDATA
{
223 ULONG_PTR dwhContext
;
225 } D3DHAL_CONTEXTDESTROYDATA
;
227 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA
{
230 } D3DHAL_CONTEXTDESTROYALLDATA
;
232 typedef struct _D3DHAL_SCENECAPTUREDATA
{
233 ULONG_PTR dwhContext
;
236 } D3DHAL_SCENECAPTUREDATA
;
238 #define D3DHAL_SCENE_CAPTURE_START 0x00000000
239 #define D3DHAL_SCENE_CAPTURE_END 0x00000001
241 typedef struct _D3DHAL_SETRENDERTARGETDATA
{
242 ULONG_PTR dwhContext
;
244 LPDIRECTDRAWSURFACE lpDDS
;
245 LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl
;
248 LPDIRECTDRAWSURFACE lpDDSZ
;
249 LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl
;
252 } D3DHAL_SETRENDERTARGETDATA
;
254 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA
{
255 ULONG_PTR dwhContext
;
258 LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands
;
259 DWORD dwCommandOffset
;
260 DWORD dwCommandLength
;
262 LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex
;
265 DWORD dwVertexOffset
;
266 DWORD dwVertexLength
;
267 DWORD dwReqVertexBufSize
;
268 DWORD dwReqCommandBufSize
;
275 } D3DHAL_DRAWPRIMITIVES2DATA
;
277 #define D3DHALDP2_USERMEMVERTICES 0x00000001
278 #define D3DHALDP2_EXECUTEBUFFER 0x00000002
279 #define D3DHALDP2_SWAPVERTEXBUFFER 0x00000004
280 #define D3DHALDP2_SWAPCOMMANDBUFFER 0x00000008
281 #define D3DHALDP2_REQVERTEXBUFSIZE 0x00000010
282 #define D3DHALDP2_REQCOMMANDBUFSIZE 0x00000020
283 #define D3DHALDP2_VIDMEMVERTEXBUF 0x00000040
284 #define D3DHALDP2_VIDMEMCOMMANDBUF 0x00000080
286 /*****************************************************************************
287 * DrawPrimitives2 command structures
289 typedef struct _D3DHAL_DP2COMMAND
{
293 WORD wPrimitiveCount
;
296 } D3DHAL_DP2COMMAND
,*LPD3DHAL_DP2COMMAND
;
298 typedef enum _D3DHAL_DP2OPERATION
{
300 D3DDP2OP_INDEXEDLINELIST
= 2,
301 D3DDP2OP_INDEXEDTRIANGLELIST
= 3,
302 D3DDP2OP_RENDERSTATE
= 8,
303 D3DDP2OP_LINELIST
= 15,
304 D3DDP2OP_LINESTRIP
= 16,
305 D3DDP2OP_INDEXEDLINESTRIP
= 17,
306 D3DDP2OP_TRIANGLELIST
= 18,
307 D3DDP2OP_TRIANGLESTRIP
= 19,
308 D3DDP2OP_INDEXEDTRIANGLESTRIP
= 20,
309 D3DDP2OP_TRIANGLEFAN
= 21,
310 D3DDP2OP_INDEXEDTRIANGLEFAN
= 22,
311 D3DDP2OP_TRIANGLEFAN_IMM
= 23,
312 D3DDP2OP_LINELIST_IMM
= 24,
313 D3DDP2OP_TEXTURESTAGESTATE
= 25,
314 D3DDP2OP_INDEXEDTRIANGLELIST2
= 26,
315 D3DDP2OP_INDEXEDLINELIST2
= 27,
316 D3DDP2OP_VIEWPORTINFO
= 28,
318 /* pre-DirectX 7 interfaces */
319 D3DDP2OP_SETPALETTE
= 30,
320 D3DDP2OP_UPDATEPALETTE
= 31,
321 /* DirectX 7 interfaces */
322 D3DDP2OP_ZRANGE
= 32,
323 D3DDP2OP_SETMATERIAL
= 33,
324 D3DDP2OP_SETLIGHT
= 34,
325 D3DDP2OP_CREATELIGHT
= 35,
326 D3DDP2OP_SETTRANSFORM
= 36,
327 D3DDP2OP_TEXBLT
= 38,
328 D3DDP2OP_STATESET
= 39,
329 D3DDP2OP_SETPRIORITY
= 40,
331 D3DDP2OP_SETRENDERTARGET
= 41,
333 /* DirectX 7 interfaces */
334 D3DDP2OP_SETTEXLOD
= 43,
335 D3DPP2OP_SETCLIPPLANE
= 44
336 } D3DHAL_DP2OPERATION
;
338 /* point primitives */
340 typedef struct _D3DHAL_POINTS
{
343 } D3DHAL_DP2POINTS
,*LPD3DHAL_DP2POINTS
;
345 /* line primitives */
347 typedef struct _D3DHAL_DP2STARTVERTEX
{
349 } D3DHAL_DP2STARTVERTEX
,*LPD3DHAL_DP2STARTVERTEX
;
351 typedef struct _D3DHAL_DP2LINELIST
{
353 } D3DHAL_DP2LINELIST
,*LPD3DHAL_DP2LINELIST
;
355 typedef struct _D3DHAL_DP2INDEXEDLINELIST
{
358 } D3DHAL_DP2INDEXEDLINELIST
,*LPD3DHAL_DP2INDEXEDLINELIST
;
360 typedef struct _D3DHAL_DP2LINESTRIP
{
362 } D3DHAL_DP2LINESTRIP
,*LPD3DHAL_DP2LINESTRIP
;
364 typedef struct _D3DHAL_DP2INDEXEDLINESTRIP
{
366 } D3DHAL_DP2INDEXEDLINESTRIP
,*LPD3DHAL_DP2INDEXEDLINESTRIP
;
368 /* triangle primitives */
370 typedef struct _D3DHAL_DP2TRIANGLELIST
{
372 } D3DHAL_DP2TRIANGLELIST
,*LPD3DHAL_DP2TRIANGLELIST
;
374 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST
{
379 } D3DHAL_DP2INDEXEDTRIANGLELIST
,*LPD3DHAL_DP2INDEXEDTRIANGLELIST
;
381 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2
{
385 } D3DHAL_DP2INDEXEDTRIANGLELIST2
,*LPD3DHAL_DP2INDEXEDTRIANGLELIST2
;
387 typedef struct _D3DHAL_DP2TRIANGLESTRIP
{
389 } D3DHAL_DP2TRIANGLESTRIP
,*LPD3DHAL_DP2TRIANGLESTRIP
;
391 typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP
{
393 } D3DHAL_DP2INDEXEDTRIANGLESTRIP
,*LPD3DHAL_DP2INDEXEDTRIANGLESTRIP
;
395 typedef struct _D3DHAL_DP2TRIANGLEFAN
{
397 } D3DHAL_DP2TRIANGLEFAN
,*LPD3DHAL_DP2TRIANGLEFAN
;
399 typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN
{
401 } D3DHAL_DP2INDEXEDTRIANGLEFAN
,*LPD3DHAL_DP2INDEXEDTRIANGLEFAN
;
403 typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM
{
405 } D3DHAL_DP2TRIANGLEFAN_IMM
,*LPD3DHAL_DP2TRIANGLEFAN_IMM
;
408 typedef struct _D3DHAL_DP2RENDERSTATE
{
409 D3DRENDERSTATETYPE RenderState
;
414 } D3DHAL_DP2RENDERSTATE
,*LPD3DHAL_DP2RENDERSTATE
;
416 typedef struct _D3DHAL_DP2TEXTURESTAGESTATE
{
420 } D3DHAL_DP2TEXTURESTAGESTATE
,*LPD3DHAL_DP2TEXTURESTAGESTATE
;
422 #define D3DTSS_TEXTUREMAP 0
424 typedef struct _D3DHAL_DP2VIEWPORTINFO
{
429 } D3DHAL_DP2VIEWPORTINFO
,*LPD3DHAL_DP2VIEWPORTINFO
;
431 typedef struct _D3DHAL_DP2WINFO
{
434 } D3DHAL_DP2WINFO
,*LPD3DHAL_DP2WINFO
;
436 typedef struct _D3DHAL_DP2SETPALETTE
{
437 DWORD dwPaletteHandle
;
438 DWORD dwPaletteFlags
;
439 DWORD dwSurfaceHandle
;
440 } D3DHAL_DP2SETPALETTE
,*LPD3DHAL_DP2SETPALETTE
;
442 typedef struct _D3DHAL_DP2UPDATEPALETTE
{
443 DWORD dwPaletteHandle
;
446 } D3DHAL_DP2UPDATEPALETTE
,*LPD3DHAL_DP2UPDATEPALETTE
;
448 typedef struct _D3DHAL_DP2ZRANGE
{
451 } D3DHAL_DP2ZRANGE
,*LPD3DHAL_DP2ZRANGE
;
453 typedef D3DMATERIAL7 D3DHAL_DP2SETMATERIAL
,*LPD3DHAL_DP2SETMATERIAL
;
455 typedef struct _D3DHAL_DP2SETLIGHT
{
458 } D3DHAL_DP2SETLIGHT
,*LPD3DHAL_DP2SETLIGHT
;
460 #define D3DHAL_SETLIGHT_ENABLE 0
461 #define D3DHAL_SETLIGHT_DISABLE 1
462 #define D3DHAL_SETLIGHT_DATA 2
464 typedef struct _D3DHAL_DP2CREATELIGHT
{
466 } D3DHAL_DP2CREATELIGHT
,*LPD3DHAL_DP2CREATELIGHT
;
468 typedef struct _D3DHAL_DP2SETTRANSFORM
{
469 D3DTRANSFORMSTATETYPE xfrmType
;
471 } D3DHAL_DP2SETTRANSFORM
,*LPD3DHAL_DP2SETTRANSFORM
;
473 typedef struct _D3DHAL_DP2TEXBLT
{
474 DWORD dwDDDestSurface
;
475 DWORD dwDDSrcSurface
;
479 } D3DHAL_DP2TEXBLT
,*LPD3DHAL_DP2TEXBLT
;
481 typedef struct _D3DHAL_DP2STATESET
{
484 D3DSTATEBLOCKTYPE sbType
;
485 } D3DHAL_DP2STATESET
,*LPD3DHAL_DP2STATESET
;
487 #define D3DHAL_STATESETBEGIN 0
488 #define D3DHAL_STATESETEND 1
489 #define D3DHAL_STATESETDELETE 2
490 #define D3DHAL_STATESETEXECUTE 3
491 #define D3DHAL_STATESETCAPTURE 4
493 typedef struct _D3DHAL_DP2SETPRIORITY
{
496 } D3DHAL_DP2SETPRIORITY
,*LPD3DHAL_DP2SETPRIORITY
;
498 typedef struct _D3DHAL_DP2SETRENDERTARGET
{
501 } D3DHAL_DP2SETRENDERTARGET
,*LPD3DHAL_DP2SETRENDERTARGET
;
503 typedef struct _D3DHAL_DP2CLEAR
{
506 D3DVALUE dvFillDepth
;
509 } D3DHAL_DP2CLEAR
,*LPD3DHAL_DP2CLEAR
;
511 typedef struct _D3DHAL_DP2SETTEXLOD
{
514 } D3DHAL_DP2SETTEXLOD
,*LPD3DHAL_DP2SETTEXLOD
;
520 #endif /* __WINE_D3DHAL_H */