Improve {Uninstall,Install}ColorProfile{A,W}.
[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 IDirect3D8Vtbl Direct3D8_Vtbl;
278
279 /*****************************************************************************
280  * IDirect3D implementation structure
281  */
282 struct IDirect3D8Impl
283 {
284     /* IUnknown fields */
285     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 IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl;
331
332 /*****************************************************************************
333  * IDirect3DDevice8 implementation structure
334  */
335 struct IDirect3DDevice8Impl
336 {
337     /* IUnknown fields */
338     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 IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl;
526
527 /*****************************************************************************
528  * IDirect3DVolume8 implementation structure
529  */
530 struct IDirect3DVolume8Impl
531 {
532     /* IUnknown fields */
533     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 IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl;
580
581 /*****************************************************************************
582  * IDirect3DSwapChain8 implementation structure
583  */
584 struct IDirect3DSwapChain8Impl
585 {
586     /* IUnknown fields */
587     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 IDirect3DSurface8Vtbl Direct3DSurface8_Vtbl;
619
620 /*****************************************************************************
621  * IDirect3DSurface8 implementation structure
622  */
623 struct IDirect3DSurface8Impl
624 {
625     /* IUnknown fields */
626     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
648 /* IUnknown: */
649 extern HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface,REFIID refiid,LPVOID *obj);
650 extern ULONG WINAPI   IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface);
651 extern ULONG WINAPI   IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface);
652
653 /* IDirect3DSurface8: */
654 extern HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect3DDevice8** ppDevice);
655 extern HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
656 extern HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid,void* pData,DWORD* pSizeOfData);
657 extern HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid);
658 extern HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid,void** ppContainer);
659 extern HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc);
660 extern HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect,DWORD Flags);
661 extern HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface);
662
663 /* internal Interfaces */
664 extern HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level);
665 extern HRESULT WINAPI IDirect3DSurface8Impl_SaveSnapshot(LPDIRECT3DSURFACE8 iface, const char* filename);
666 extern HRESULT WINAPI IDirect3DSurface8Impl_CleanDirtyRect(LPDIRECT3DSURFACE8 iface);
667 extern HRESULT WINAPI IDirect3DSurface8Impl_AddDirtyRect(LPDIRECT3DSURFACE8 iface, CONST RECT* pDirtyRect);
668
669 /* ------------------ */
670 /* IDirect3DResource8 */
671 /* ------------------ */
672
673 /*****************************************************************************
674  * Predeclare the interface implementation structures
675  */
676 extern IDirect3DResource8Vtbl Direct3DResource8_Vtbl;
677
678 /*****************************************************************************
679  * IDirect3DResource8 implementation structure
680  */
681 struct IDirect3DResource8Impl
682 {
683     /* IUnknown fields */
684     IDirect3DResource8Vtbl *lpVtbl;
685     DWORD                   ref;
686
687     /* IDirect3DResource8 fields */
688     IDirect3DDevice8Impl   *Device;
689     D3DRESOURCETYPE         ResourceType;
690 };
691
692 /* IUnknown: */
693 extern HRESULT WINAPI         IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface,REFIID refiid,LPVOID *obj);
694 extern ULONG WINAPI           IDirect3DResource8Impl_AddRef(LPDIRECT3DRESOURCE8 iface);
695 extern ULONG WINAPI           IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface);
696
697 /* IDirect3DResource8: */
698 extern HRESULT  WINAPI        IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice);
699 extern HRESULT  WINAPI        IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
700 extern HRESULT  WINAPI        IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
701 extern HRESULT  WINAPI        IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid);
702 extern DWORD    WINAPI        IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew);
703 extern DWORD    WINAPI        IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface);
704 extern void     WINAPI        IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface);
705 extern D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface);
706
707 /* internal Interfaces */
708 extern D3DPOOL WINAPI         IDirect3DResource8Impl_GetPool(LPDIRECT3DRESOURCE8 iface);
709
710
711 /* ---------------------- */
712 /* IDirect3DVertexBuffer8 */
713 /* ---------------------- */
714
715 /*****************************************************************************
716  * Predeclare the interface implementation structures
717  */
718 extern IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl;
719
720 /*****************************************************************************
721  * IDirect3DVertexBuffer8 implementation structure
722  */
723 struct IDirect3DVertexBuffer8Impl
724 {
725     /* IUnknown fields */
726     IDirect3DVertexBuffer8Vtbl *lpVtbl;
727     DWORD                   ref;
728
729     /* IDirect3DResource8 fields */
730     IDirect3DDevice8Impl   *Device;
731     D3DRESOURCETYPE         ResourceType;
732
733     /* IDirect3DVertexBuffer8 fields */
734     BYTE                   *allocatedMemory;
735     D3DVERTEXBUFFER_DESC    currentDesc;
736 };
737
738 /* IUnknown: */
739 extern HRESULT WINAPI         IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface,REFIID refiid,LPVOID *obj);
740 extern ULONG WINAPI           IDirect3DVertexBuffer8Impl_AddRef(LPDIRECT3DVERTEXBUFFER8 iface);
741 extern ULONG WINAPI           IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface);
742
743 /* IDirect3DVertexBuffer8: (Inherited from IDirect3DResource8) */
744 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice);
745 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
746 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
747 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid);
748 extern DWORD    WINAPI        IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew);
749 extern DWORD    WINAPI        IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface);
750 extern void     WINAPI        IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface);
751 extern D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface);
752
753 /* IDirect3DVertexBuffer8: */
754 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags);
755 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface);
756 extern HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc);
757
758
759 /* --------------------- */
760 /* IDirect3DIndexBuffer8 */
761 /* --------------------- */
762
763 /*****************************************************************************
764  * Predeclare the interface implementation structures
765  */
766 extern IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl;
767
768 /*****************************************************************************
769  * IDirect3DIndexBuffer8 implementation structure
770  */
771 struct IDirect3DIndexBuffer8Impl
772 {
773     /* IUnknown fields */
774     IDirect3DIndexBuffer8Vtbl *lpVtbl;
775     DWORD                   ref;
776
777     /* IDirect3DResource8 fields */
778     IDirect3DDevice8Impl   *Device;
779     D3DRESOURCETYPE         ResourceType;
780
781     /* IDirect3DIndexBuffer8 fields */
782     void                   *allocatedMemory;
783     D3DINDEXBUFFER_DESC     currentDesc;
784 };
785
786 /* IUnknown: */
787 extern HRESULT WINAPI         IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface,REFIID refiid,LPVOID *obj);
788 extern ULONG WINAPI           IDirect3DIndexBuffer8Impl_AddRef(LPDIRECT3DINDEXBUFFER8 iface);
789 extern ULONG WINAPI           IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface);
790
791 /* IDirect3DIndexBuffer8: (Inherited from IDirect3DResource8) */
792 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8** ppDevice);
793 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
794 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
795 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid);
796 extern DWORD    WINAPI        IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew);
797 extern DWORD    WINAPI        IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface);
798 extern void     WINAPI        IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface);
799 extern D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface);
800
801 /* IDirect3DIndexBuffer8: */
802 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags);
803 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface);
804 extern HRESULT  WINAPI        IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc);
805
806
807 /* --------------------- */
808 /* IDirect3DBaseTexture8 */
809 /* --------------------- */
810
811 /*****************************************************************************
812  * Predeclare the interface implementation structures
813  */
814 extern IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl;
815
816 /*****************************************************************************
817  * IDirect3DBaseTexture8 implementation structure
818  */
819 struct IDirect3DBaseTexture8Impl
820 {
821     /* IUnknown fields */
822     IDirect3DBaseTexture8Vtbl *lpVtbl;
823     DWORD                   ref;
824
825     /* IDirect3DResource8 fields */
826     IDirect3DDevice8Impl   *Device;
827     D3DRESOURCETYPE         ResourceType;
828
829     /* IDirect3DBaseTexture8 fields */
830     BOOL                    Dirty;
831     D3DFORMAT               format;
832     UINT                    levels;
833     /*
834      *BOOL                    isManaged;
835      *DWORD                   lod;
836      */
837 };
838
839 /* IUnknown: */
840 extern HRESULT WINAPI         IDirect3DBaseTexture8Impl_QueryInterface(LPDIRECT3DBASETEXTURE8 iface,REFIID refiid,LPVOID *obj);
841 extern ULONG WINAPI           IDirect3DBaseTexture8Impl_AddRef(LPDIRECT3DBASETEXTURE8 iface);
842 extern ULONG WINAPI           IDirect3DBaseTexture8Impl_Release(LPDIRECT3DBASETEXTURE8 iface);
843
844 /* IDirect3DBaseTexture8: (Inherited from IDirect3DResource8) */
845 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetDevice(LPDIRECT3DBASETEXTURE8 iface, IDirect3DDevice8** ppDevice);
846 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_SetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
847 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_GetPrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
848 extern HRESULT  WINAPI        IDirect3DBaseTexture8Impl_FreePrivateData(LPDIRECT3DBASETEXTURE8 iface, REFGUID refguid);
849 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetPriority(LPDIRECT3DBASETEXTURE8 iface, DWORD PriorityNew);
850 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetPriority(LPDIRECT3DBASETEXTURE8 iface);
851 extern void     WINAPI        IDirect3DBaseTexture8Impl_PreLoad(LPDIRECT3DBASETEXTURE8 iface);
852 extern D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface);
853
854 /* IDirect3DBaseTexture8: */
855 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_SetLOD(LPDIRECT3DBASETEXTURE8 iface, DWORD LODNew);
856 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLOD(LPDIRECT3DBASETEXTURE8 iface);
857 extern DWORD    WINAPI        IDirect3DBaseTexture8Impl_GetLevelCount(LPDIRECT3DBASETEXTURE8 iface);
858
859 /* internal Interfaces */
860 extern BOOL     WINAPI        IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface);
861 extern BOOL     WINAPI        IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty);
862
863
864 /* --------------------- */
865 /* IDirect3DCubeTexture8 */
866 /* --------------------- */
867
868 /*****************************************************************************
869  * Predeclare the interface implementation structures
870  */
871 extern IDirect3DCubeTexture8Vtbl Direct3DCubeTexture8_Vtbl;
872
873 /*****************************************************************************
874  * IDirect3DCubeTexture8 implementation structure
875  */
876 struct IDirect3DCubeTexture8Impl
877 {
878     /* IUnknown fields */
879     IDirect3DCubeTexture8Vtbl *lpVtbl;
880     DWORD                   ref;
881
882     /* IDirect3DResource8 fields */
883     IDirect3DDevice8Impl   *Device;
884     D3DRESOURCETYPE         ResourceType;
885
886     /* IDirect3DBaseTexture8 fields */
887     BOOL                    Dirty;
888     D3DFORMAT               format;
889     UINT                    levels;
890
891     /* IDirect3DCubeTexture8 fields */
892     UINT                    edgeLength;
893     DWORD                   usage;
894
895     IDirect3DSurface8Impl  *surfaces[6][MAX_LEVELS];
896 };
897
898 /* IUnknown: */
899 extern HRESULT WINAPI         IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEXTURE8 iface,REFIID refiid,LPVOID *obj);
900 extern ULONG WINAPI           IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 iface);
901 extern ULONG WINAPI           IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface);
902
903 /* IDirect3DCubeTexture8: (Inherited from IDirect3DResource8) */
904 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8** ppDevice);
905 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
906 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
907 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid);
908 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew);
909 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface);
910 extern void     WINAPI        IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface);
911 extern D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface);
912
913 /* IDirect3DCubeTexture8: (Inherited from IDirect3DBaseTexture8) */
914 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface, DWORD LODNew);
915 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface);
916 extern DWORD    WINAPI        IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface);
917
918 /* IDirect3DCubeTexture8 */
919 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc);
920 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface);
921 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
922 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level);
923 extern HRESULT  WINAPI        IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect);
924
925
926 /* ----------------- */
927 /* IDirect3DTexture8 */
928 /* ----------------- */
929
930 /*****************************************************************************
931  * Predeclare the interface implementation structures
932  */
933 extern IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl;
934
935 /*****************************************************************************
936  * IDirect3DTexture8 implementation structure
937  */
938 struct IDirect3DTexture8Impl
939 {
940     /* IUnknown fields */
941     IDirect3DTexture8Vtbl  *lpVtbl;
942     DWORD                   ref;
943
944     /* IDirect3DResourc8 fields */
945     IDirect3DDevice8Impl   *Device;
946     D3DRESOURCETYPE         ResourceType;
947
948     /* IDirect3DBaseTexture8 fields */
949     BOOL                    Dirty;
950     D3DFORMAT               format;
951     UINT                    levels;
952
953     /* IDirect3DTexture8 fields */
954     UINT                    width;
955     UINT                    height;
956     DWORD                   usage;
957
958     IDirect3DSurface8Impl  *surfaces[MAX_LEVELS];
959 };
960
961 /* IUnknown: */
962 extern HRESULT WINAPI         IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface,REFIID refiid,LPVOID *obj);
963 extern ULONG WINAPI           IDirect3DTexture8Impl_AddRef(LPDIRECT3DTEXTURE8 iface);
964 extern ULONG WINAPI           IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface);
965
966 /* IDirect3DTexture8: (Inherited from IDirect3DResource8) */
967 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetDevice(LPDIRECT3DTEXTURE8 iface, IDirect3DDevice8** ppDevice);
968 extern HRESULT  WINAPI        IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
969 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
970 extern HRESULT  WINAPI        IDirect3DTexture8Impl_FreePrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid);
971 extern DWORD    WINAPI        IDirect3DTexture8Impl_SetPriority(LPDIRECT3DTEXTURE8 iface, DWORD PriorityNew);
972 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface);
973 extern void     WINAPI        IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface);
974 extern D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface);
975
976 /* IDirect3DTexture8: (Inherited from IDirect3DBaseTexture8) */
977 extern DWORD    WINAPI        IDirect3DTexture8Impl_SetLOD(LPDIRECT3DTEXTURE8 iface, DWORD LODNew);
978 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetLOD(LPDIRECT3DTEXTURE8 iface);
979 extern DWORD    WINAPI        IDirect3DTexture8Impl_GetLevelCount(LPDIRECT3DTEXTURE8 iface);
980
981 /* IDirect3DTexture8: */
982 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc);
983 extern HRESULT  WINAPI        IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level, IDirect3DSurface8** ppSurfaceLevel);
984 extern HRESULT  WINAPI        IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags);
985 extern HRESULT  WINAPI        IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level);
986 extern HRESULT  WINAPI        IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect);
987
988
989 /* ----------------------- */
990 /* IDirect3DVolumeTexture8 */
991 /* ----------------------- */
992
993 /*****************************************************************************
994  * Predeclare the interface implementation structures
995  */
996 extern IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl;
997
998 /*****************************************************************************
999  * IDirect3DVolumeTexture8 implementation structure
1000  */
1001 struct IDirect3DVolumeTexture8Impl
1002 {
1003     /* IUnknown fields */
1004     IDirect3DVolumeTexture8Vtbl *lpVtbl;
1005     DWORD                   ref;
1006
1007     /* IDirect3DResource8 fields */
1008     IDirect3DDevice8Impl   *Device;
1009     D3DRESOURCETYPE         ResourceType;
1010
1011     /* IDirect3DBaseTexture8 fields */
1012     BOOL                    Dirty;
1013     D3DFORMAT               format;
1014     UINT                    levels;
1015
1016     /* IDirect3DVolumeTexture8 fields */
1017     UINT                    width;
1018     UINT                    height;
1019     UINT                    depth;
1020     DWORD                   usage;
1021
1022     IDirect3DVolume8Impl   *volumes[MAX_LEVELS];
1023 };
1024
1025 /* IUnknown: */
1026 extern HRESULT WINAPI         IDirect3DVolumeTexture8Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE8 iface,REFIID refiid,LPVOID *obj);
1027 extern ULONG WINAPI           IDirect3DVolumeTexture8Impl_AddRef(LPDIRECT3DVOLUMETEXTURE8 iface);
1028 extern ULONG WINAPI           IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface);
1029
1030 /* IDirect3DVolumeTexture8: (Inherited from IDirect3DResource8) */
1031 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE8 iface, IDirect3DDevice8** ppDevice);
1032 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags);
1033 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData);
1034 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid);
1035 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD PriorityNew);
1036 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE8 iface);
1037 extern void     WINAPI        IDirect3DVolumeTexture8Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE8 iface);
1038 extern D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(LPDIRECT3DVOLUMETEXTURE8 iface);
1039
1040 /* IDirect3DVolumeTexture8: (Inherited from IDirect3DBaseTexture8) */
1041 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD LODNew);
1042 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE8 iface);
1043 extern DWORD    WINAPI        IDirect3DVolumeTexture8Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE8 iface);
1044
1045 /* IDirect3DVolumeTexture8: */
1046 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DVOLUME_DESC *pDesc);
1047 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8** ppVolumeLevel);
1048 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags);
1049 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level);
1050 extern HRESULT  WINAPI        IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX* pDirtyBox);
1051
1052
1053 /* ==============================================================================
1054     Private interfactes: beginning of cleaning/splitting for HAL and d3d9 support
1055    ============================================================================== */
1056
1057 /* State Block for Begin/End/Capture/Create/Apply State Block   */
1058 /*   Note: Very long winded but I do not believe gl Lists will  */
1059 /*   resolve everything we need, so doing it manually for now   */
1060 typedef struct SAVEDSTATES {
1061         BOOL                      Indices;
1062         BOOL                      material;
1063         BOOL                      stream_source[MAX_STREAMS];
1064         BOOL                      textures[8];
1065         BOOL                      transform[HIGHEST_TRANSFORMSTATE];
1066         BOOL                      viewport;
1067         BOOL                      vertexShader;
1068         BOOL                      vertexShaderConstant;
1069         BOOL                      vertexShaderDecl;
1070         BOOL                      pixelShader;
1071         BOOL                      pixelShaderConstant;
1072         BOOL                      renderstate[HIGHEST_RENDER_STATE];
1073         BOOL                      texture_state[8][HIGHEST_TEXTURE_STATE];
1074         BOOL                      clipplane[MAX_CLIPPLANES];
1075 } SAVEDSTATES;
1076
1077
1078 /* ----------------------- */
1079 /* IDirect3DStateBlockImpl */
1080 /* ----------------------- */
1081
1082 /*****************************************************************************
1083  * Predeclare the interface implementation structures
1084  */
1085 /*extern IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl;*/
1086
1087 /*****************************************************************************
1088  * IDirect3DStateBlock implementation structure
1089  */
1090 struct  IDirect3DStateBlockImpl {
1091   /* IUnknown fields */
1092   /*IDirect3DStateBlock9Vtbl *lpVtbl;*/
1093   DWORD  ref;
1094
1095   /* The device, to be replaced by a IDirect3DDeviceImpl */
1096   IDirect3DDevice8Impl* device;
1097
1098   D3DSTATEBLOCKTYPE         blockType;
1099
1100   SAVEDSTATES               Changed;
1101   SAVEDSTATES               Set;
1102   
1103   /* Clipping */
1104   double                    clipplane[MAX_CLIPPLANES][4];
1105   D3DCLIPSTATUS8            clip_status;
1106
1107   /* Stream Source */
1108   UINT                      stream_stride[MAX_STREAMS];
1109   IDirect3DVertexBuffer8   *stream_source[MAX_STREAMS];
1110   BOOL                      streamIsUP;
1111
1112   /* Indices */
1113   IDirect3DIndexBuffer8*    pIndexData;
1114   UINT                      baseVertexIndex;
1115   
1116   /* Texture */
1117   IDirect3DBaseTexture8    *textures[8];
1118   int                       textureDimensions[8];
1119   /* Texture State Stage */
1120   DWORD                     texture_state[8][HIGHEST_TEXTURE_STATE];
1121   
1122   /* Lights */
1123   PLIGHTINFOEL             *lights; /* NOTE: active GL lights must be front of the chain */
1124   
1125   /* Material */
1126   D3DMATERIAL8              material;
1127   
1128   /* RenderState */
1129   DWORD                     renderstate[HIGHEST_RENDER_STATE];
1130   
1131   /* Transform */
1132   D3DMATRIX                 transforms[HIGHEST_TRANSFORMSTATE];
1133   
1134   /* ViewPort */
1135   D3DVIEWPORT8              viewport;
1136   
1137   /* Vertex Shader */
1138   DWORD                     VertexShader;
1139
1140   /* Vertex Shader Declaration */
1141   IDirect3DVertexShaderDeclarationImpl* vertexShaderDecl;
1142   
1143   /* Pixel Shader */
1144   DWORD                     PixelShader;
1145   
1146   /* Indexed Vertex Blending */
1147   D3DVERTEXBLENDFLAGS       vertex_blend;
1148   FLOAT                     tween_factor;
1149
1150   /* Vertex Shader Constant */
1151   D3DSHADERVECTOR           vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
1152   /* Pixel Shader Constant */
1153   D3DSHADERVECTOR           pixelShaderConstant[D3D8_PSHADER_MAX_CONSTANTS];
1154 };
1155
1156 /* exported Interfaces */
1157 /* internal Interfaces */
1158 /* temporary internal Interfaces */
1159 extern HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* This);
1160 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateStateBlock(IDirect3DDevice8Impl* This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlockImpl** ppStateBlock);
1161 extern HRESULT WINAPI IDirect3DDeviceImpl_DeleteStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
1162 extern HRESULT WINAPI IDirect3DDeviceImpl_BeginStateBlock(IDirect3DDevice8Impl* This);
1163 extern HRESULT WINAPI IDirect3DDeviceImpl_EndStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl** ppStateBlock);
1164 extern HRESULT WINAPI IDirect3DDeviceImpl_ApplyStateBlock(IDirect3DDevice8Impl* iface, IDirect3DStateBlockImpl* pSB);
1165 extern HRESULT WINAPI IDirect3DDeviceImpl_CaptureStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
1166
1167 /* ------------------------------------ */
1168 /* IDirect3DVertexShaderDeclarationImpl */
1169 /* ------------------------------------ */
1170
1171 /*****************************************************************************
1172  * Predeclare the interface implementation structures
1173  */
1174 /*extern IDirect3DVertexShaderDeclaration9Vtbl Direct3DVertexShaderDeclaration9_Vtbl;*/
1175
1176 /*****************************************************************************
1177  * IDirect3DVertexShaderDeclaration implementation structure
1178  */
1179 struct IDirect3DVertexShaderDeclarationImpl {
1180   /* IUnknown fields */
1181   /*IDirect3DVertexShaderDeclaration9Vtbl *lpVtbl;*/
1182   DWORD  ref;
1183
1184   /* The device, to be replaced by a IDirect3DDeviceImpl */
1185   IDirect3DDevice8Impl* device;
1186
1187   /** precomputed fvf if simple declaration */
1188   DWORD   fvf[MAX_STREAMS];
1189   DWORD   allFVF;
1190
1191   /** dx8 compatible Declaration fields */
1192   DWORD*  pDeclaration8;
1193   DWORD   declaration8Length;
1194 };
1195
1196 /* exported Interfaces */
1197 extern HRESULT WINAPI IDirect3DVertexShaderDeclarationImpl_GetDeclaration8(IDirect3DVertexShaderDeclarationImpl* This, DWORD* pData, UINT* pSizeOfData);
1198 /*extern HRESULT IDirect3DVertexShaderDeclarationImpl_GetDeclaration9(IDirect3DVertexShaderDeclarationImpl* This, D3DVERTEXELEMENT9* pData, UINT* pNumElements);*/
1199 /* internal Interfaces */
1200 /* temporary internal Interfaces */
1201 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevice8Impl* This, CONST DWORD* pDeclaration8, IDirect3DVertexShaderDeclarationImpl** ppVertexShaderDecl);
1202
1203
1204 /* ------------------------- */
1205 /* IDirect3DVertexShaderImpl */
1206 /* ------------------------- */
1207
1208 /*****************************************************************************
1209  * Predeclare the interface implementation structures
1210  */
1211 /*extern IDirect3DVertexShader9Vtbl Direct3DVertexShader9_Vtbl;*/
1212
1213 /*****************************************************************************
1214  * IDirect3DVertexShader implementation structure
1215  */
1216 struct IDirect3DVertexShaderImpl {
1217   /*IDirect3DVertexShader9Vtbl *lpVtbl;*/
1218   DWORD ref;
1219
1220   /* The device, to be replaced by a IDirect3DDeviceImpl */
1221   IDirect3DDevice8Impl* device;
1222
1223   DWORD* function;
1224   UINT functionLength;
1225   DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
1226   DWORD version;
1227   
1228   /** fields for hw vertex shader use */
1229   GLuint  prgId;
1230
1231   /* run time datas */
1232   VSHADERDATA8* data;
1233   VSHADERINPUTDATA8 input;
1234   VSHADEROUTPUTDATA8 output;
1235 };
1236
1237 /* exported Interfaces */
1238 extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetFunction(IDirect3DVertexShaderImpl* This, VOID* pData, UINT* pSizeOfData);
1239 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST BOOL*  pConstantData, UINT BoolCount);*/
1240 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST INT*   pConstantData, UINT Vector4iCount);*/
1241 extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount);
1242 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, BOOL*  pConstantData, UINT BoolCount);*/
1243 /*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, INT*   pConstantData, UINT Vector4iCount);*/
1244 extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount);
1245 /* internal Interfaces */
1246 extern DWORD WINAPI IDirect3DVertexShaderImpl_GetVersion(IDirect3DVertexShaderImpl* This);
1247 extern HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* This, VSHADERINPUTDATA8* input, VSHADEROUTPUTDATA8* output);
1248 /* temporary internal Interfaces */
1249 extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, DWORD Usage, IDirect3DVertexShaderImpl** ppVertexShader);
1250 extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader,  DWORD SkipnStrides);
1251 extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader,  DWORD SkipnStrides);
1252
1253 /* ------------------------ */
1254 /* IDirect3DPixelShaderImpl */
1255 /* ------------------------ */
1256
1257 /*****************************************************************************
1258  * Predeclare the interface implementation structures
1259  */
1260 /*extern IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl;*/
1261
1262 /*****************************************************************************
1263  * IDirect3DPixelShader implementation structure
1264  */
1265 struct IDirect3DPixelShaderImpl { 
1266   /*IDirect3DPixelShader9Vtbl *lpVtbl;*/
1267   DWORD ref;
1268
1269   /* The device, to be replaced by a IDirect3DDeviceImpl */
1270   IDirect3DDevice8Impl* device;
1271
1272   DWORD* function;
1273   UINT functionLength;
1274   DWORD version;
1275
1276   /** fields for hw pixel shader use */
1277   GLuint  prgId;
1278
1279   /* run time datas */
1280   PSHADERDATA8* data;
1281   PSHADERINPUTDATA8 input;
1282   PSHADEROUTPUTDATA8 output;
1283 };
1284
1285 /* exported Interfaces */
1286 extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData);
1287 extern HRESULT WINAPI IDirect3DPixelShaderImpl_SetConstantF(IDirect3DPixelShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount);
1288 /* internal Interfaces */
1289 extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl* This);
1290 /* temporary internal Interfaces */
1291 extern HRESULT WINAPI IDirect3DDeviceImpl_CreatePixelShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, IDirect3DPixelShaderImpl** ppPixelShader);
1292
1293
1294 /**
1295  * Internals functions
1296  *
1297  * to see how not defined it here
1298  */ 
1299 void   GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
1300 void   setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage, DWORD Flags);
1301 void   set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
1302
1303 SHORT  D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1304 GLint  D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1305 GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1306 GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
1307
1308 GLenum D3DFmt2GLDepthFmt(D3DFORMAT fmt);
1309 GLenum D3DFmt2GLDepthType(D3DFORMAT fmt);
1310
1311 int D3DPrimitiveListGetVertexSize(D3DPRIMITIVETYPE PrimitiveType, int iNumPrim);
1312 int D3DPrimitive2GLenum(D3DPRIMITIVETYPE PrimitiveType);
1313 int D3DFVFGetSize(D3DFORMAT fvf);
1314
1315 int SOURCEx_RGB_EXT(DWORD arg);
1316 int OPERANDx_RGB_EXT(DWORD arg);
1317 int SOURCEx_ALPHA_EXT(DWORD arg);
1318 int OPERANDx_ALPHA_EXT(DWORD arg);
1319 GLenum StencilOp(DWORD op);
1320
1321 /**
1322  * Internals debug functions
1323  */
1324 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
1325 const char* debug_d3dusage(DWORD usage);
1326 const char* debug_d3dformat(D3DFORMAT fmt);
1327 const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
1328 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
1329 const char* debug_d3dpool(D3DPOOL Pool);
1330 const char *debug_d3drenderstate(DWORD State);
1331 const char *debug_d3dtexturestate(DWORD State);
1332
1333 /* Some #defines for additional diagnostics */
1334 #if 0 /* NOTE: Must be 0 in cvs */
1335   /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
1336      of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
1337      is enabled, and if it doesn't exists it is disabled.                                           */
1338 # define FRAME_DEBUGGING
1339   /*  Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
1340       the file is deleted                                                                            */
1341 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
1342 #  define SINGLE_FRAME_DEBUGGING
1343 # endif  
1344   /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
1345      It can only be enabled when FRAME_DEBUGGING is also enabled                               
1346      The contents of the back buffer are written into /tmp/backbuffer_* after each primitive 
1347      array is drawn.                                                                            */
1348 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */                                                                                       
1349 #  define SHOW_FRAME_MAKEUP 1
1350 # endif  
1351   /* The following, when enabled, lets you see the makeup of the all the textures used during each
1352      of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
1353      The contents of the textures assigned to each stage are written into 
1354      /tmp/texture_*_<Stage>.ppm after each primitive array is drawn.                            */
1355 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
1356 #  define SHOW_TEXTURE_MAKEUP 0
1357 # endif  
1358 extern BOOL isOn;
1359 extern BOOL isDumpingFrames;
1360 extern LONG primCounter;
1361 #endif
1362
1363 /* Per-vertex trace: */
1364 #if 0 /* NOTE: Must be 0 in cvs */
1365 # define VTRACE(A) TRACE A
1366 #else 
1367 # define VTRACE(A) 
1368 #endif
1369
1370 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
1371 #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);
1372
1373 #define DUMP_LIGHT_CHAIN()                    \
1374 {                                             \
1375   PLIGHTINFOEL *el = This->StateBlock->lights;\
1376   while (el) {                                \
1377     TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
1378     el = el->next;                            \
1379   }                                           \
1380 }
1381
1382 #endif /* __WINE_D3DX8_PRIVATE_H */