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