xref: /reactos/sdk/include/ddk/d3dhal.h (revision c2c66aff)
1 /*
2  * Direct3D driver interface
3  * (DirectX 7 version)
4  *
5  * Copyright (C) 2001 Ove Kaaven
6  *
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.
11  *
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.
16  *
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 Street, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef _D3DHAL_H_
23 #define _D3DHAL_H_
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <ddraw.h>
30 #include <d3dtypes.h>
31 #include <d3dcaps.h>
32 #include <d3d.h>
33 
34 #if (DIRECT3D_VERSION >= 0x0900)
35 #include <d3d9.h>
36 #endif
37 
38 #ifndef DDRAWI_DIRECTDRAW_DEFINED
39 typedef struct _DDRAWI_DIRECTDRAW_GBL FAR *LPDDRAWI_DIRECTDRAW_GBL;
40 typedef struct _DDRAWI_DIRECTDRAW_LCL FAR *LPDDRAWI_DIRECTDRAW_LCL;
41 #define DDRAWI_DIRECTDRAW_DEFINED
42 #endif
43 
44 #ifndef DDRAWI_DDRAWSURFACE_DEFINED
45 typedef struct _DDRAWI_DDRAWSURFACE_LCL FAR *LPDDRAWI_DDRAWSURFACE_LCL;
46 #define DDRAWI_DDRAWSURFACE_DEFINED
47 #endif
48 
49 #define D3DERR_COMMAND_UNPARSED 0x88760BB8;
50 
51 /*****************************************************************************
52  * device info structures
53  */
54 typedef struct _D3DDeviceDesc_V1 {
55   DWORD dwSize;
56   DWORD dwFlags;
57   D3DCOLORMODEL dcmColorModel;
58   DWORD dwDevCaps;
59   D3DTRANSFORMCAPS dtcTransformCaps;
60   BOOL bClipping;
61   D3DLIGHTINGCAPS dlcLightingCaps;
62   D3DPRIMCAPS dpcLineCaps;
63   D3DPRIMCAPS dpcTriCaps;
64   DWORD dwDeviceRenderBitDepth;
65   DWORD dwDeviceZBufferBitDepth;
66   DWORD dwMaxBufferSize;
67   DWORD dwMaxVertexCount;
68 } D3DDEVICEDESC_V1, *LPD3DDEVICEDESC_V1;
69 
70 /* this is to allow keeping the bulk of our OpenGL code out of x11drv */
71 #define D3DDD_WINE_OPENGL_DEVICE 0x00008000
72 
73 typedef struct _D3DHAL_GLOBALDRIVERDATA {
74   DWORD dwSize;
75   D3DDEVICEDESC_V1 hwCaps;
76   DWORD dwNumVertices;
77   DWORD dwNumClipVertices;
78   DWORD dwNumTextureFormats;
79   LPDDSURFACEDESC lpTextureFormats;
80 } D3DHAL_GLOBALDRIVERDATA;
81 
82 #ifndef D3DHAL_GLOBALDRIVERDATA_DEFINED
83 typedef D3DHAL_GLOBALDRIVERDATA *LPD3DHAL_GLOBALDRIVERDATA;
84 #define D3DHAL_GLOBALDRIVERDATA_DEFINED
85 #endif
86 
87 typedef struct _D3DHAL_D3DEXTENDEDCAPS {
88   DWORD dwSize;
89   /* DirectX 5 */
90   DWORD dwMinTextureWidth, dwMaxTextureWidth;
91   DWORD dwMinTextureHeight, dwMaxTextureHeight;
92   DWORD dwMinStippleWidth, dwMaxStippleWidth;
93   DWORD dwMinStippleHeight, dwMaxStippleHeight;
94   /* DirectX 6 */
95   DWORD dwMaxTextureRepeat;
96   DWORD dwMaxTextureAspectRatio;
97   DWORD dwMaxAnisotropy;
98   D3DVALUE dvGuardBandLeft;
99   D3DVALUE dvGuardBandTop;
100   D3DVALUE dvGuardBandRight;
101   D3DVALUE dvGuardBandBottom;
102   D3DVALUE dvExtentsAdjust;
103   DWORD dwStencilCaps;
104   DWORD dwFVFCaps;
105   DWORD dwTextureOpCaps;
106   WORD wMaxTextureBlendStages;
107   WORD wMaxSimultaneousTextures;
108   /* DirectX 7 */
109   DWORD dwMaxActiveLights;
110   D3DVALUE dvMaxVertexW;
111   WORD wMaxUserClipPlanes;
112   WORD wMaxVertexBlendMatrices;
113   DWORD dwVertexProcessingCaps;
114   DWORD dwReserved1;
115   DWORD dwReserved2;
116   DWORD dwReserved3;
117   DWORD dwReserved4;
118 } D3DHAL_D3DEXTENDEDCAPS, *LPD3DHAL_D3DEXTENDEDCAPS;
119 
120 /*****************************************************************************
121  * d3d->driver callbacks
122  */
123 typedef struct _D3DHAL_CONTEXTCREATEDATA *LPD3DHAL_CONTEXTCREATEDATA;
124 typedef struct _D3DHAL_CONTEXTDESTROYDATA *LPD3DHAL_CONTEXTDESTROYDATA;
125 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA *LPD3DHAL_CONTEXTDESTROYALLDATA;
126 typedef struct _D3DHAL_SCENECAPTUREDATA *LPD3DHAL_SCENECAPTUREDATA;
127 typedef struct _D3DHAL_RENDERSTATEDATA *LPD3DHAL_RENDERSTATEDATA;
128 typedef struct _D3DHAL_RENDERPRIMITIVEDATA *LPD3DHAL_RENDERPRIMITIVEDATA;
129 typedef struct _D3DHAL_TEXTURECREATEDATA *LPD3DHAL_TEXTURECREATEDATA;
130 typedef struct _D3DHAL_TEXTUREDESTROYDATA *LPD3DHAL_TEXTUREDESTROYDATA;
131 typedef struct _D3DHAL_TEXTURESWAPDATA *LPD3DHAL_TEXTURESWAPDATA;
132 typedef struct _D3DHAL_TEXTUREGETSURFDATA *LPD3DHAL_TEXTUREGETSURFDATA;
133 typedef struct _D3DHAL_GETSTATEDATA *LPD3DHAL_GETSTATEDATA;
134 
135 typedef DWORD (PASCAL *LPD3DHAL_CONTEXTCREATECB)    (LPD3DHAL_CONTEXTCREATEDATA);
136 typedef DWORD (PASCAL *LPD3DHAL_CONTEXTDESTROYCB)   (LPD3DHAL_CONTEXTDESTROYDATA);
137 typedef DWORD (PASCAL *LPD3DHAL_CONTEXTDESTROYALLCB)(LPD3DHAL_CONTEXTDESTROYALLDATA);
138 typedef DWORD (PASCAL *LPD3DHAL_SCENECAPTURECB)     (LPD3DHAL_SCENECAPTUREDATA);
139 typedef DWORD (PASCAL *LPD3DHAL_RENDERSTATECB)      (LPD3DHAL_RENDERSTATEDATA);
140 typedef DWORD (PASCAL *LPD3DHAL_RENDERPRIMITIVECB)  (LPD3DHAL_RENDERPRIMITIVEDATA);
141 typedef DWORD (PASCAL *LPD3DHAL_TEXTURECREATECB)    (LPD3DHAL_TEXTURECREATEDATA);
142 typedef DWORD (PASCAL *LPD3DHAL_TEXTUREDESTROYCB)   (LPD3DHAL_TEXTUREDESTROYDATA);
143 typedef DWORD (PASCAL *LPD3DHAL_TEXTURESWAPCB)      (LPD3DHAL_TEXTURESWAPDATA);
144 typedef DWORD (PASCAL *LPD3DHAL_TEXTUREGETSURFCB)   (LPD3DHAL_TEXTUREGETSURFDATA);
145 typedef DWORD (PASCAL *LPD3DHAL_GETSTATECB)         (LPD3DHAL_GETSTATEDATA);
146 
147 typedef struct _D3DHAL_CALLBACKS {
148   DWORD dwSize;
149   LPD3DHAL_CONTEXTCREATECB ContextCreate;
150   LPD3DHAL_CONTEXTDESTROYCB ContextDestroy;
151   LPD3DHAL_CONTEXTDESTROYALLCB ContextDestroyAll;
152   LPD3DHAL_SCENECAPTURECB SceneCapture;
153   LPVOID lpReserved10;
154   LPVOID lpReserved11;
155   LPD3DHAL_RENDERSTATECB RenderState;
156   LPD3DHAL_RENDERPRIMITIVECB RenderPrimitive;
157   DWORD dwReserved;
158   LPD3DHAL_TEXTURECREATECB TextureCreate;
159   LPD3DHAL_TEXTUREDESTROYCB TextureDestroy;
160   LPD3DHAL_TEXTURESWAPCB TextureSwap;
161   LPD3DHAL_TEXTUREGETSURFCB TextureGetSurf;
162   /* now why did MS create CALLBACKS2 and CALLBACKS3 structures if
163    * all these reserved fields were available? we may never know */
164   LPVOID lpReserved12;
165   LPVOID lpReserved13;
166   LPVOID lpReserved14;
167   LPVOID lpReserved15;
168   LPVOID lpReserved16;
169   LPVOID lpReserved17;
170   LPVOID lpReserved18;
171   LPVOID lpReserved19;
172   LPVOID lpReserved20;
173   LPVOID lpReserved21;
174   LPD3DHAL_GETSTATECB GetState;
175   DWORD dwReserved0;
176   DWORD dwReserved1;
177   DWORD dwReserved2;
178   DWORD dwReserved3;
179   DWORD dwReserved4;
180   DWORD dwReserved5;
181   DWORD dwReserved6;
182   DWORD dwReserved7;
183   DWORD dwReserved8;
184   DWORD dwReserved9;
185 } D3DHAL_CALLBACKS;
186 
187 #ifndef D3DHAL_CALLBACKS_DEFINED
188 typedef D3DHAL_CALLBACKS *LPD3DHAL_CALLBACKS;
189 #define D3DHAL_CALLBACKS_DEFINED
190 #endif
191 
192 typedef struct _D3DHAL_SETRENDERTARGETDATA *LPD3DHAL_SETRENDERTARGETDATA;
193 typedef struct _D3DHAL_CLEARDATA *LPD3DHAL_CLEARDATA;
194 typedef struct _D3DHAL_DRAWONEPRIMITIVEDATA *LPD3DHAL_DRAWONEPRIMITIVEDATA;
195 typedef struct _D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA *LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA;
196 typedef struct _D3DHAL_DRAWPRIMITIVESDATA *LPD3DHAL_DRAWPRIMITIVESDATA;
197 
198 typedef DWORD (PASCAL *LPD3DHAL_SETRENDERTARGETCB)        (LPD3DHAL_SETRENDERTARGETDATA);
199 typedef DWORD (PASCAL *LPD3DHAL_CLEARCB)                  (LPD3DHAL_CLEARDATA);
200 typedef DWORD (PASCAL *LPD3DHAL_DRAWONEPRIMITIVECB)       (LPD3DHAL_DRAWONEPRIMITIVEDATA);
201 typedef DWORD (PASCAL *LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB)(LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA);
202 typedef DWORD (PASCAL *LPD3DHAL_DRAWPRIMITIVESCB)         (LPD3DHAL_DRAWPRIMITIVESDATA);
203 
204 typedef struct _D3DHAL_CALLBACKS2 {
205   DWORD dwSize;
206   DWORD dwFlags;
207   LPD3DHAL_SETRENDERTARGETCB SetRenderTarget;
208   LPD3DHAL_CLEARCB Clear;
209   LPD3DHAL_DRAWONEPRIMITIVECB DrawOnePrimitive;
210   LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB DrawOneIndexedPrimitive;
211   LPD3DHAL_DRAWPRIMITIVESCB DrawPrimitives;
212 } D3DHAL_CALLBACKS2, *LPD3DHAL_CALLBACKS2;
213 
214 typedef struct _D3DHAL_CLEAR2DATA *LPD3DHAL_CLEAR2DATA;
215 typedef struct _D3DHAL_VALIDATETEXTURESTAGESTATEDATA *LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA;
216 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA *LPD3DHAL_DRAWPRIMITIVES2DATA;
217 
218 typedef DWORD (PASCAL *LPD3DHAL_CLEAR2CB) (LPD3DHAL_CLEAR2DATA);
219 typedef DWORD (PASCAL *LPD3DHAL_VALIDATETEXTURESTAGESTATECB) (LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA);
220 typedef DWORD (PASCAL *LPD3DHAL_DRAWPRIMITIVES2CB) (LPD3DHAL_DRAWPRIMITIVES2DATA);
221 
222 typedef struct _D3DHAL_CALLBACKS3 {
223   DWORD dwSize;
224   DWORD dwFlags;
225   LPD3DHAL_CLEAR2CB Clear2;
226   LPVOID lpvReserved;
227   LPD3DHAL_VALIDATETEXTURESTAGESTATECB ValidateTextureStageState;
228   LPD3DHAL_DRAWPRIMITIVES2CB DrawPrimitives2;
229 } D3DHAL_CALLBACKS3, *LPD3DHAL_CALLBACKS3;
230 
231 /*****************************************************************************
232  * parameter structures
233  */
234 typedef struct _D3DHAL_CONTEXTCREATEDATA {
235   _ANONYMOUS_UNION union {
236     LPDDRAWI_DIRECTDRAW_GBL lpDDGbl; /* pre-DirectX 7 */
237     LPDDRAWI_DIRECTDRAW_LCL lpDDLcl; /* DirectX 7 */
238   } DUMMYUNIONNAME1;
239   _ANONYMOUS_UNION union {
240     LPDIRECTDRAWSURFACE lpDDS;
241     LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl; /* DirectX 7 */
242   } DUMMYUNIONNAME2;
243   _ANONYMOUS_UNION union {
244     LPDIRECTDRAWSURFACE lpDDSZ;
245     LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl; /* DirectX 7 */
246   } DUMMYUNIONNAME3;
247   _ANONYMOUS_UNION union {
248     DWORD dwPID;
249     ULONG_PTR dwrstates;
250   } DUMMYUNIONNAME4;
251   ULONG_PTR dwhContext;
252   HRESULT ddrval;
253 } D3DHAL_CONTEXTCREATEDATA;
254 
255 typedef struct _D3DHAL_CONTEXTDESTROYDATA {
256   ULONG_PTR dwhContext;
257   HRESULT ddrval;
258 } D3DHAL_CONTEXTDESTROYDATA;
259 
260 typedef struct _D3DHAL_CONTEXTDESTROYALLDATA {
261   DWORD dwPID;
262   HRESULT ddrval;
263 } D3DHAL_CONTEXTDESTROYALLDATA;
264 
265 typedef struct _D3DHAL_SCENECAPTUREDATA {
266   ULONG_PTR dwhContext;
267   DWORD dwFlag;
268   HRESULT ddrval;
269 } D3DHAL_SCENECAPTUREDATA;
270 
271 #define D3DHAL_SCENE_CAPTURE_START 0x00000000
272 #define D3DHAL_SCENE_CAPTURE_END   0x00000001
273 
274 typedef struct _D3DHAL_SETRENDERTARGETDATA {
275   ULONG_PTR dwhContext;
276   _ANONYMOUS_UNION union {
277     LPDIRECTDRAWSURFACE lpDDS;
278     LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl;
279   } DUMMYUNIONNAME1;
280   _ANONYMOUS_UNION union {
281     LPDIRECTDRAWSURFACE lpDDSZ;
282     LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl;
283   } DUMMYUNIONNAME2;
284   HRESULT ddrval;
285 } D3DHAL_SETRENDERTARGETDATA;
286 
287 typedef struct _D3DHAL_DRAWPRIMITIVES2DATA {
288   ULONG_PTR dwhContext;
289   DWORD dwFlags;
290   DWORD dwVertexType;
291   LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands;
292   DWORD dwCommandOffset;
293   DWORD dwCommandLength;
294   _ANONYMOUS_UNION union {
295     LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex;
296     LPVOID lpVertices;
297   } DUMMYUNIONNAME1;
298   DWORD dwVertexOffset;
299   DWORD dwVertexLength;
300   DWORD dwReqVertexBufSize;
301   DWORD dwReqCommandBufSize;
302   LPDWORD lpdwRStates;
303   _ANONYMOUS_UNION union {
304     DWORD dwVertexSize;
305     HRESULT ddrval;
306   } DUMMYUNIONNAME2;
307   DWORD dwErrorOffset;
308 } D3DHAL_DRAWPRIMITIVES2DATA;
309 
310 #define D3DHALDP2_USERMEMVERTICES   0x00000001
311 #define D3DHALDP2_EXECUTEBUFFER     0x00000002
312 #define D3DHALDP2_SWAPVERTEXBUFFER  0x00000004
313 #define D3DHALDP2_SWAPCOMMANDBUFFER 0x00000008
314 #define D3DHALDP2_REQVERTEXBUFSIZE  0x00000010
315 #define D3DHALDP2_REQCOMMANDBUFSIZE 0x00000020
316 #define D3DHALDP2_VIDMEMVERTEXBUF   0x00000040
317 #define D3DHALDP2_VIDMEMCOMMANDBUF  0x00000080
318 
319 /*****************************************************************************
320  * DrawPrimitives2 command structures
321  */
322 typedef struct _D3DHAL_DP2COMMAND {
323   BYTE bCommand;
324   BYTE bReserved;
325   _ANONYMOUS_UNION union {
326     WORD wPrimitiveCount;
327     WORD wStateCount;
328   } DUMMYUNIONNAME;
329 } D3DHAL_DP2COMMAND, *LPD3DHAL_DP2COMMAND;
330 
331 typedef enum _D3DHAL_DP2OPERATION {
332   D3DDP2OP_POINTS = 1,
333   D3DDP2OP_INDEXEDLINELIST = 2,
334   D3DDP2OP_INDEXEDTRIANGLELIST = 3,
335   D3DDP2OP_RENDERSTATE = 8,
336   D3DDP2OP_LINELIST = 15,
337   D3DDP2OP_LINESTRIP = 16,
338   D3DDP2OP_INDEXEDLINESTRIP = 17,
339   D3DDP2OP_TRIANGLELIST = 18,
340   D3DDP2OP_TRIANGLESTRIP = 19,
341   D3DDP2OP_INDEXEDTRIANGLESTRIP = 20,
342   D3DDP2OP_TRIANGLEFAN = 21,
343   D3DDP2OP_INDEXEDTRIANGLEFAN = 22,
344   D3DDP2OP_TRIANGLEFAN_IMM = 23,
345   D3DDP2OP_LINELIST_IMM = 24,
346   D3DDP2OP_TEXTURESTAGESTATE = 25,
347   D3DDP2OP_INDEXEDTRIANGLELIST2 = 26,
348   D3DDP2OP_INDEXEDLINELIST2 = 27,
349   D3DDP2OP_VIEWPORTINFO = 28,
350   D3DDP2OP_WINFO = 29,
351   /* pre-DirectX 7 interfaces */
352   D3DDP2OP_SETPALETTE = 30,
353   D3DDP2OP_UPDATEPALETTE = 31,
354   /* DirectX 7 interfaces */
355   D3DDP2OP_ZRANGE = 32,
356   D3DDP2OP_SETMATERIAL = 33,
357   D3DDP2OP_SETLIGHT = 34,
358   D3DDP2OP_CREATELIGHT = 35,
359   D3DDP2OP_SETTRANSFORM = 36,
360   D3DDP2OP_TEXBLT = 38,
361   D3DDP2OP_STATESET = 39,
362   D3DDP2OP_SETPRIORITY = 40,
363   /* all interfaces */
364   D3DDP2OP_SETRENDERTARGET = 41,
365   D3DDP2OP_CLEAR = 42,
366   /* DirectX 7 interfaces */
367   D3DDP2OP_SETTEXLOD = 43,
368   D3DPP2OP_SETCLIPPLANE = 44,
369 #if(DIRECT3D_VERSION >= 0x0800)
370   D3DDP2OP_CREATEVERTEXSHADER   = 45,
371   D3DDP2OP_DELETEVERTEXSHADER   = 46,
372   D3DDP2OP_SETVERTEXSHADER      = 47,
373   D3DDP2OP_SETVERTEXSHADERCONST = 48,
374   D3DDP2OP_SETSTREAMSOURCE      = 49,
375   D3DDP2OP_SETSTREAMSOURCEUM    = 50,
376   D3DDP2OP_SETINDICES           = 51,
377   D3DDP2OP_DRAWPRIMITIVE        = 52,
378   D3DDP2OP_DRAWINDEXEDPRIMITIVE = 53,
379   D3DDP2OP_CREATEPIXELSHADER    = 54,
380   D3DDP2OP_DELETEPIXELSHADER    = 55,
381   D3DDP2OP_SETPIXELSHADER       = 56,
382   D3DDP2OP_SETPIXELSHADERCONST  = 57,
383   D3DDP2OP_CLIPPEDTRIANGLEFAN   = 58,
384   D3DDP2OP_DRAWPRIMITIVE2       = 59,
385   D3DDP2OP_DRAWINDEXEDPRIMITIVE2= 60,
386   D3DDP2OP_DRAWRECTPATCH        = 61,
387   D3DDP2OP_DRAWTRIPATCH         = 62,
388   D3DDP2OP_VOLUMEBLT            = 63,
389   D3DDP2OP_BUFFERBLT            = 64,
390   D3DDP2OP_MULTIPLYTRANSFORM    = 65,
391   D3DDP2OP_ADDDIRTYRECT         = 66,
392   D3DDP2OP_ADDDIRTYBOX          = 67,
393 #endif
394 #if(DIRECT3D_VERSION >= 0x0900)
395   D3DDP2OP_CREATEVERTEXSHADERDECL   = 71,
396   D3DDP2OP_DELETEVERTEXSHADERDECL   = 72,
397   D3DDP2OP_SETVERTEXSHADERDECL      = 73,
398   D3DDP2OP_CREATEVERTEXSHADERFUNC   = 74,
399   D3DDP2OP_DELETEVERTEXSHADERFUNC   = 75,
400   D3DDP2OP_SETVERTEXSHADERFUNC      = 76,
401   D3DDP2OP_SETVERTEXSHADERCONSTI    = 77,
402   D3DDP2OP_SETSCISSORRECT           = 79,
403   D3DDP2OP_SETSTREAMSOURCE2         = 80,
404   D3DDP2OP_BLT                      = 81,
405   D3DDP2OP_COLORFILL                = 82,
406   D3DDP2OP_SETVERTEXSHADERCONSTB    = 83,
407   D3DDP2OP_CREATEQUERY              = 84,
408   D3DDP2OP_SETRENDERTARGET2         = 85,
409   D3DDP2OP_SETDEPTHSTENCIL          = 86,
410   D3DDP2OP_RESPONSECONTINUE         = 87,
411   D3DDP2OP_RESPONSEQUERY            = 88,
412   D3DDP2OP_GENERATEMIPSUBLEVELS     = 89,
413   D3DDP2OP_DELETEQUERY              = 90,
414   D3DDP2OP_ISSUEQUERY               = 91,
415   D3DDP2OP_SETPIXELSHADERCONSTI     = 93,
416   D3DDP2OP_SETPIXELSHADERCONSTB     = 94,
417   D3DDP2OP_SETSTREAMSOURCEFREQ      = 95,
418   D3DDP2OP_SURFACEBLT               = 96
419 #endif
420 } D3DHAL_DP2OPERATION;
421 
422 /* point primitives */
423 
424 typedef struct _D3DHAL_POINTS {
425   WORD wCount;
426   WORD wVStart;
427 } D3DHAL_DP2POINTS, *LPD3DHAL_DP2POINTS;
428 
429 /* line primitives */
430 
431 typedef struct _D3DHAL_DP2STARTVERTEX {
432   WORD wVStart;
433 } D3DHAL_DP2STARTVERTEX, *LPD3DHAL_DP2STARTVERTEX;
434 
435 typedef struct _D3DHAL_DP2LINELIST {
436   WORD wVStart;
437 } D3DHAL_DP2LINELIST, *LPD3DHAL_DP2LINELIST;
438 
439 typedef struct _D3DHAL_DP2INDEXEDLINELIST {
440   WORD wV1;
441   WORD wV2;
442 } D3DHAL_DP2INDEXEDLINELIST, *LPD3DHAL_DP2INDEXEDLINELIST;
443 
444 typedef struct _D3DHAL_DP2LINESTRIP {
445   WORD wVStart;
446 } D3DHAL_DP2LINESTRIP, *LPD3DHAL_DP2LINESTRIP;
447 
448 typedef struct _D3DHAL_DP2INDEXEDLINESTRIP {
449   WORD wV[2];
450 } D3DHAL_DP2INDEXEDLINESTRIP, *LPD3DHAL_DP2INDEXEDLINESTRIP;
451 
452 /* triangle primitives */
453 
454 typedef struct _D3DHAL_DP2TRIANGLELIST {
455   WORD wVStart;
456 } D3DHAL_DP2TRIANGLELIST, *LPD3DHAL_DP2TRIANGLELIST;
457 
458 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST {
459   WORD wV1;
460   WORD wV2;
461   WORD wV3;
462   WORD wFlags;
463 } D3DHAL_DP2INDEXEDTRIANGLELIST, *LPD3DHAL_DP2INDEXEDTRIANGLELIST;
464 
465 typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2 {
466   WORD wV1;
467   WORD wV2;
468   WORD wV3;
469 } D3DHAL_DP2INDEXEDTRIANGLELIST2, *LPD3DHAL_DP2INDEXEDTRIANGLELIST2;
470 
471 typedef struct _D3DHAL_DP2TRIANGLESTRIP {
472   WORD wVStart;
473 } D3DHAL_DP2TRIANGLESTRIP, *LPD3DHAL_DP2TRIANGLESTRIP;
474 
475 typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP {
476   WORD wV[3];
477 } D3DHAL_DP2INDEXEDTRIANGLESTRIP, *LPD3DHAL_DP2INDEXEDTRIANGLESTRIP;
478 
479 typedef struct _D3DHAL_DP2TRIANGLEFAN {
480   WORD wVStart;
481 } D3DHAL_DP2TRIANGLEFAN, *LPD3DHAL_DP2TRIANGLEFAN;
482 
483 typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN {
484   WORD wV[3];
485 } D3DHAL_DP2INDEXEDTRIANGLEFAN, *LPD3DHAL_DP2INDEXEDTRIANGLEFAN;
486 
487 typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM {
488   DWORD dwEdgeFlags;
489 } D3DHAL_DP2TRIANGLEFAN_IMM, *LPD3DHAL_DP2TRIANGLEFAN_IMM;
490 
491 /* render states */
492 typedef struct _D3DHAL_DP2RENDERSTATE {
493   D3DRENDERSTATETYPE RenderState;
494   _ANONYMOUS_UNION union {
495     D3DVALUE dvState;
496     DWORD dwState;
497   } DUMMYUNIONNAME;
498 } D3DHAL_DP2RENDERSTATE, *LPD3DHAL_DP2RENDERSTATE;
499 
500 typedef struct _D3DHAL_DP2TEXTURESTAGESTATE {
501   WORD wStage;
502   WORD TSState;
503   DWORD dwValue;
504 } D3DHAL_DP2TEXTURESTAGESTATE, *LPD3DHAL_DP2TEXTURESTAGESTATE;
505 
506 #define D3DTSS_TEXTUREMAP 0
507 
508 typedef struct _D3DHAL_DP2VIEWPORTINFO {
509   DWORD dwX;
510   DWORD dwY;
511   DWORD dwWidth;
512   DWORD dwHeight;
513 } D3DHAL_DP2VIEWPORTINFO, *LPD3DHAL_DP2VIEWPORTINFO;
514 
515 typedef struct _D3DHAL_DP2WINFO {
516   D3DVALUE dwWNear;
517   D3DVALUE dwWFar;
518 } D3DHAL_DP2WINFO, *LPD3DHAL_DP2WINFO;
519 
520 typedef struct _D3DHAL_DP2SETPALETTE {
521   DWORD dwPaletteHandle;
522   DWORD dwPaletteFlags;
523   DWORD dwSurfaceHandle;
524 } D3DHAL_DP2SETPALETTE, *LPD3DHAL_DP2SETPALETTE;
525 
526 typedef struct _D3DHAL_DP2UPDATEPALETTE {
527   DWORD dwPaletteHandle;
528   WORD wStartIndex;
529   WORD wNumEntries;
530 } D3DHAL_DP2UPDATEPALETTE, *LPD3DHAL_DP2UPDATEPALETTE;
531 
532 typedef struct _D3DHAL_DP2ZRANGE {
533   D3DVALUE dvMinZ;
534   D3DVALUE dvMaxZ;
535 } D3DHAL_DP2ZRANGE, *LPD3DHAL_DP2ZRANGE;
536 
537 typedef D3DMATERIAL7 D3DHAL_DP2SETMATERIAL,*LPD3DHAL_DP2SETMATERIAL;
538 
539 typedef struct _D3DHAL_DP2SETLIGHT {
540   DWORD dwIndex;
541   DWORD dwDataType;
542 } D3DHAL_DP2SETLIGHT, *LPD3DHAL_DP2SETLIGHT;
543 
544 #define D3DHAL_SETLIGHT_ENABLE  0
545 #define D3DHAL_SETLIGHT_DISABLE 1
546 #define D3DHAL_SETLIGHT_DATA    2
547 
548 typedef struct _D3DHAL_DP2CREATELIGHT {
549   DWORD dwIndex;
550 } D3DHAL_DP2CREATELIGHT, *LPD3DHAL_DP2CREATELIGHT;
551 
552 typedef struct _D3DHAL_DP2SETTRANSFORM {
553   D3DTRANSFORMSTATETYPE xfrmType;
554   D3DMATRIX matrix;
555 } D3DHAL_DP2SETTRANSFORM, *LPD3DHAL_DP2SETTRANSFORM;
556 
557 typedef struct _D3DHAL_DP2TEXBLT {
558   DWORD dwDDDestSurface;
559   DWORD dwDDSrcSurface;
560   POINT pDest;
561   RECTL rSrc;
562   DWORD dwFlags;
563 } D3DHAL_DP2TEXBLT, *LPD3DHAL_DP2TEXBLT;
564 
565 typedef struct _D3DHAL_DP2STATESET {
566   DWORD dwOperation;
567   DWORD dwParam;
568   D3DSTATEBLOCKTYPE sbType;
569 } D3DHAL_DP2STATESET, *LPD3DHAL_DP2STATESET;
570 
571 #define D3DHAL_STATESETBEGIN   0
572 #define D3DHAL_STATESETEND     1
573 #define D3DHAL_STATESETDELETE  2
574 #define D3DHAL_STATESETEXECUTE 3
575 #define D3DHAL_STATESETCAPTURE 4
576 
577 typedef struct _D3DHAL_DP2SETPRIORITY {
578   DWORD dwDDSurface;
579   DWORD dwPriority;
580 } D3DHAL_DP2SETPRIORITY, *LPD3DHAL_DP2SETPRIORITY;
581 
582 typedef struct _D3DHAL_DP2SETRENDERTARGET {
583   DWORD hRenderTarget;
584   DWORD hZBuffer;
585 } D3DHAL_DP2SETRENDERTARGET, *LPD3DHAL_DP2SETRENDERTARGET;
586 
587 typedef struct _D3DHAL_DP2CLEAR {
588   DWORD dwFlags;
589   DWORD dwFillColor;
590   D3DVALUE dvFillDepth;
591   DWORD dwFillStencil;
592   RECT Rects[1];
593 } D3DHAL_DP2CLEAR, *LPD3DHAL_DP2CLEAR;
594 
595 typedef struct _D3DHAL_DP2SETTEXLOD {
596   DWORD dwDDSurface;
597   DWORD dwLOD;
598 } D3DHAL_DP2SETTEXLOD, *LPD3DHAL_DP2SETTEXLOD;
599 
600 #if (DIRECT3D_VERSION >= 0x0900)
601 
602 #define DX9_DDI_VERSION 4
603 
604 #ifndef D3DVTXPCAPS_NO_VSDT_UBYTE4
605 #define D3DVTXPCAPS_NO_VSDT_UBYTE4 0x00000080
606 #endif
607 
608 #ifndef D3DPMISCCAPS_LINEPATTERNREP
609 #define D3DPMISCCAPS_LINEPATTERNREP 0x00000004
610 #endif
611 
612 #define D3DDEVCAPS_HWVERTEXBUFFER 0x02000000
613 #define D3DDEVCAPS_HWINDEXBUFFER  0x04000000
614 #define D3DDEVCAPS_SUBVOLUMELOCK  0x08000000
615 
616 #ifndef D3DPMISCCAPS_FOGINFVF
617 #define D3DPMISCCAPS_FOGINFVF 0x00002000
618 #endif
619 
620 #ifndef D3DFVF_FOG
621 #define D3DFVF_FOG 0x00002000
622 #endif
623 
624 typedef struct _DD_GETDRIVERINFO2DATA {
625   DWORD dwReserved;
626   DWORD dwMagic;
627   DWORD dwType;
628   DWORD dwExpectedSize;
629 } DD_GETDRIVERINFO2DATA;
630 
631 /**
632  * A driver must check DD_GETDRIVERINFO2DATA.dwHeight for
633  * D3DGDI2_MAGIC to see if the passed GUID is GUID_GetDriverInfo2
634  * or a GUID_DDStereoMode.
635  */
636 #define GUID_GetDriverInfo2 GUID_DDStereoMode
637 
638 /**
639  * Magic number used in DD_GETDRIVERINFO2DATA.dwHeight when
640  * GUID_GetDriverInfo2/GUID_DDStereoMode is specified in a
641  * GetDriverInfo call.
642  */
643 #define D3DGDI2_MAGIC 0xFFFFFFFF
644 
645 #define D3DGDI2_TYPE_GETD3DCAPS8                    0x00000001
646 #define D3DGDI2_TYPE_GETFORMATCOUNT                 0x00000002
647 #define D3DGDI2_TYPE_GETFORMAT                      0x00000003
648 #define D3DGDI2_TYPE_DXVERSION                      0x00000004 /* Make driver aware of currently used DirectX version */
649 #define D3DGDI2_TYPE_GETD3DCAPS9                    0x00000010
650 #define D3DGDI2_TYPE_GETEXTENDEDMODECOUNT           0x00000011
651 #define D3DGDI2_TYPE_GETEXTENDEDMODE                0x00000012
652 #define D3DGDI2_TYPE_GETADAPTERGROUP                0x00000013
653 #define D3DGDI2_TYPE_GETMULTISAMPLEQUALITYLEVELS    0x00000016
654 #define D3DGDI2_TYPE_DEFERRED_AGP_AWARE             0x00000018
655 #define D3DGDI2_TYPE_FREE_DEFERRED_AGP              0x00000019
656 #define D3DGDI2_TYPE_DEFER_AGP_FREES                0x00000020
657 #define D3DGDI2_TYPE_GETD3DQUERYCOUNT               0x00000021
658 #define D3DGDI2_TYPE_GETD3DQUERY                    0x00000022
659 #define D3DGDI2_TYPE_GETDDIVERSION                  0x00000023 /* Returns DX9_DDI_VERSION, used to check which DDK version the driver is compiled against */
660 
661 typedef struct _D3DCAPS8 {
662   D3DDEVTYPE DeviceType;
663   UINT AdapterOrdinal;
664   DWORD Caps;
665   DWORD Caps2;
666   DWORD Caps3;
667   DWORD PresentationIntervals;
668   DWORD CursorCaps;
669   DWORD DevCaps;
670   DWORD PrimitiveMiscCaps;
671   DWORD RasterCaps;
672   DWORD ZCmpCaps;
673   DWORD SrcBlendCaps;
674   DWORD DestBlendCaps;
675   DWORD AlphaCmpCaps;
676   DWORD ShadeCaps;
677   DWORD TextureCaps;
678   DWORD TextureFilterCaps;
679   DWORD CubeTextureFilterCaps;
680   DWORD VolumeTextureFilterCaps;
681   DWORD TextureAddressCaps;
682   DWORD VolumeTextureAddressCaps;
683   DWORD LineCaps;
684   DWORD MaxTextureWidth;
685   DWORD MaxTextureHeight;
686   DWORD MaxVolumeExtent;
687   DWORD MaxTextureRepeat;
688   DWORD MaxTextureAspectRatio;
689   DWORD MaxAnisotropy;
690   float MaxVertexW;
691   float GuardBandLeft;
692   float GuardBandTop;
693   float GuardBandRight;
694   float GuardBandBottom;
695   float ExtentsAdjust;
696   DWORD StencilCaps;
697   DWORD FVFCaps;
698   DWORD TextureOpCaps;
699   DWORD MaxTextureBlendStages;
700   DWORD MaxSimultaneousTextures;
701   DWORD VertexProcessingCaps;
702   DWORD MaxActiveLights;
703   DWORD MaxUserClipPlanes;
704   DWORD MaxVertexBlendMatrices;
705   DWORD MaxVertexBlendMatrixIndex;
706   float MaxPointSize;
707   DWORD MaxPrimitiveCount;
708   DWORD MaxVertexIndex;
709   DWORD MaxStreams;
710   DWORD MaxStreamStride;
711   DWORD VertexShaderVersion;
712   DWORD MaxVertexShaderConst;
713   DWORD PixelShaderVersion;
714   float MaxPixelShaderValue;
715 } D3DCAPS8;
716 
717 typedef struct _DD_GETFORMATCOUNTDATA {
718   DD_GETDRIVERINFO2DATA gdi2;
719   DWORD dwFormatCount;
720   DWORD dwReserved;
721 } DD_GETFORMATCOUNTDATA;
722 
723 typedef struct _DD_GETFORMATDATA {
724   DD_GETDRIVERINFO2DATA gdi2;
725   DWORD dwFormatIndex;
726   DDPIXELFORMAT format;
727 } DD_GETFORMATDATA;
728 
729 typedef struct _DD_DXVERSION {
730   DD_GETDRIVERINFO2DATA gdi2;
731   DWORD dwDXVersion;
732   DWORD dwReserved;
733 } DD_DXVERSION;
734 
735 typedef struct _DD_DEFERRED_AGP_AWARE_DATA {
736   DD_GETDRIVERINFO2DATA gdi2;
737 } DD_DEFERRED_AGP_AWARE_DATA;
738 
739 typedef struct _DD_FREE_DEFERRED_AGP_DATA {
740   DD_GETDRIVERINFO2DATA gdi2;
741   DWORD dwProcessId;
742 } DD_FREE_DEFERRED_AGP_DATA;
743 
744 typedef struct _DD_GETEXTENDEDMODECOUNTDATA {
745   DD_GETDRIVERINFO2DATA gdi2;
746   DWORD dwModeCount;
747   DWORD dwReserved;
748 } DD_GETEXTENDEDMODECOUNTDATA;
749 
750 typedef struct _DD_GETEXTENDEDMODEDATA {
751   DD_GETDRIVERINFO2DATA gdi2;
752   DWORD dwModeIndex;
753   D3DDISPLAYMODE mode;
754 } DD_GETEXTENDEDMODEDATA;
755 
756 typedef struct _DD_GETADAPTERGROUPDATA {
757   DD_GETDRIVERINFO2DATA gdi2;
758   ULONG_PTR ulUniqueAdapterGroupId;
759   DWORD dwReserved1;
760   DWORD dwReserved2;
761 } DD_GETADAPTERGROUPDATA;
762 
763 typedef struct _DD_MULTISAMPLEQUALITYLEVELSDATA {
764   DD_GETDRIVERINFO2DATA gdi2;
765   D3DFORMAT Format;
766   WINBOOL bFlip : 1;
767   D3DMULTISAMPLE_TYPE MSType : 31;
768   DWORD QualityLevels;
769 } DD_MULTISAMPLEQUALITYLEVELSDATA;
770 
771 typedef struct _DD_GETD3DQUERYCOUNTDATA {
772   DD_GETDRIVERINFO2DATA gdi2;
773   DWORD dwNumQueries;
774 } DD_GETD3DQUERYCOUNTDATA;
775 
776 typedef struct _DD_GETD3DQUERYDATA {
777   DD_GETDRIVERINFO2DATA gdi2;
778   __GNU_EXTENSION union {
779     DWORD dwQueryIndex;
780     D3DQUERYTYPE QueryType;
781   };
782 } DD_GETD3DQUERYDATA;
783 
784 typedef struct _DD_GETDDIVERSIONDATA {
785   DD_GETDRIVERINFO2DATA gdi2;
786   DWORD dwDXVersion;
787   DWORD dwDDIVersion;
788 } DD_GETDDIVERSIONDATA;
789 
790 #endif /* (DIRECT3D_VERSION >= 0x0900) */
791 
792 #ifdef __cplusplus
793 } /* extern "C" */
794 #endif
795 
796 #endif /* _D3DHAL_H_ */
797