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