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