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