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 /* this is to allow keeping the bulk of our OpenGL code out of x11drv */
51 #define D3DDD_WINE_OPENGL_DEVICE 0x00008000
53 typedef struct _D3DHAL_GLOBALDRIVERDATA
{
55 D3DDEVICEDESC_V1 hwCaps
;
57 DWORD dwNumClipVertices
;
58 DWORD dwNumTextureFormats
;
59 LPDDSURFACEDESC lpTextureFormats
;
60 } D3DHAL_GLOBALDRIVERDATA
,*LPD3DHAL_GLOBALDRIVERDATA
;
62 typedef struct _D3DHAL_D3DEXTENDEDCAPS
{
65 DWORD dwMinTextureWidth
, dwMaxTextureWidth
;
66 DWORD dwMinTextureHeight
, dwMaxTextureHeight
;
67 DWORD dwMinStippleWidth
, dwMaxStippleWidth
;
68 DWORD dwMinStippleHeight
, dwMaxStippleHeight
;
70 DWORD dwMaxTextureRepeat
;
71 DWORD dwMaxTextureAspectRatio
;
72 DWORD dwMaxAnisotropy
;
73 D3DVALUE dvGuardBandLeft
;
74 D3DVALUE dvGuardBandTop
;
75 D3DVALUE dvGuardBandRight
;
76 D3DVALUE dvGuardBandBottom
;
77 D3DVALUE dvExtentsAdjust
;
80 DWORD dwTextureOpCaps
;
81 WORD wMaxTextureBlendStages
;
82 WORD wMaxSimultaneousTextures
;
84 DWORD dwMaxActiveLights
;
85 D3DVALUE dvMaxVertexW
;
86 WORD wMaxUserClipPlanes
;
87 WORD wMaxVertexBlendMatrices
;
88 DWORD dwVertexProcessingCaps
;
93 } D3DHAL_D3DEXTENDEDCAPS
,*LPD3DHAL_D3DEXTENDEDCAPS
;
95 /*****************************************************************************
96 * d3d->driver callbacks
98 typedef struct _D3DHAL_CONTEXTCREATEDATA
*LPD3DHAL_CONTEXTCREATEDATA
;
99 typedef struct _D3DHAL_CONTEXTDESTROYDATA
*LPD3DHAL_CONTEXTDESTROYDATA
;
100 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA
*LPD3DHAL_CONTEXTDESTROYALLDATA
;
101 typedef struct _D3DHAL_SCENECAPTUREDATA
*LPD3DHAL_SCENECAPTUREDATA
;
102 typedef struct _D3DHAL_RENDERSTATEDATA
*LPD3DHAL_RENDERSTATEDATA
;
103 typedef struct _D3DHAL_RENDERPRIMITIVEDATA
*LPD3DHAL_RENDERPRIMITIVEDATA
;
104 typedef struct _D3DHAL_TEXTURECREATEDATA
*LPD3DHAL_TEXTURECREATEDATA
;
105 typedef struct _D3DHAL_TEXTUREDESTROYDATA
*LPD3DHAL_TEXTUREDESTROYDATA
;
106 typedef struct _D3DHAL_TEXTURESWAPDATA
*LPD3DHAL_TEXTURESWAPDATA
;
107 typedef struct _D3DHAL_TEXTUREGETSURFDATA
*LPD3DHAL_TEXTUREGETSURFDATA
;
108 typedef struct _D3DHAL_GETSTATEDATA
*LPD3DHAL_GETSTATEDATA
;
110 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTCREATECB
) (LPD3DHAL_CONTEXTCREATEDATA
);
111 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTDESTROYCB
) (LPD3DHAL_CONTEXTDESTROYDATA
);
112 typedef DWORD (PASCAL
*LPD3DHAL_CONTEXTDESTROYALLCB
)(LPD3DHAL_CONTEXTDESTROYALLDATA
);
113 typedef DWORD (PASCAL
*LPD3DHAL_SCENECAPTURECB
) (LPD3DHAL_SCENECAPTUREDATA
);
114 typedef DWORD (PASCAL
*LPD3DHAL_RENDERSTATECB
) (LPD3DHAL_RENDERSTATEDATA
);
115 typedef DWORD (PASCAL
*LPD3DHAL_RENDERPRIMITIVECB
) (LPD3DHAL_RENDERPRIMITIVEDATA
);
116 typedef DWORD (PASCAL
*LPD3DHAL_TEXTURECREATECB
) (LPD3DHAL_TEXTURECREATEDATA
);
117 typedef DWORD (PASCAL
*LPD3DHAL_TEXTUREDESTROYCB
) (LPD3DHAL_TEXTUREDESTROYDATA
);
118 typedef DWORD (PASCAL
*LPD3DHAL_TEXTURESWAPCB
) (LPD3DHAL_TEXTURESWAPDATA
);
119 typedef DWORD (PASCAL
*LPD3DHAL_TEXTUREGETSURFCB
) (LPD3DHAL_TEXTUREGETSURFDATA
);
120 typedef DWORD (PASCAL
*LPD3DHAL_GETSTATECB
) (LPD3DHAL_GETSTATEDATA
);
122 typedef struct _D3DHAL_CALLBACKS
{
124 LPD3DHAL_CONTEXTCREATECB ContextCreate
;
125 LPD3DHAL_CONTEXTDESTROYCB ContextDestroy
;
126 LPD3DHAL_CONTEXTDESTROYALLCB ContextDestroyAll
;
127 LPD3DHAL_SCENECAPTURECB SceneCapture
;
130 LPD3DHAL_RENDERSTATECB RenderState
;
131 LPD3DHAL_RENDERPRIMITIVECB RenderPrimitive
;
133 LPD3DHAL_TEXTURECREATECB TextureCreate
;
134 LPD3DHAL_TEXTUREDESTROYCB TextureDestroy
;
135 LPD3DHAL_TEXTURESWAPCB TextureSwap
;
136 LPD3DHAL_TEXTUREGETSURFCB TextureGetSurf
;
137 /* now why did MS create CALLBACKS2 and CALLBACKS3 structures if
138 * all these reserved fields were available? we may never know */
149 LPD3DHAL_GETSTATECB GetState
;
160 } D3DHAL_CALLBACKS
,*LPD3DHAL_CALLBACKS
;
162 typedef struct _D3DHAL_SETRENDERTARGETDATA
*LPD3DHAL_SETRENDERTARGETDATA
;
163 typedef struct _D3DHAL_CLEARDATA
*LPD3DHAL_CLEARDATA
;
164 typedef struct _D3DHAL_DRAWONEPRIMITIVEDATA
*LPD3DHAL_DRAWONEPRIMITIVEDATA
;
165 typedef struct _D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
*LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
;
166 typedef struct _D3DHAL_DRAWPRIMITIVESDATA
*LPD3DHAL_DRAWPRIMITIVESDATA
;
168 typedef DWORD (PASCAL
*LPD3DHAL_SETRENDERTARGETCB
) (LPD3DHAL_SETRENDERTARGETDATA
);
169 typedef DWORD (PASCAL
*LPD3DHAL_CLEARCB
) (LPD3DHAL_CLEARDATA
);
170 typedef DWORD (PASCAL
*LPD3DHAL_DRAWONEPRIMITIVECB
) (LPD3DHAL_DRAWONEPRIMITIVEDATA
);
171 typedef DWORD (PASCAL
*LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB
)(LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
);
172 typedef DWORD (PASCAL
*LPD3DHAL_DRAWPRIMITIVESCB
) (LPD3DHAL_DRAWPRIMITIVESDATA
);
174 typedef struct _D3DHAL_CALLBACKS2
{
177 LPD3DHAL_SETRENDERTARGETCB SetRenderTarget
;
178 LPD3DHAL_CLEARCB Clear
;
179 LPD3DHAL_DRAWONEPRIMITIVECB DrawOnePrimitive
;
180 LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB DrawOneIndexedPrimitive
;
181 LPD3DHAL_DRAWPRIMITIVESCB DrawPrimitives
;
182 } D3DHAL_CALLBACKS2
,*LPD3DHAL_CALLBACKS2
;
184 typedef struct _D3DHAL_CLEAR2DATA
*LPD3DHAL_CLEAR2DATA
;
185 typedef struct _D3DHAL_VALIDATETEXTURESTAGESTATEDATA
*LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA
;
186 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA
*LPD3DHAL_DRAWPRIMITIVES2DATA
;
188 typedef DWORD (PASCAL
*LPD3DHAL_CLEAR2CB
) (LPD3DHAL_CLEAR2DATA
);
189 typedef DWORD (PASCAL
*LPD3DHAL_VALIDATETEXTURESTAGESTATECB
)(LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA
);
190 typedef DWORD (PASCAL
*LPD3DHAL_DRAWPRIMITIVES2CB
) (LPD3DHAL_DRAWPRIMITIVES2DATA
);
192 typedef struct _D3DHAL_CALLBACKS3
{
195 LPD3DHAL_CLEAR2CB Clear2
;
197 LPD3DHAL_VALIDATETEXTURESTAGESTATECB ValidateTextureStageState
;
198 LPD3DHAL_DRAWPRIMITIVES2CB DrawPrimitives2
;
199 } D3DHAL_CALLBACKS3
,*LPD3DHAL_CALLBACKS3
;
201 /*****************************************************************************
202 * parameter structures
204 typedef struct _D3DHAL_CONTEXTCREATEDATA
{
206 LPDDRAWI_DIRECTDRAW_GBL lpDDGbl
; /* pre-DirectX 7 */
207 LPDDRAWI_DIRECTDRAW_LCL lpDDLcl
; /* DirectX 7 */
210 LPDIRECTDRAWSURFACE lpDDS
;
211 LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl
; /* DirectX 7 */
214 LPDIRECTDRAWSURFACE lpDDSZ
;
215 LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl
; /* DirectX 7 */
221 ULONG_PTR dwhContext
;
223 } D3DHAL_CONTEXTCREATEDATA
;
225 typedef struct _D3DHAL_CONTEXTDESTROYDATA
{
226 ULONG_PTR dwhContext
;
228 } D3DHAL_CONTEXTDESTROYDATA
;
230 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA
{
233 } D3DHAL_CONTEXTDESTROYALLDATA
;
235 typedef struct _D3DHAL_SCENECAPTUREDATA
{
236 ULONG_PTR dwhContext
;
239 } D3DHAL_SCENECAPTUREDATA
;
241 #define D3DHAL_SCENE_CAPTURE_START 0x00000000
242 #define D3DHAL_SCENE_CAPTURE_END 0x00000001
244 typedef struct _D3DHAL_SETRENDERTARGETDATA
{
245 ULONG_PTR dwhContext
;
247 LPDIRECTDRAWSURFACE lpDDS
;
248 LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl
;
251 LPDIRECTDRAWSURFACE lpDDSZ
;
252 LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl
;
255 } D3DHAL_SETRENDERTARGETDATA
;
257 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA
{
258 ULONG_PTR dwhContext
;
261 LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands
;
262 DWORD dwCommandOffset
;
263 DWORD dwCommandLength
;
265 LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex
;
268 DWORD dwVertexOffset
;
269 DWORD dwVertexLength
;
270 DWORD dwReqVertexBufSize
;
271 DWORD dwReqCommandBufSize
;
278 } D3DHAL_DRAWPRIMITIVES2DATA
;
280 #define D3DHALDP2_USERMEMVERTICES 0x00000001
281 #define D3DHALDP2_EXECUTEBUFFER 0x00000002
282 #define D3DHALDP2_SWAPVERTEXBUFFER 0x00000004
283 #define D3DHALDP2_SWAPCOMMANDBUFFER 0x00000008
284 #define D3DHALDP2_REQVERTEXBUFSIZE 0x00000010
285 #define D3DHALDP2_REQCOMMANDBUFSIZE 0x00000020
286 #define D3DHALDP2_VIDMEMVERTEXBUF 0x00000040
287 #define D3DHALDP2_VIDMEMCOMMANDBUF 0x00000080
289 /*****************************************************************************
290 * DrawPrimitives2 command structures
292 typedef struct _D3DHAL_DP2COMMAND
{
296 WORD wPrimitiveCount
;
299 } D3DHAL_DP2COMMAND
,*LPD3DHAL_DP2COMMAND
;
301 typedef enum _D3DHAL_DP2OPERATION
{
303 D3DDP2OP_INDEXEDLINELIST
= 2,
304 D3DDP2OP_INDEXEDTRIANGLELIST
= 3,
305 D3DDP2OP_RENDERSTATE
= 8,
306 D3DDP2OP_LINELIST
= 15,
307 D3DDP2OP_LINESTRIP
= 16,
308 D3DDP2OP_INDEXEDLINESTRIP
= 17,
309 D3DDP2OP_TRIANGLELIST
= 18,
310 D3DDP2OP_TRIANGLESTRIP
= 19,
311 D3DDP2OP_INDEXEDTRIANGLESTRIP
= 20,
312 D3DDP2OP_TRIANGLEFAN
= 21,
313 D3DDP2OP_INDEXEDTRIANGLEFAN
= 22,
314 D3DDP2OP_TRIANGLEFAN_IMM
= 23,
315 D3DDP2OP_LINELIST_IMM
= 24,
316 D3DDP2OP_TEXTURESTAGESTATE
= 25,
317 D3DDP2OP_INDEXEDTRIANGLELIST2
= 26,
318 D3DDP2OP_INDEXEDLINELIST2
= 27,
319 D3DDP2OP_VIEWPORTINFO
= 28,
321 /* pre-DirectX 7 interfaces */
322 D3DDP2OP_SETPALETTE
= 30,
323 D3DDP2OP_UPDATEPALETTE
= 31,
324 /* DirectX 7 interfaces */
325 D3DDP2OP_ZRANGE
= 32,
326 D3DDP2OP_SETMATERIAL
= 33,
327 D3DDP2OP_SETLIGHT
= 34,
328 D3DDP2OP_CREATELIGHT
= 35,
329 D3DDP2OP_SETTRANSFORM
= 36,
330 D3DDP2OP_TEXBLT
= 38,
331 D3DDP2OP_STATESET
= 39,
332 D3DDP2OP_SETPRIORITY
= 40,
334 D3DDP2OP_SETRENDERTARGET
= 41,
336 /* DirectX 7 interfaces */
337 D3DDP2OP_SETTEXLOD
= 43,
338 D3DPP2OP_SETCLIPPLANE
= 44
339 } D3DHAL_DP2OPERATION
;
341 /* point primitives */
343 typedef struct _D3DHAL_POINTS
{
346 } D3DHAL_DP2POINTS
,*LPD3DHAL_DP2POINTS
;
348 /* line primitives */
350 typedef struct _D3DHAL_DP2STARTVERTEX
{
352 } D3DHAL_DP2STARTVERTEX
,*LPD3DHAL_DP2STARTVERTEX
;
354 typedef struct _D3DHAL_DP2LINELIST
{
356 } D3DHAL_DP2LINELIST
,*LPD3DHAL_DP2LINELIST
;
358 typedef struct _D3DHAL_DP2INDEXEDLINELIST
{
361 } D3DHAL_DP2INDEXEDLINELIST
,*LPD3DHAL_DP2INDEXEDLINELIST
;
363 typedef struct _D3DHAL_DP2LINESTRIP
{
365 } D3DHAL_DP2LINESTRIP
,*LPD3DHAL_DP2LINESTRIP
;
367 typedef struct _D3DHAL_DP2INDEXEDLINESTRIP
{
369 } D3DHAL_DP2INDEXEDLINESTRIP
,*LPD3DHAL_DP2INDEXEDLINESTRIP
;
371 /* triangle primitives */
373 typedef struct _D3DHAL_DP2TRIANGLELIST
{
375 } D3DHAL_DP2TRIANGLELIST
,*LPD3DHAL_DP2TRIANGLELIST
;
377 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST
{
382 } D3DHAL_DP2INDEXEDTRIANGLELIST
,*LPD3DHAL_DP2INDEXEDTRIANGLELIST
;
384 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2
{
388 } D3DHAL_DP2INDEXEDTRIANGLELIST2
,*LPD3DHAL_DP2INDEXEDTRIANGLELIST2
;
390 typedef struct _D3DHAL_DP2TRIANGLESTRIP
{
392 } D3DHAL_DP2TRIANGLESTRIP
,*LPD3DHAL_DP2TRIANGLESTRIP
;
394 typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP
{
396 } D3DHAL_DP2INDEXEDTRIANGLESTRIP
,*LPD3DHAL_DP2INDEXEDTRIANGLESTRIP
;
398 typedef struct _D3DHAL_DP2TRIANGLEFAN
{
400 } D3DHAL_DP2TRIANGLEFAN
,*LPD3DHAL_DP2TRIANGLEFAN
;
402 typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN
{
404 } D3DHAL_DP2INDEXEDTRIANGLEFAN
,*LPD3DHAL_DP2INDEXEDTRIANGLEFAN
;
406 typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM
{
408 } D3DHAL_DP2TRIANGLEFAN_IMM
,*LPD3DHAL_DP2TRIANGLEFAN_IMM
;
411 typedef struct _D3DHAL_DP2RENDERSTATE
{
412 D3DRENDERSTATETYPE RenderState
;
417 } D3DHAL_DP2RENDERSTATE
,*LPD3DHAL_DP2RENDERSTATE
;
419 typedef struct _D3DHAL_DP2TEXTURESTAGESTATE
{
423 } D3DHAL_DP2TEXTURESTAGESTATE
,*LPD3DHAL_DP2TEXTURESTAGESTATE
;
425 #define D3DTSS_TEXTUREMAP 0
427 typedef struct _D3DHAL_DP2VIEWPORTINFO
{
432 } D3DHAL_DP2VIEWPORTINFO
,*LPD3DHAL_DP2VIEWPORTINFO
;
434 typedef struct _D3DHAL_DP2WINFO
{
437 } D3DHAL_DP2WINFO
,*LPD3DHAL_DP2WINFO
;
439 typedef struct _D3DHAL_DP2SETPALETTE
{
440 DWORD dwPaletteHandle
;
441 DWORD dwPaletteFlags
;
442 DWORD dwSurfaceHandle
;
443 } D3DHAL_DP2SETPALETTE
,*LPD3DHAL_DP2SETPALETTE
;
445 typedef struct _D3DHAL_DP2UPDATEPALETTE
{
446 DWORD dwPaletteHandle
;
449 } D3DHAL_DP2UPDATEPALETTE
,*LPD3DHAL_DP2UPDATEPALETTE
;
451 typedef struct _D3DHAL_DP2ZRANGE
{
454 } D3DHAL_DP2ZRANGE
,*LPD3DHAL_DP2ZRANGE
;
456 typedef D3DMATERIAL7 D3DHAL_DP2SETMATERIAL
,*LPD3DHAL_DP2SETMATERIAL
;
458 typedef struct _D3DHAL_DP2SETLIGHT
{
461 } D3DHAL_DP2SETLIGHT
,*LPD3DHAL_DP2SETLIGHT
;
463 #define D3DHAL_SETLIGHT_ENABLE 0
464 #define D3DHAL_SETLIGHT_DISABLE 1
465 #define D3DHAL_SETLIGHT_DATA 2
467 typedef struct _D3DHAL_DP2CREATELIGHT
{
469 } D3DHAL_DP2CREATELIGHT
,*LPD3DHAL_DP2CREATELIGHT
;
471 typedef struct _D3DHAL_DP2SETTRANSFORM
{
472 D3DTRANSFORMSTATETYPE xfrmType
;
474 } D3DHAL_DP2SETTRANSFORM
,*LPD3DHAL_DP2SETTRANSFORM
;
476 typedef struct _D3DHAL_DP2TEXBLT
{
477 DWORD dwDDDestSurface
;
478 DWORD dwDDSrcSurface
;
482 } D3DHAL_DP2TEXBLT
,*LPD3DHAL_DP2TEXBLT
;
484 typedef struct _D3DHAL_DP2STATESET
{
487 D3DSTATEBLOCKTYPE sbType
;
488 } D3DHAL_DP2STATESET
,*LPD3DHAL_DP2STATESET
;
490 #define D3DHAL_STATESETBEGIN 0
491 #define D3DHAL_STATESETEND 1
492 #define D3DHAL_STATESETDELETE 2
493 #define D3DHAL_STATESETEXECUTE 3
494 #define D3DHAL_STATESETCAPTURE 4
496 typedef struct _D3DHAL_DP2SETPRIORITY
{
499 } D3DHAL_DP2SETPRIORITY
,*LPD3DHAL_DP2SETPRIORITY
;
501 typedef struct _D3DHAL_DP2SETRENDERTARGET
{
504 } D3DHAL_DP2SETRENDERTARGET
,*LPD3DHAL_DP2SETRENDERTARGET
;
506 typedef struct _D3DHAL_DP2CLEAR
{
509 D3DVALUE dvFillDepth
;
512 } D3DHAL_DP2CLEAR
,*LPD3DHAL_DP2CLEAR
;
514 typedef struct _D3DHAL_DP2SETTEXLOD
{
517 } D3DHAL_DP2SETTEXLOD
,*LPD3DHAL_DP2SETTEXLOD
;
523 #endif /* __WINE_D3DHAL_H */