Assorted spelling fixes.
[wine] / dlls / d3d8 / d3d8_private.h
1 /*
2  * Direct3D 8 private include file
3  *
4  * Copyright 2002-2004 Jason Edmeades
5  * Copyright 2003-2004 Raphael Junqueira
6  * Copyright 2004 Christian Costa
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __WINE_D3D8_PRIVATE_H
24 #define __WINE_D3D8_PRIVATE_H
25
26 #ifndef __WINE_CONFIG_H
27 # error You must include config.h to use this header
28 #endif
29
30 /* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES */
31 #define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
32 #include <GL/gl.h>
33 #define GLX_GLXEXT_PROTOTYPES
34 #include <GL/glx.h>
35 #ifdef HAVE_GL_GLEXT_H
36 # include <GL/glext.h>
37 #endif
38 #undef  XMD_H
39
40 #undef APIENTRY
41 #undef CALLBACK
42 #undef WINAPI
43
44 /* Redefines the constants */
45 #define CALLBACK    __stdcall
46 #define WINAPI      __stdcall
47 #define APIENTRY    WINAPI
48
49 /* X11 locking */
50
51 extern void (*wine_tsx11_lock_ptr)(void);
52 extern void (*wine_tsx11_unlock_ptr)(void);
53
54 /* As GLX relies on X, this is needed */
55 extern int num_lock;
56 #if 0
57 #define ENTER_GL() ++num_lock; TRACE("inc lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
58 #define LEAVE_GL() if (num_lock > 2) TRACE("fucking locks: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
59 #else
60 #define ENTER_GL() wine_tsx11_lock_ptr()
61 #define LEAVE_GL() wine_tsx11_unlock_ptr()
62 #endif
63
64 #include <stdarg.h>
65
66 #include "windef.h"
67 #include "winbase.h"
68 #include "d3d8.h"
69
70 extern int vs_mode;
71 #define VS_NONE 0
72 #define VS_HW   1
73 #define VS_SW   2
74
75 /* Device caps */
76 #define MAX_PALETTES      256
77 #define MAX_STREAMS       16
78 #define MAX_CLIPPLANES    D3DMAXUSERCLIPPLANES
79 #define MAX_LEVELS        256
80
81 /* Other useful values */
82 #define HIGHEST_RENDER_STATE 174
83 #define HIGHEST_TEXTURE_STATE 29
84 #define HIGHEST_TRANSFORMSTATE 512
85 #define D3DSBT_RECORDED 0xfffffffe
86
87 /* Performance changes - Only reapply what is necessary */
88 #define REAPPLY_ALPHAOP  0x0001
89 #define REAPPLY_ALL      0xFFFF
90
91 /* CreateVertexShader can return > 0xFFFF */
92 #define VS_HIGHESTFIXEDFXF 0xF0000000
93 #define VERTEX_SHADER(Handle) \
94   ((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(VertexShaders) / sizeof(IDirect3DVertexShaderImpl*)) ? NULL : VertexShaders[Handle]) : VertexShaders[Handle - VS_HIGHESTFIXEDFXF])
95 #define VERTEX_SHADER_DECL(Handle) \
96   ((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(VertexShaderDeclarations) / sizeof(IDirect3DVertexShaderDeclarationImpl*)) ? NULL : VertexShaderDeclarations[Handle]) : VertexShaderDeclarations[Handle - VS_HIGHESTFIXEDFXF])
97 #define PIXEL_SHADER(Handle) \
98   ((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(PixelShaders) / sizeof(IDirect3DPixelShaderImpl*)) ? NULL : PixelShaders[Handle]) : PixelShaders[Handle - VS_HIGHESTFIXEDFXF])
99
100 /* Direct3D8 Interfaces: */
101 typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
102 typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
103 typedef struct IDirect3D8Impl IDirect3D8Impl;
104 typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl;
105 typedef struct IDirect3DTexture8Impl IDirect3DTexture8Impl;
106 typedef struct IDirect3DCubeTexture8Impl IDirect3DCubeTexture8Impl;
107 typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
108 typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
109 typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
110 typedef struct IDirect3DResource8Impl IDirect3DResource8Impl;
111 typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
112 typedef struct IDirect3DVertexBuffer8Impl IDirect3DVertexBuffer8Impl;
113
114 /** Private Interfaces: */
115 typedef struct IDirect3DStateBlockImpl IDirect3DStateBlockImpl;
116 typedef struct IDirect3DVertexShaderImpl IDirect3DVertexShaderImpl;
117 typedef struct IDirect3DPixelShaderImpl IDirect3DPixelShaderImpl;
118 typedef struct IDirect3DVertexShaderDeclarationImpl IDirect3DVertexShaderDeclarationImpl;
119
120 typedef struct D3DSHADERVECTOR {
121   float x;
122   float y;
123   float z;
124   float w;
125 } D3DSHADERVECTOR;
126
127 typedef struct D3DSHADERSCALAR {
128   float x;
129 } D3DSHADERSCALAR;
130
131 #define D3D8_VSHADER_MAX_CONSTANTS 96
132 typedef D3DSHADERVECTOR VSHADERCONSTANTS8[D3D8_VSHADER_MAX_CONSTANTS];
133
134 typedef struct VSHADERDATA8 {
135   /** Run Time Shader Function Constants */
136   /*D3DXBUFFER* constants;*/
137   VSHADERCONSTANTS8 C;
138   /** Shader Code as char ... */
139   CONST DWORD* code;
140   UINT codeLength;
141 } VSHADERDATA8;
142
143 /** temporary here waiting for buffer code */
144 typedef struct VSHADERINPUTDATA8 {
145   D3DSHADERVECTOR V[17];
146 } VSHADERINPUTDATA8;
147
148 /** temporary here waiting for buffer code */
149 typedef struct VSHADEROUTPUTDATA8 {
150   D3DSHADERVECTOR oPos;
151   D3DSHADERVECTOR oD[2];
152   D3DSHADERVECTOR oT[8];
153   D3DSHADERVECTOR oFog;
154   D3DSHADERVECTOR oPts;
155 } VSHADEROUTPUTDATA8;
156
157
158 #define D3D8_PSHADER_MAX_CONSTANTS 32
159 typedef D3DSHADERVECTOR PSHADERCONSTANTS8[D3D8_PSHADER_MAX_CONSTANTS];
160
161 typedef struct PSHADERDATA8 {
162   /** Run Time Shader Function Constants */
163   /*D3DXBUFFER* constants;*/
164   PSHADERCONSTANTS8 C;
165   /** Shader Code as char ... */
166   CONST DWORD* code;
167   UINT codeLength;
168 } PSHADERDATA8;
169
170 /** temporary here waiting for buffer code */
171 typedef struct PSHADERINPUTDATA8 {
172   D3DSHADERVECTOR V[2];
173   D3DSHADERVECTOR T[8];
174   D3DSHADERVECTOR S[16];
175   /*D3DSHADERVECTOR R[12];*/
176 } PSHADERINPUTDATA8;
177
178 /** temporary here waiting for buffer code */
179 typedef struct PSHADEROUTPUTDATA8 {
180   D3DSHADERVECTOR oC[4];
181   D3DSHADERVECTOR oDepth;
182 } PSHADEROUTPUTDATA8;
183
184 /* 
185  * Private definitions for internal use only
186  */
187 typedef struct PLIGHTINFOEL PLIGHTINFOEL;
188 struct PLIGHTINFOEL {
189     D3DLIGHT8 OriginalParms;
190     DWORD     OriginalIndex;
191     LONG      glIndex;
192     BOOL      lightEnabled;
193     BOOL      changed;
194     BOOL      enabledChanged;
195
196     /* Converted parms to speed up swapping lights */
197     float                         lightPosn[4];
198     float                         lightDirn[4];
199     float                         exponent;
200     float                         cutoff;
201
202     PLIGHTINFOEL *next;
203     PLIGHTINFOEL *prev;
204 };
205
206 /*
207  * Macros
208  */
209 #define checkGLcall(A) \
210 { \
211     GLint err = glGetError();   \
212     if (err != GL_NO_ERROR) { \
213        FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
214     } else { \
215        TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
216     } \
217 }
218 #define vcheckGLcall(A) \
219 { \
220     GLint err = glGetError();   \
221     if (err != GL_NO_ERROR) { \
222        FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
223     } else { \
224        VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
225     } \
226 }
227
228 #include "d3dcore_gl.h"
229
230
231 #define GL_LIMITS(ExtName)            (This->direct3d8->gl_info.max_##ExtName)
232 #define GL_SUPPORT(ExtName)           (TRUE == This->direct3d8->gl_info.supported[ExtName])
233 #define GL_SUPPORT_DEV(ExtName, dev)  (TRUE == (dev)->direct3d8->gl_info.supported[ExtName])
234 #define GL_EXTCALL(FuncName)          (This->direct3d8->gl_info.FuncName)
235
236
237 #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
238 #define D3DCOLOR_G(dw) (((float) (((dw) >>  8) & 0xFF)) / 255.0f)
239 #define D3DCOLOR_B(dw) (((float) (((dw) >>  0) & 0xFF)) / 255.0f)
240 #define D3DCOLOR_A(dw) (((float) (((dw) >> 24) & 0xFF)) / 255.0f)
241
242 #define D3DCOLORTOCOLORVALUE(dw, col) \
243   (col).r = D3DCOLOR_R(dw); \
244   (col).g = D3DCOLOR_G(dw); \
245   (col).b = D3DCOLOR_B(dw); \
246   (col).a = D3DCOLOR_A(dw); 
247
248 #define D3DCOLORTOVECTOR4(dw, vec) \
249   (vec).x = D3DCOLOR_R(dw); \
250   (vec).y = D3DCOLOR_G(dw); \
251   (vec).z = D3DCOLOR_B(dw); \
252   (vec).w = D3DCOLOR_A(dw);
253
254 #define D3DCOLORTOGLFLOAT4(dw, vec) \
255   (vec)[0] = D3DCOLOR_R(dw); \
256   (vec)[1] = D3DCOLOR_G(dw); \
257   (vec)[2] = D3DCOLOR_B(dw); \
258   (vec)[3] = D3DCOLOR_A(dw);
259
260 /* ===========================================================================
261     The interfactes themselves
262    =========================================================================== */
263
264 /* ---------- */
265 /* IDirect3D8 */
266 /* ---------- */
267
268 /*****************************************************************************
269  * Predeclare the interface implementation structures
270  */
271 extern ICOM_VTABLE(IDirect3D8) Direct3D8_Vtbl;
272
273 /*****************************************************************************
274  * IDirect3D implementation structure
275  */
276 struct IDirect3D8Impl
277 {
278     /* IUnknown fields */
279     ICOM_VFIELD(IDirect3D8);
280     DWORD                   ref;
281
282     /* IDirect3D8 fields */
283     GL_Info                 gl_info;
284     BOOL                    isGLInfoValid;
285     IDirect3D8Impl         *direct3d8;
286 };
287
288 /* IUnknown: */
289 extern HRESULT WINAPI   IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface,REFIID refiid,LPVOID *obj);
290 extern ULONG WINAPI     IDirect3D8Impl_AddRef(LPDIRECT3D8 iface);
291 extern ULONG WINAPI     IDirect3D8Impl_Release(LPDIRECT3D8 iface);
292
293 /* IDirect3d8: */
294 extern HRESULT  WINAPI  IDirect3D8Impl_RegisterSoftwareDevice(LPDIRECT3D8 iface, void* pInitializeFunction);
295 extern UINT     WINAPI  IDirect3D8Impl_GetAdapterCount(LPDIRECT3D8 iface);
296 extern HRESULT  WINAPI  IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier);
297 extern UINT     WINAPI  IDirect3D8Impl_GetAdapterModeCount(LPDIRECT3D8 iface, UINT Adapter);
298 extern HRESULT  WINAPI  IDirect3D8Impl_EnumAdapterModes(LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode);
299 extern HRESULT  WINAPI  IDirect3D8Impl_GetAdapterDisplayMode(LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode);
300 extern HRESULT  WINAPI  IDirect3D8Impl_CheckDeviceType(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
301                                                        D3DFORMAT BackBufferFormat, BOOL Windowed);
302 extern HRESULT  WINAPI  IDirect3D8Impl_CheckDeviceFormat(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
303                                                        DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
304 extern HRESULT  WINAPI  IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
305                                                        BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType);
306 extern HRESULT  WINAPI  IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
307                                                        D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
308 extern HRESULT  WINAPI  IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps);
309 extern HMONITOR WINAPI  IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter);
310 extern HRESULT  WINAPI  IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
311                                                     DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
312                                                     IDirect3DDevice8** ppReturnedDeviceInterface);
313
314 /* ---------------- */
315 /* IDirect3DDevice8 */
316 /* ---------------- */
317
318 /*****************************************************************************
319  * Predeclare the interface implementation structures
320  */
321 extern ICOM_VTABLE(IDirect3DDevice8) Direct3DDevice8_Vtbl;
322
323 /*****************************************************************************
324  * IDirect3DDevice8 implementation structure
325  */
326 struct IDirect3DDevice8Impl
327 {
328     /* IUnknown fields */
329     ICOM_VFIELD(IDirect3DDevice8);
330     DWORD                         ref;
331
332     /* IDirect3DDevice8 fields */
333     IDirect3D8Impl               *direct3d8;
334
335     IDirect3DSurface8Impl        *frontBuffer;
336     IDirect3DSurface8Impl        *backBuffer;
337     IDirect3DSurface8Impl        *depthStencilBuffer;
338
339     IDirect3DSurface8Impl        *renderTarget;
340     IDirect3DSurface8Impl        *stencilBufferTarget;
341
342     D3DPRESENT_PARAMETERS         PresentParms;
343     D3DDEVICE_CREATION_PARAMETERS CreateParms;
344
345     UINT                          adapterNo;
346     D3DDEVTYPE                    devType;
347
348     UINT                          srcBlend;
349     UINT                          dstBlend;
350     UINT                          alphafunc;
351     UINT                          stencilfunc;
352
353     /* State block related */
354     BOOL                          isRecordingState;
355     IDirect3DStateBlockImpl      *StateBlock;
356     IDirect3DStateBlockImpl      *UpdateStateBlock;
357
358     /* palettes texture management */
359     PALETTEENTRY                  palettes[MAX_PALETTES][256];
360     UINT                          currentPalette;
361
362     /* Optimization */
363     BOOL                          modelview_valid;
364     BOOL                          proj_valid;
365     BOOL                          view_ident;        /* true iff view matrix is identity                */
366     BOOL                          last_was_rhw;      /* true iff last draw_primitive was in xyzrhw mode */
367     GLenum                        tracking_parm;     /* Which source is tracking current colour         */
368     LONG                          tracking_color;    /* used iff GL_COLOR_MATERIAL was enabled          */
369       #define                         DISABLED_TRACKING  0  /* Disabled                                 */
370       #define                         IS_TRACKING        1  /* tracking_parm is tracking diffuse color  */
371       #define                         NEEDS_TRACKING     2  /* Tracking needs to be enabled when needed */
372       #define                         NEEDS_DISABLE      3  /* Tracking needs to be disabled when needed*/
373
374     /* OpenGL related */
375     GLXContext                    glCtx;
376     XVisualInfo                  *visInfo;
377     Display                      *display;
378     HWND                          win_handle;
379     Window                        win;
380     GLXContext                    render_ctx;
381     Drawable                      drawable;
382     GLint                         maxConcurrentLights;
383
384     /* OpenGL Extension related */
385
386     /* Cursor management */
387     BOOL                          bCursorVisible;
388     UINT                          xHotSpot;
389     UINT                          yHotSpot;
390     UINT                          xScreenSpace;
391     UINT                          yScreenSpace;
392     GLint                         cursor;
393
394     UINT                          dummyTextureName[8];
395
396     /* For rendering to a texture using glCopyTexImage */
397     BOOL                          renderUpsideDown;
398 };
399
400 /* IUnknown: */
401 extern HRESULT WINAPI   IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 iface, REFIID refiid, LPVOID *obj);
402 extern ULONG WINAPI     IDirect3DDevice8Impl_AddRef(LPDIRECT3DDEVICE8 iface);
403 extern ULONG WINAPI     IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface);
404
405 /* IDirect3DDevice8: */
406 extern HRESULT  WINAPI  IDirect3DDevice8Impl_TestCooperativeLevel(LPDIRECT3DDEVICE8 iface);
407 extern UINT     WINAPI  IDirect3DDevice8Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE8 iface);
408 extern HRESULT  WINAPI  IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3DDEVICE8 iface, DWORD Bytes);
409 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface, IDirect3D8** ppD3D8);
410 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface, D3DCAPS8* pCaps);
411 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetDisplayMode(LPDIRECT3DDEVICE8 iface, D3DDISPLAYMODE* pMode);
412 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetCreationParameters(LPDIRECT3DDEVICE8 iface, D3DDEVICE_CREATION_PARAMETERS* pParameters);
413 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetCursorProperties(LPDIRECT3DDEVICE8 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8* pCursorBitmap);
414 extern void     WINAPI  IDirect3DDevice8Impl_SetCursorPosition(LPDIRECT3DDEVICE8 iface, UINT XScreenSpace, UINT YScreenSpace, DWORD Flags);
415 extern BOOL     WINAPI  IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL bShow);
416 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain);
417 extern HRESULT  WINAPI  IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters);
418 extern HRESULT  WINAPI  IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
419 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetBackBuffer(LPDIRECT3DDEVICE8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer);
420 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus);
421 extern void     WINAPI  IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
422 extern void     WINAPI  IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp);
423 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture8** ppTexture);
424 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture8** ppVolumeTexture);
425 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture);
426 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateVertexBuffer(LPDIRECT3DDEVICE8 iface, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer8** ppVertexBuffer);
427 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateIndexBuffer(LPDIRECT3DDEVICE8 iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer8** ppIndexBuffer);
428 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateRenderTarget(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, IDirect3DSurface8** ppSurface);
429 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, IDirect3DSurface8** ppSurface);
430 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface);
431 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pSourceSurface, CONST RECT* pSourceRectsArray, UINT cRects, IDirect3DSurface8* pDestinationSurface, CONST POINT* pDestPointsArray);
432 extern HRESULT  WINAPI  IDirect3DDevice8Impl_UpdateTexture(LPDIRECT3DDEVICE8 iface, IDirect3DBaseTexture8* pSourceTexture, IDirect3DBaseTexture8* pDestinationTexture);
433 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetFrontBuffer(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pDestSurface);
434 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pRenderTarget, IDirect3DSurface8* pNewZStencil);
435 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppRenderTarget);
436 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppZStencilSurface);
437 extern HRESULT  WINAPI  IDirect3DDevice8Impl_BeginScene(LPDIRECT3DDEVICE8 iface);
438 extern HRESULT  WINAPI  IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface);
439 extern HRESULT  WINAPI  IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil);
440 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
441 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix);
442 extern HRESULT  WINAPI  IDirect3DDevice8Impl_MultiplyTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
443 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetViewport(LPDIRECT3DDEVICE8 iface, CONST D3DVIEWPORT8* pViewport);
444 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetViewport(LPDIRECT3DDEVICE8 iface, D3DVIEWPORT8* pViewport);
445 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetMaterial(LPDIRECT3DDEVICE8 iface, CONST D3DMATERIAL8* pMaterial);
446 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetMaterial(LPDIRECT3DDEVICE8 iface, D3DMATERIAL8* pMaterial);
447 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetLight(LPDIRECT3DDEVICE8 iface, DWORD Index, CONST D3DLIGHT8* pLight);
448 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index, D3DLIGHT8* pLight);
449 extern HRESULT  WINAPI  IDirect3DDevice8Impl_LightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index, BOOL Enable);
450 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index, BOOL* pEnable);
451 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index, CONST float* pPlane);
452 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index, float* pPlane);
453 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State, DWORD Value);
454 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State, DWORD* pValue);
455 extern HRESULT  WINAPI  IDirect3DDevice8Impl_BeginStateBlock(LPDIRECT3DDEVICE8 iface);
456 extern HRESULT  WINAPI  IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface, DWORD* pToken);
457 extern HRESULT  WINAPI  IDirect3DDevice8Impl_ApplyStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token);
458 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CaptureStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token);
459 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token);
460 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateStateBlock(LPDIRECT3DDEVICE8 iface, D3DSTATEBLOCKTYPE Type,DWORD* pToken);
461 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetClipStatus(LPDIRECT3DDEVICE8 iface, CONST D3DCLIPSTATUS8* pClipStatus);
462 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface, D3DCLIPSTATUS8* pClipStatus);
463 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage, IDirect3DBaseTexture8** ppTexture);
464 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage, IDirect3DBaseTexture8* pTexture);
465 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue);
466 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
467 extern HRESULT  WINAPI  IDirect3DDevice8Impl_ValidateDevice(LPDIRECT3DDEVICE8 iface, DWORD* pNumPasses);
468 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetInfo(LPDIRECT3DDEVICE8 iface, DWORD DevInfoID, void* pDevInfoStruct, DWORD DevInfoStructSize);
469 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries);
470 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries);
471 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber);
472 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT *PaletteNumber);
473 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
474 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT minIndex, UINT NumVertices, UINT startIndex, UINT primCount);
475 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
476 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
477 extern HRESULT  WINAPI  IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 iface, UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags);
478 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8 iface, CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage);
479 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD Handle);
480 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD* pHandle);
481 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD Handle);
482 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
483 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register,void* pConstantData,DWORD ConstantCount);
484 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShaderDeclaration(LPDIRECT3DDEVICE8 iface, DWORD Handle,void* pData,DWORD* pSizeOfData);
485 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD Handle,void* pData,DWORD* pSizeOfData);
486 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride);
487 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride);
488 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex);
489 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex);
490 extern HRESULT  WINAPI  IDirect3DDevice8Impl_CreatePixelShader(LPDIRECT3DDEVICE8 iface, CONST DWORD* pFunction,DWORD* pHandle);
491 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD Handle);
492 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD* pHandle);
493 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD Handle);
494 extern HRESULT  WINAPI  IDirect3DDevice8Impl_SetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
495 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register,void* pConstantData,DWORD ConstantCount);
496 extern HRESULT  WINAPI  IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD Handle,void* pData,DWORD* pSizeOfData);
497 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawRectPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo);
498 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DrawTriPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo);
499 extern HRESULT  WINAPI  IDirect3DDevice8Impl_DeletePatch(LPDIRECT3DDEVICE8 iface, UINT Handle);
500
501 /* internal Interfaces */
502 extern HRESULT WINAPI   IDirect3DDevice8Impl_CleanRender(LPDIRECT3DDEVICE8 iface);
503 extern HRESULT WINAPI   IDirect3DDevice8Impl_ActiveRender(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* RenderSurface, IDirect3DSurface8* StencilSurface);
504
505
506 /* ---------------- */
507 /* IDirect3DVolume8 */
508 /* ---------------- */
509
510 /*****************************************************************************
511  * Predeclare the interface implementation structures
512  */
513 extern ICOM_VTABLE(IDirect3DVolume8) Direct3DVolume8_Vtbl;
514
515 /*****************************************************************************
516  * IDirect3DVolume8 implementation structure
517  */
518 struct IDirect3DVolume8Impl
519 {
520     /* IUnknown fields */
521     ICOM_VFIELD(IDirect3DVolume8);
522     DWORD                   ref;
523
524     /* IDirect3DVolume8 fields */
525     IDirect3DDevice8Impl   *Device;
526     D3DRESOURCETYPE         ResourceType;
527
528     IUnknown               *Container;
529     D3DVOLUME_DESC          myDesc;
530     BYTE                   *allocatedMemory;
531     UINT                    textureName;
532     UINT                    bytesPerPixel;
533
534     BOOL                    lockable;
535     BOOL                    locked;
536     D3DBOX                  lockedBox;
537     D3DBOX                  dirtyBox;
538     BOOL                    Dirty;
539 };
540
541 /* IUnknown: */
542 extern HRESULT WINAPI IDirect3DVolume8Impl_QueryInterface(LPDIRECT3DVOLUME8 iface,REFIID refiid,LPVOID *obj);
543 extern ULONG WINAPI   IDirect3DVolume8Impl_AddRef(LPDIRECT3DVOLUME8 iface);
544 extern ULONG WINAPI   IDirect3DVolume8Impl_Release(LPDIRECT3DVOLUME8 iface);
545
546 /* IDirect3DVolume8: */
547 extern HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(LPDIRECT3DVOLUME8 iface, IDirect3DDevice8** ppDevice);
548 extern HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
549 extern HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID  refguid, void* pData, DWORD* pSizeOfData);
550 extern HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid);
551 extern HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void** ppContainer);
552 extern HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DVOLUME_DESC* pDesc);
553 extern HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags);
554 extern HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface);
555
556 /* internal Interfaces */
557 extern HRESULT WINAPI IDirect3DVolume8Impl_CleanDirtyBox(LPDIRECT3DVOLUME8 iface);
558 extern HRESULT WINAPI IDirect3DVolume8Impl_AddDirtyBox(LPDIRECT3DVOLUME8 iface, CONST D3DBOX* pDirtyBox);
559
560 /* ------------------- */
561 /* IDirect3DSwapChain8 */
562 /* ------------------- */
563
564 /*****************************************************************************
565  * Predeclare the interface implementation structures
566  */
567 extern ICOM_VTABLE(IDirect3DSwapChain8) Direct3DSwapChain8_Vtbl;
568
569 /*****************************************************************************
570  * IDirect3DSwapChain8 implementation structure
571  */
572 struct IDirect3DSwapChain8Impl
573 {
574     /* IUnknown fields */
575     ICOM_VFIELD(IDirect3DSwapChain8);
576     DWORD                   ref;
577
578     /* IDirect3DSwapChain8 fields */
579     IDirect3DSurface8Impl  *frontBuffer;
580     IDirect3DSurface8Impl  *backBuffer;
581     IDirect3DSurface8Impl  *depthStencilBuffer;
582     D3DPRESENT_PARAMETERS   PresentParms;
583
584     /* OpenGL/GLX related */
585     GLXContext              swap_ctx;
586     Drawable                swap_drawable;
587 };
588
589 /* IUnknown: */
590 extern HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID refiid, LPVOID *obj);
591 extern ULONG WINAPI   IDirect3DSwapChain8Impl_AddRef(LPDIRECT3DSWAPCHAIN8 iface);
592 extern ULONG WINAPI   IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface);
593
594 /* IDirect3DSwapChain8: */
595 extern HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
596 extern HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer);
597
598
599 /* ----------------- */
600 /* IDirect3DSurface8 */
601 /* ----------------- */
602
603 /*****************************************************************************
604  * Predeclare the interface implementation structures
605  */
606 extern ICOM_VTABLE(IDirect3DSurface8) Direct3DSurface8_Vtbl;
607
608 /*****************************************************************************
609  * IDirect3DSurface8 implementation structure
610  */
611 struct IDirect3DSurface8Impl
612 {
613     /* IUnknown fields */
614     ICOM_VFIELD(IDirect3DSurface8);
615     DWORD                   ref;
616
617     /* IDirect3DSurface8 fields */
618     IDirect3DDevice8Impl   *Device;
619     D3DRESOURCETYPE         ResourceType;
620
621     IUnknown               *Container;
622     D3DSURFACE_DESC         myDesc;
623     BYTE                   *allocatedMemory;
624     UINT                    textureName;
625     UINT                    bytesPerPixel;
626
627     BOOL                    lockable;
628     BOOL                    locked;
629     RECT                    lockedRect;
630     RECT                    dirtyRect;
631     BOOL                    Dirty;
632     BOOL                    inTexture;
633     BOOL                    inPBuffer;
634 };
635
636 /* IUnknown: */
637 extern HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface,REFIID refiid,LPVOID *obj);
638 extern ULONG WINAPI   IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface);
639 extern ULONG WINAPI   IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface);
640
641 /* IDirect3DSurface8: */
642 extern HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect3DDevice8** ppDevice);
643 extern HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
644 extern HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid,void* pData,DWORD* pSizeOfData);
645 extern HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid);
646 extern HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid,void** ppContainer);
647 extern HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc);
648 extern HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect,DWORD Flags);
649 extern HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface);
650
651 /* internal Interfaces */
652 extern HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level);
653 extern HRESULT WINAPI IDirect3DSurface8Impl_SaveSnapshot(LPDIRECT3DSURFACE8 iface, const char* filename);
654 extern HRESULT WINAPI IDirect3DSurface8Impl_CleanDirtyRect(LPDIRECT3DSURFACE8 iface);
655 extern HRESULT WINAPI IDirect3DSurface8Impl_AddDirtyRect(LPDIRECT3DSURFACE8 iface, CONST RECT* pDirtyRect);
656
657 /* ------------------ */
658 /* IDirect3DResource8 */
659 /* ------------------ */
660
661 /*****************************************************************************
662  * Predeclare the interface implementation structures
663  */
664 extern ICOM_VTABLE(IDirect3DResource8) Direct3DResource8_Vtbl;
665
666 /*****************************************************************************
667  * IDirect3DResource8 implementation structure
668  */
669 struct IDirect3DResource8Impl
670 {
671     /* IUnknown fields */
672     ICOM_VFIELD(IDirect3DResource8);
673     DWORD                   ref;
674
675     /* IDirect3DResource8 fields */
676     IDirect3DDevice8Impl   *Device;
677     D3DRESOURCETYPE         ResourceType;
678 };
679
680 /* IUnknown: */
681 extern HRESULT WINAPI         IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface,REFIID refiid,LPVOID *obj);
682 extern ULONG WINAPI           IDirect3DResource8Impl_AddRef(LPDIRECT3DRESOURCE8 iface);
683 extern ULONG WINAPI           IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface);
684
685 /* IDirect3DResource8: */
686 extern HRESULT  WINAPI        IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice);
687 extern HRESULT  WINAPI        IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
688 extern HRESULT  WINAPI        IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
689 extern HRESULT  WINAPI        IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid);
690 extern DWORD    WINAPI        IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew);
691 extern DWORD    WINAPI        IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface);
692 extern void     WINAPI        IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface);
693 extern D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface);
694
695 /* internal Interfaces */
696 extern D3DPOOL WINAPI         IDirect3DResource8Impl_GetPool(LPDIRECT3DRESOURCE8 iface);
697
698
699 /* ---------------------- */
700 /* IDirect3DVertexBuffer8 */
701 /* ---------------------- */
702
703 /*****************************************************************************
704  * Predeclare the interface implementation structures
705  */
706 extern ICOM_VTABLE(IDirect3DVertexBuffer8) Direct3DVertexBuffer8_Vtbl;
707
708 /*****************************************************************************
709  * IDirect3DVertexBuffer8 implementation structure
710  */
711 struct IDirect3DVertexBuffer8Impl
712 {
713     /* IUnknown fields */
714     ICOM_VFIELD(IDirect3DVertexBuffer8);
715     DWORD                   ref;
716
717     /* IDirect3DResource8 fields */
718     IDirect3DDevice8Impl   *Device;
719     D3DRESOURCETYPE         ResourceType;
720
721     /* IDirect3DVertexBuffer8 fields */
722     BYTE                   *allocatedMemory;
723     D3DVERTEXBUFFER_DESC    currentDesc;
724 };
725
726 /* IUnknown: */
727 extern HRESULT WINAPI         IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface,REFIID refiid,LPVOID *obj);
728 extern ULONG WINAPI           IDirect3DVertexBuffer8Impl_AddRef(LPDIRECT3DVERTEXBUFFER8 iface);
729 extern ULONG WINAPI           IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface);
730
731 /* IDirect3DVertexBuffer8: (Inherited from IDirect3DResource8) */
732 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice);
733 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
734 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
735 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid);
736 extern DWORD    WINAPI        IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew);
737 extern DWORD    WINAPI        IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface);
738 extern void     WINAPI        IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface);
739 extern D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface);
740
741 /* IDirect3DVertexBuffer8: */
742 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags);
743 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface);
744 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc);
745
746
747 /* --------------------- */
748 /* IDirect3DIndexBuffer8 */
749 /* --------------------- */
750
751 /*****************************************************************************
752  * Predeclare the interface implementation structures
753  */
754 extern ICOM_VTABLE(IDirect3DIndexBuffer8) Direct3DIndexBuffer8_Vtbl;
755
756 /*****************************************************************************
757  * IDirect3DIndexBuffer8 implementation structure
758  */
759 struct IDirect3DIndexBuffer8Impl
760 {
761     /* IUnknown fields */
762     ICOM_VFIELD(IDirect3DIndexBuffer8);
763     DWORD                   ref;
764
765     /* IDirect3DResource8 fields */
766     IDirect3DDevice8Impl   *Device;
767     D3DRESOURCETYPE         ResourceType;
768
769     /* IDirect3DIndexBuffer8 fields */
770     void                   *allocatedMemory;
771     D3DINDEXBUFFER_DESC     currentDesc;
772 };
773
774 /* IUnknown: */
775 extern HRESULT WINAPI         IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface,REFIID refiid,LPVOID *obj);
776 extern ULONG WINAPI           IDirect3DIndexBuffer8Impl_AddRef(LPDIRECT3DINDEXBUFFER8 iface);
777 extern ULONG WINAPI           IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface);
778
779 /* IDirect3DIndexBuffer8: (Inherited from IDirect3DResource8) */
780 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8** ppDevice);
781 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
782 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
783 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid);
784 extern DWORD    WINAPI        IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew);
785 extern DWORD    WINAPI        IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface);
786 extern void     WINAPI        IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface);
787 extern D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface);
788
789 /* IDirect3DIndexBuffer8: */
790 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags);
791 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface);
792 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc);
793
794
795 /* --------------------- */
796 /* IDirect3DBaseTexture8 */
797 /* --------------------- */
798
799 /*****************************************************************************
800  * Predeclare the interface implementation structures
801  */
802 extern ICOM_VTABLE(IDirect3DBaseTexture8) Direct3DBaseTexture8_Vtbl;
803
804 /*****************************************************************************
805  * IDirect3DBaseTexture8 implementation structure
806  */
807 struct IDirect3DBaseTexture8Impl
808 {
809     /* IUnknown fields */
810     ICOM_VFIELD(IDirect3DBaseTexture8);
811     DWORD                   ref;
812
813     /* IDirect3DResource8 fields */
814     IDirect3DDevice8Impl   *Device;
815     D3DRESOURCETYPE         ResourceType;
816
817     /* IDirect3DBaseTexture8 fields */
818     BOOL                    Dirty;
819     D3DFORMAT               format;
820     UINT                    levels;
821     /*
822      *BOOL                    isManaged;
823      *DWORD                   lod;
824      */
825 };
826
827 /* IUnknown: */
828 extern HRESULT WINAPI         IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface,REFIID refiid,LPVOID *obj);
829 extern ULONG WINAPI           IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface);
830 extern ULONG WINAPI           IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface);
831
832 /* IDirect3DBaseTexture8: (Inherited from IDirect3DResource8) */
833 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetDevice(LPDIRECT3DBASETEXTURE8 iface, IDirect3DDevice8** ppDevice);
834 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_SetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
835 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
836 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid);
837 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew);
838 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface);
839 extern void     WINAPI        IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface);
840 extern D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface);
841
842 /* IDirect3DBaseTexture8: */
843 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetLOD(LPDIRECT3DBASETEXTURE8 iface, DWORD LODNew);
844 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface);
845 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLevelCount(LPDIRECT3DBASETEXTURE8 iface);
846
847 /* internal Interfaces */
848 extern BOOL     WINAPI        IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface);
849 extern BOOL     WINAPI        IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty);
850
851
852 /* --------------------- */
853 /* IDirect3DCubeTexture8 */
854 /* --------------------- */
855
856 /*****************************************************************************
857  * Predeclare the interface implementation structures
858  */
859 extern ICOM_VTABLE(IDirect3DCubeTexture8) Direct3DCubeTexture8_Vtbl;
860
861 /*****************************************************************************
862  * IDirect3DCubeTexture8 implementation structure
863  */
864 struct IDirect3DCubeTexture8Impl
865 {
866     /* IUnknown fields */
867     ICOM_VFIELD(IDirect3DCubeTexture8);
868     DWORD                   ref;
869
870     /* IDirect3DResource8 fields */
871     IDirect3DDevice8Impl   *Device;
872     D3DRESOURCETYPE         ResourceType;
873
874     /* IDirect3DBaseTexture8 fields */
875     BOOL                    Dirty;
876     D3DFORMAT               format;
877     UINT                    levels;
878
879     /* IDirect3DCubeTexture8 fields */
880     UINT                    edgeLength;
881     DWORD                   usage;
882
883     IDirect3DSurface8Impl  *surfaces[6][MAX_LEVELS];
884 };
885
886 /* IUnknown: */
887 extern HRESULT WINAPI         IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEXTURE8 iface,REFIID refiid,LPVOID *obj);
888 extern ULONG WINAPI           IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 iface);
889 extern ULONG WINAPI           IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface);
890
891 /* IDirect3DCubeTexture8: (Inherited from IDirect3DResource8) */
892 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8** ppDevice);
893 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
894 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
895 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid);
896 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew);
897 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface);
898 extern void     WINAPI        IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface);
899 extern D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface);
900
901 /* IDirect3DCubeTexture8: (Inherited from IDirect3DBaseTexture8) */
902 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface, DWORD LODNew);
903 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface);
904 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface);
905
906 /* IDirect3DCubeTexture8 */
907 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc);
908 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface);
909 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
910 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level);
911 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect);
912
913
914 /* ----------------- */
915 /* IDirect3DTexture8 */
916 /* ----------------- */
917
918 /*****************************************************************************
919  * Predeclare the interface implementation structures
920  */
921 extern ICOM_VTABLE(IDirect3DTexture8) Direct3DTexture8_Vtbl;
922
923 /*****************************************************************************
924  * IDirect3DTexture8 implementation structure
925  */
926 struct IDirect3DTexture8Impl
927 {
928     /* IUnknown fields */
929     ICOM_VFIELD(IDirect3DTexture8);
930     DWORD                   ref;
931
932     /* IDirect3DResourc8 fields */
933     IDirect3DDevice8Impl   *Device;
934     D3DRESOURCETYPE         ResourceType;
935
936     /* IDirect3DBaseTexture8 fields */
937     BOOL                    Dirty;
938     D3DFORMAT               format;
939     UINT                    levels;
940
941     /* IDirect3DTexture8 fields */
942     UINT                    width;
943     UINT                    height;
944     DWORD                   usage;
945
946     IDirect3DSurface8Impl  *surfaces[MAX_LEVELS];
947 };
948
949 /* IUnknown: */
950 extern HRESULT WINAPI         IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface,REFIID refiid,LPVOID *obj);
951 extern ULONG WINAPI           IDirect3DTexture8Impl_AddRef(LPDIRECT3DTEXTURE8 iface);
952 extern ULONG WINAPI           IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface);
953
954 /* IDirect3DTexture8: (Inherited from IDirect3DResource8) */
955 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetDevice(LPDIRECT3DTEXTURE8 iface, IDirect3DDevice8** ppDevice);
956 extern HRESULT  WINAPI        IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
957 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
958 extern HRESULT  WINAPI        IDirect3DTexture8Impl_FreePrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid);
959 extern DWORD    WINAPI        IDirect3DTexture8Impl_SetPriority(LPDIRECT3DTEXTURE8 iface, DWORD PriorityNew);
960 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface);
961 extern void     WINAPI        IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface);
962 extern D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface);
963
964 /* IDirect3DTexture8: (Inherited from IDirect3DBaseTexture8) */
965 extern DWORD    WINAPI        IDirect3DTexture8Impl_SetLOD(LPDIRECT3DTEXTURE8 iface, DWORD LODNew);
966 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetLOD(LPDIRECT3DTEXTURE8 iface);
967 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetLevelCount(LPDIRECT3DTEXTURE8 iface);
968
969 /* IDirect3DTexture8: */
970 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc);
971 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level, IDirect3DSurface8** ppSurfaceLevel);
972 extern HRESULT  WINAPI        IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
973 extern HRESULT  WINAPI        IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level);
974 extern HRESULT  WINAPI        IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect);
975
976
977 /* ----------------------- */
978 /* IDirect3DVolumeTexture8 */
979 /* ----------------------- */
980
981 /*****************************************************************************
982  * Predeclare the interface implementation structures
983  */
984 extern ICOM_VTABLE(IDirect3DVolumeTexture8) Direct3DVolumeTexture8_Vtbl;
985
986 /*****************************************************************************
987  * IDirect3DVolumeTexture8 implementation structure
988  */
989 struct IDirect3DVolumeTexture8Impl
990 {
991     /* IUnknown fields */
992     ICOM_VFIELD(IDirect3DVolumeTexture8);
993     DWORD                   ref;
994
995     /* IDirect3DResource8 fields */
996     IDirect3DDevice8Impl   *Device;
997     D3DRESOURCETYPE         ResourceType;
998
999     /* IDirect3DBaseTexture8 fields */
1000     BOOL                    Dirty;
1001     D3DFORMAT               format;
1002     UINT                    levels;
1003
1004     /* IDirect3DVolumeTexture8 fields */
1005     UINT                    width;
1006     UINT                    height;
1007     UINT                    depth;
1008     DWORD                   usage;
1009
1010     IDirect3DVolume8Impl   *volumes[MAX_LEVELS];
1011 };
1012
1013 /* IUnknown: */
1014 extern HRESULT WINAPI         IDirect3DVolumeTexture8Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE8 iface,REFIID refiid,LPVOID *obj);
1015 extern ULONG WINAPI           IDirect3DVolumeTexture8Impl_AddRef(LPDIRECT3DVOLUMETEXTURE8 iface);
1016 extern ULONG WINAPI           IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface);
1017
1018 /* IDirect3DVolumeTexture8: (Inherited from IDirect3DResource8) */
1019 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE8 iface, IDirect3DDevice8** ppDevice);
1020 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
1021 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
1022 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid);
1023 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD PriorityNew);
1024 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE8 iface);
1025 extern void     WINAPI        IDirect3DVolumeTexture8Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE8 iface);
1026 extern D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(LPDIRECT3DVOLUMETEXTURE8 iface);
1027
1028 /* IDirect3DVolumeTexture8: (Inherited from IDirect3DBaseTexture8) */
1029 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD LODNew);
1030 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE8 iface);
1031 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE8 iface);
1032
1033 /* IDirect3DVolumeTexture8: */
1034 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DVOLUME_DESC *pDesc);
1035 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8** ppVolumeLevel);
1036 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags);
1037 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level);
1038 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX* pDirtyBox);
1039
1040
1041 /* ==============================================================================
1042     Private interfactes: beginning of cleaning/splitting for HAL and d3d9 support
1043    ============================================================================== */
1044
1045 /* State Block for Begin/End/Capture/Create/Apply State Block   */
1046 /*   Note: Very long winded but I do not believe gl Lists will  */
1047 /*   resolve everything we need, so doing it manually for now   */
1048 typedef struct SAVEDSTATES {
1049         BOOL                      Indices;
1050         BOOL                      material;
1051         BOOL                      stream_source[MAX_STREAMS];
1052         BOOL                      textures[8];
1053         BOOL                      transform[HIGHEST_TRANSFORMSTATE];
1054         BOOL                      viewport;
1055         BOOL                      vertexShader;
1056         BOOL                      vertexShaderConstant;
1057         BOOL                      vertexShaderDecl;
1058         BOOL                      pixelShader;
1059         BOOL                      pixelShaderConstant;
1060         BOOL                      renderstate[HIGHEST_RENDER_STATE];
1061         BOOL                      texture_state[8][HIGHEST_TEXTURE_STATE];
1062         BOOL                      clipplane[MAX_CLIPPLANES];
1063 } SAVEDSTATES;
1064
1065
1066 /* ----------------------- */
1067 /* IDirect3DStateBlockImpl */
1068 /* ----------------------- */
1069
1070 /*****************************************************************************
1071  * Predeclare the interface implementation structures
1072  */
1073 /*extern ICOM_VTABLE(IDirect3DStateBlock9) Direct3DStateBlock9_Vtbl;*/
1074
1075 /*****************************************************************************
1076  * IDirect3DStateBlock implementation structure
1077  */
1078 struct  IDirect3DStateBlockImpl {
1079   /* IUnknown fields */
1080   /*ICOM_VFIELD(IDirect3DStateBlock9);*/
1081   DWORD  ref;
1082
1083   /* The device, to be replaced by a IDirect3DDeviceImpl */
1084   IDirect3DDevice8Impl* device;
1085
1086   D3DSTATEBLOCKTYPE         blockType;
1087
1088   SAVEDSTATES               Changed;
1089   SAVEDSTATES               Set;
1090   
1091   /* ClipPlane */
1092   double                    clipplane[MAX_CLIPPLANES][4];
1093   
1094   /* Stream Source */
1095   UINT                      stream_stride[MAX_STREAMS];
1096   IDirect3DVertexBuffer8   *stream_source[MAX_STREAMS];
1097   BOOL                      streamIsUP;
1098
1099   /* Indices */
1100   IDirect3DIndexBuffer8*    pIndexData;
1101   UINT                      baseVertexIndex;
1102   
1103   /* Texture */
1104   IDirect3DBaseTexture8    *textures[8];
1105   int                       textureDimensions[8];
1106   /* Texture State Stage */
1107   DWORD                     texture_state[8][HIGHEST_TEXTURE_STATE];
1108   
1109   /* Lights */
1110   PLIGHTINFOEL             *lights; /* NOTE: active GL lights must be front of the chain */
1111   
1112   /* Material */
1113   D3DMATERIAL8              material;
1114   
1115   /* RenderState */
1116   DWORD                     renderstate[HIGHEST_RENDER_STATE];
1117   
1118   /* Transform */
1119   D3DMATRIX                 transforms[HIGHEST_TRANSFORMSTATE];
1120   
1121   /* ViewPort */
1122   D3DVIEWPORT8              viewport;
1123   
1124   /* Vertex Shader */
1125   DWORD                     VertexShader;
1126
1127   /* Vertex Shader Declaration */
1128   IDirect3DVertexShaderDeclarationImpl* vertexShaderDecl;
1129   
1130   /* Pixel Shader */
1131   DWORD                     PixelShader;
1132   
1133   /* Indexed Vertex Blending */
1134   D3DVERTEXBLENDFLAGS       vertex_blend;
1135   FLOAT                     tween_factor;
1136
1137   /* Vertex Shader Constant */
1138   D3DSHADERVECTOR           vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
1139   /* Pixel Shader Constant */
1140   D3DSHADERVECTOR           pixelShaderConstant[D3D8_PSHADER_MAX_CONSTANTS];
1141 };
1142
1143 /* exported Interfaces */
1144 /* internal Interfaces */
1145 /* temporary internal Interfaces */
1146 extern HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* This);
1147 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateStateBlock(IDirect3DDevice8Impl* This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlockImpl** ppStateBlock);
1148 extern HRESULT WINAPI IDirect3DDeviceImpl_DeleteStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
1149 extern HRESULT WINAPI IDirect3DDeviceImpl_BeginStateBlock(IDirect3DDevice8Impl* This);
1150 extern HRESULT WINAPI IDirect3DDeviceImpl_EndStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl** ppStateBlock);
1151 extern HRESULT WINAPI IDirect3DDeviceImpl_ApplyStateBlock(IDirect3DDevice8Impl* iface, IDirect3DStateBlockImpl* pSB);
1152 extern HRESULT WINAPI IDirect3DDeviceImpl_CaptureStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
1153
1154 /* ------------------------------------ */
1155 /* IDirect3DVertexShaderDeclarationImpl */
1156 /* ------------------------------------ */
1157
1158 /*****************************************************************************
1159  * Predeclare the interface implementation structures
1160  */
1161 /*extern ICOM_VTABLE(IDirect3DVertexShaderDeclaration9) Direct3DVertexShaderDeclaration9_Vtbl;*/
1162
1163 /*****************************************************************************
1164  * IDirect3DVertexShaderDeclaration implementation structure
1165  */
1166 struct IDirect3DVertexShaderDeclarationImpl {
1167   /* IUnknown fields */
1168   /*ICOM_VFIELD(IDirect3DVertexShaderDeclaration9);*/
1169   DWORD  ref;
1170
1171   /* The device, to be replaced by a IDirect3DDeviceImpl */
1172   IDirect3DDevice8Impl* device;
1173
1174   /** precomputed fvf if simple declaration */
1175   DWORD   fvf[MAX_STREAMS];
1176   DWORD   allFVF;
1177
1178   /** dx8 compatible Declaration fields */
1179   DWORD*  pDeclaration8;
1180   DWORD   declaration8Length;
1181 };
1182
1183 /* exported Interfaces */
1184 extern HRESULT WINAPI IDirect3DVertexShaderDeclarationImpl_GetDeclaration8(IDirect3DVertexShaderDeclarationImpl* This, DWORD* pData, UINT* pSizeOfData);
1185 /*extern HRESULT IDirect3DVertexShaderDeclarationImpl_GetDeclaration9(IDirect3DVertexShaderDeclarationImpl* This, D3DVERTEXELEMENT9* pData, UINT* pNumElements);*/
1186 /* internal Interfaces */
1187 /* temporary internal Interfaces */
1188 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevice8Impl* This, CONST DWORD* pDeclaration8, IDirect3DVertexShaderDeclarationImpl** ppVertexShaderDecl);
1189
1190
1191 /* ------------------------- */
1192 /* IDirect3DVertexShaderImpl */
1193 /* ------------------------- */
1194
1195 /*****************************************************************************
1196  * Predeclare the interface implementation structures
1197  */
1198 /*extern ICOM_VTABLE(IDirect3DVertexShader9) Direct3DVertexShader9_Vtbl;*/
1199
1200 /*****************************************************************************
1201  * IDirect3DVertexShader implementation structure
1202  */
1203 struct IDirect3DVertexShaderImpl {
1204   /*ICOM_VFIELD(IDirect3DVertexShader9);*/
1205   DWORD ref;
1206
1207   /* The device, to be replaced by a IDirect3DDeviceImpl */
1208   IDirect3DDevice8Impl* device;
1209
1210   DWORD* function;
1211   UINT functionLength;
1212   DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
1213   DWORD version;
1214   
1215   /** fields for hw vertex shader use */
1216   GLuint  prgId;
1217
1218   /* run time datas */
1219   VSHADERDATA8* data;
1220   VSHADERINPUTDATA8 input;
1221   VSHADEROUTPUTDATA8 output;
1222 };
1223
1224 /* exported Interfaces */
1225 extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetFunction(IDirect3DVertexShaderImpl* This, VOID* pData, UINT* pSizeOfData);
1226 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST BOOL*  pConstantData, UINT BoolCount);*/
1227 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST INT*   pConstantData, UINT Vector4iCount);*/
1228 extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount);
1229 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, BOOL*  pConstantData, UINT BoolCount);*/
1230 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, INT*   pConstantData, UINT Vector4iCount);*/
1231 extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount);
1232 /* internal Interfaces */
1233 extern DWORD WINAPI IDirect3DVertexShaderImpl_GetVersion(IDirect3DVertexShaderImpl* This);
1234 extern HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* This, VSHADERINPUTDATA8* input, VSHADEROUTPUTDATA8* output);
1235 /* temporary internal Interfaces */
1236 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, DWORD Usage, IDirect3DVertexShaderImpl** ppVertexShader);
1237 extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader,  DWORD SkipnStrides);
1238 extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader,  DWORD SkipnStrides);
1239
1240 /* ------------------------ */
1241 /* IDirect3DPixelShaderImpl */
1242 /* ------------------------ */
1243
1244 /*****************************************************************************
1245  * Predeclare the interface implementation structures
1246  */
1247 /*extern ICOM_VTABLE(IDirect3DPixelShader9) Direct3DPixelShader9_Vtbl;*/
1248
1249 /*****************************************************************************
1250  * IDirect3DPixelShader implementation structure
1251  */
1252 struct IDirect3DPixelShaderImpl { 
1253   /*ICOM_VFIELD(IDirect3DPixelShader9);*/
1254   DWORD ref;
1255
1256   /* The device, to be replaced by a IDirect3DDeviceImpl */
1257   IDirect3DDevice8Impl* device;
1258
1259   DWORD* function;
1260   UINT functionLength;
1261   DWORD version;
1262   /* run time datas */
1263   PSHADERDATA8* data;
1264   PSHADERINPUTDATA8 input;
1265   PSHADEROUTPUTDATA8 output;
1266 };
1267
1268 /* exported Interfaces */
1269 extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData);
1270 /* internal Interfaces */
1271 extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl* This);
1272 /* temporary internal Interfaces */
1273 extern HRESULT WINAPI IDirect3DDeviceImpl_CreatePixelShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, IDirect3DPixelShaderImpl** ppPixelShader);
1274
1275
1276 /**
1277  * Internals functions
1278  *
1279  * to see how not defined it here
1280  */ 
1281 void   GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
1282 void   setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage, DWORD Flags);
1283 void   set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
1284
1285 SHORT  D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1286 GLint  D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1287 GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1288 GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1289
1290 GLenum D3DFmt2GLDepthFmt(D3DFORMAT fmt);
1291 GLenum D3DFmt2GLDepthType(D3DFORMAT fmt);
1292
1293 int D3DPrimitiveListGetVertexSize(D3DPRIMITIVETYPE PrimitiveType, int iNumPrim);
1294 int D3DPrimitive2GLenum(D3DPRIMITIVETYPE PrimitiveType);
1295 int D3DFVFGetSize(D3DFORMAT fvf);
1296
1297 int SOURCEx_RGB_EXT(DWORD arg);
1298 int OPERANDx_RGB_EXT(DWORD arg);
1299 int SOURCEx_ALPHA_EXT(DWORD arg);
1300 int OPERANDx_ALPHA_EXT(DWORD arg);
1301 GLenum StencilOp(DWORD op);
1302
1303 /**
1304  * Internals debug functions
1305  */
1306 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
1307 const char* debug_d3dusage(DWORD usage);
1308 const char* debug_d3dformat(D3DFORMAT fmt);
1309 const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
1310 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
1311 const char* debug_d3dpool(D3DPOOL Pool);
1312 const char *debug_d3drenderstate(DWORD State);
1313 const char *debug_d3dtexturestate(DWORD State);
1314
1315 /* Some #defines for additional diagnostics */
1316 #if 0 /* NOTE: Must be 0 in cvs */
1317   /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
1318      of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
1319      is enabled, and if it doesn't exists it is disabled.                                           */
1320 # define FRAME_DEBUGGING
1321   /*  Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
1322       the file is deleted                                                                            */
1323 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
1324 #  define SINGLE_FRAME_DEBUGGING
1325 # endif  
1326   /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
1327      It can only be enabled when FRAME_DEBUGGING is also enabled                               
1328      The contents of the back buffer are written into /tmp/backbuffer_* after each primitive 
1329      array is drawn.                                                                            */
1330 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */                                                                                       
1331 #  define SHOW_FRAME_MAKEUP 1
1332 # endif  
1333   /* The following, when enabled, lets you see the makeup of the all the textures used during each
1334      of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
1335      The contents of the textures assigned to each stage are written into 
1336      /tmp/texture_*_<Stage>.ppm after each primitive array is drawn.                            */
1337 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
1338 #  define SHOW_TEXTURE_MAKEUP 0
1339 # endif  
1340 extern BOOL isOn;
1341 extern BOOL isDumpingFrames;
1342 extern LONG primCounter;
1343 #endif
1344
1345 /* Per-vertex trace: */
1346 #if 0 /* NOTE: Must be 0 in cvs */
1347 # define VTRACE(A) TRACE A
1348 #else 
1349 # define VTRACE(A) 
1350 #endif
1351
1352 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
1353 #define TRACE_STRIDED(sd,name) TRACE( #name "=(data:%p, stride:%ld, type:%ld)\n", sd->u.s.name.lpData, sd->u.s.name.dwStride, sd->u.s.name.dwType);
1354
1355 #define DUMP_LIGHT_CHAIN()                    \
1356 {                                             \
1357   PLIGHTINFOEL *el = This->StateBlock->lights;\
1358   while (el) {                                \
1359     TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
1360     el = el->next;                            \
1361   }                                           \
1362 }
1363
1364 #endif /* __WINE_D3DX8_PRIVATE_H */