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