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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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_RESERVED0 = 4,
306 D3DDP2OP_RENDERSTATE = 8,
307 D3DDP2OP_LINELIST = 15,
308 D3DDP2OP_LINESTRIP = 16,
309 D3DDP2OP_INDEXEDLINESTRIP = 17,
310 D3DDP2OP_TRIANGLELIST = 18,
311 D3DDP2OP_TRIANGLESTRIP = 19,
312 D3DDP2OP_INDEXEDTRIANGLESTRIP = 20,
313 D3DDP2OP_TRIANGLEFAN = 21,
314 D3DDP2OP_INDEXEDTRIANGLEFAN = 22,
315 D3DDP2OP_TRIANGLEFAN_IMM = 23,
316 D3DDP2OP_LINELIST_IMM = 24,
317 D3DDP2OP_TEXTURESTAGESTATE = 25,
318 D3DDP2OP_INDEXEDTRIANGLELIST2 = 26,
319 D3DDP2OP_INDEXEDLINELIST2 = 27,
320 D3DDP2OP_VIEWPORTINFO = 28,
322 /* pre-DirectX 7 interfaces */
323 D3DDP2OP_SETPALETTE = 30,
324 D3DDP2OP_UPDATEPALETTE = 31,
325 /* DirectX 7 interfaces */
326 D3DDP2OP_ZRANGE = 32,
327 D3DDP2OP_SETMATERIAL = 33,
328 D3DDP2OP_SETLIGHT = 34,
329 D3DDP2OP_CREATELIGHT = 35,
330 D3DDP2OP_SETTRANSFORM = 36,
332 D3DDP2OP_TEXBLT = 38,
333 D3DDP2OP_STATESET = 39,
334 D3DDP2OP_SETPRIORITY = 40,
336 D3DDP2OP_SETRENDERTARGET = 41,
338 /* DirectX 7 interfaces */
339 D3DDP2OP_SETTEXLOD = 43,
340 D3DPP2OP_SETCLIPPLANE = 44
341 } D3DHAL_DP2OPERATION;
343 /* point primitives */
345 typedef struct _D3DHAL_POINTS {
348 } D3DHAL_DP2POINTS,*LPD3DHAL_DP2POINTS;
350 /* line primitives */
352 typedef struct _D3DHAL_DP2STARTVERTEX {
354 } D3DHAL_DP2STARTVERTEX,*LPD3DHAL_DP2STARTVERTEX;
356 typedef struct _D3DHAL_DP2LINELIST {
358 } D3DHAL_DP2LINELIST,*LPD3DHAL_DP2LINELIST;
360 typedef struct _D3DHAL_DP2INDEXEDLINELIST {
363 } D3DHAL_DP2INDEXEDLINELIST,*LPD3DHAL_DP2INDEXEDLINELIST;
365 typedef struct _D3DHAL_DP2LINESTRIP {
367 } D3DHAL_DP2LINESTRIP,*LPD3DHAL_DP2LINESTRIP;
369 typedef struct _D3DHAL_DP2INDEXEDLINESTRIP {
371 } D3DHAL_DP2INDEXEDLINESTRIP,*LPD3DHAL_DP2INDEXEDLINESTRIP;
373 /* triangle primitives */
375 typedef struct _D3DHAL_DP2TRIANGLELIST {
377 } D3DHAL_DP2TRIANGLELIST,*LPD3DHAL_DP2TRIANGLELIST;
379 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST {
384 } D3DHAL_DP2INDEXEDTRIANGLELIST,*LPD3DHAL_DP2INDEXEDTRIANGLELIST;
386 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2 {
390 } D3DHAL_DP2INDEXEDTRIANGLELIST2,*LPD3DHAL_DP2INDEXEDTRIANGLELIST2;
392 typedef struct _D3DHAL_DP2TRIANGLESTRIP {
394 } D3DHAL_DP2TRIANGLESTRIP,*LPD3DHAL_DP2TRIANGLESTRIP;
396 typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP {
398 } D3DHAL_DP2INDEXEDTRIANGLESTRIP,*LPD3DHAL_DP2INDEXEDTRIANGLESTRIP;
400 typedef struct _D3DHAL_DP2TRIANGLEFAN {
402 } D3DHAL_DP2TRIANGLEFAN,*LPD3DHAL_DP2TRIANGLEFAN;
404 typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN {
406 } D3DHAL_DP2INDEXEDTRIANGLEFAN,*LPD3DHAL_DP2INDEXEDTRIANGLEFAN;
408 typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM {
410 } D3DHAL_DP2TRIANGLEFAN_IMM,*LPD3DHAL_DP2TRIANGLEFAN_IMM;
413 typedef struct _D3DHAL_DP2RENDERSTATE {
414 D3DRENDERSTATETYPE RenderState;
419 } D3DHAL_DP2RENDERSTATE,*LPD3DHAL_DP2RENDERSTATE;
421 typedef struct _D3DHAL_DP2TEXTURESTAGESTATE {
425 } D3DHAL_DP2TEXTURESTAGESTATE,*LPD3DHAL_DP2TEXTURESTAGESTATE;
427 #define D3DTSS_TEXTUREMAP 0
429 typedef struct _D3DHAL_DP2VIEWPORTINFO {
434 } D3DHAL_DP2VIEWPORTINFO,*LPD3DHAL_DP2VIEWPORTINFO;
436 typedef struct _D3DHAL_DP2WINFO {
439 } D3DHAL_DP2WINFO,*LPD3DHAL_DP2WINFO;
441 typedef struct _D3DHAL_DP2SETPALETTE {
442 DWORD dwPaletteHandle;
443 DWORD dwPaletteFlags;
444 DWORD dwSurfaceHandle;
445 } D3DHAL_DP2SETPALETTE,*LPD3DHAL_DP2SETPALETTE;
447 typedef struct _D3DHAL_DP2UPDATEPALETTE {
448 DWORD dwPaletteHandle;
451 } D3DHAL_DP2UPDATEPALETTE,*LPD3DHAL_DP2UPDATEPALETTE;
453 typedef struct _D3DHAL_DP2ZRANGE {
456 } D3DHAL_DP2ZRANGE,*LPD3DHAL_DP2ZRANGE;
458 typedef D3DMATERIAL7 D3DHAL_DP2SETMATERIAL,*LPD3DHAL_DP2SETMATERIAL;
460 typedef struct _D3DHAL_DP2SETLIGHT {
463 } D3DHAL_DP2SETLIGHT,*LPD3DHAL_DP2SETLIGHT;
465 #define D3DHAL_SETLIGHT_ENABLE 0
466 #define D3DHAL_SETLIGHT_DISABLE 1
467 #define D3DHAL_SETLIGHT_DATA 2
469 typedef struct _D3DHAL_DP2CREATELIGHT {
471 } D3DHAL_DP2CREATELIGHT,*LPD3DHAL_DP2CREATELIGHT;
473 typedef struct _D3DHAL_DP2SETTRANSFORM {
474 D3DTRANSFORMSTATETYPE xfrmType;
476 } D3DHAL_DP2SETTRANSFORM,*LPD3DHAL_DP2SETTRANSFORM;
478 typedef struct _D3DHAL_DP2TEXBLT {
479 DWORD dwDDDestSurface;
480 DWORD dwDDSrcSurface;
484 } D3DHAL_DP2TEXBLT,*LPD3DHAL_DP2TEXBLT;
486 typedef struct _D3DHAL_DP2STATESET {
489 D3DSTATEBLOCKTYPE sbType;
490 } D3DHAL_DP2STATESET,*LPD3DHAL_DP2STATESET;
492 #define D3DHAL_STATESETBEGIN 0
493 #define D3DHAL_STATESETEND 1
494 #define D3DHAL_STATESETDELETE 2
495 #define D3DHAL_STATESETEXECUTE 3
496 #define D3DHAL_STATESETCAPTURE 4
498 typedef struct _D3DHAL_DP2SETPRIORITY {
501 } D3DHAL_DP2SETPRIORITY,*LPD3DHAL_DP2SETPRIORITY;
503 typedef struct _D3DHAL_DP2SETRENDERTARGET {
506 } D3DHAL_DP2SETRENDERTARGET,*LPD3DHAL_DP2SETRENDERTARGET;
508 typedef struct _D3DHAL_DP2CLEAR {
511 D3DVALUE dvFillDepth;
514 } D3DHAL_DP2CLEAR,*LPD3DHAL_DP2CLEAR;
516 typedef struct _D3DHAL_DP2SETTEXLOD {
519 } D3DHAL_DP2SETTEXLOD,*LPD3DHAL_DP2SETTEXLOD;
525 #endif /* __WINE_DDRAWI_H */