hlink: Fix some memory leaks in the tests.
[wine] / dlls / d3d8 / d3d8_private.h
1 /*
2  * Direct3D 8 private include file
3  *
4  * Copyright 2002-2004 Jason Edmeades
5  * Copyright 2003-2004 Raphael Junqueira
6  * Copyright 2004 Christian Costa
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #ifndef __WINE_D3D8_PRIVATE_H
24 #define __WINE_D3D8_PRIVATE_H
25
26 #include <stdarg.h>
27
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
30 #define COBJMACROS
31 #include "windef.h"
32 #include "winbase.h"
33 #include "wingdi.h"
34 #include "wine/debug.h"
35 #include "d3d8.h"
36 #include "wine/wined3d_interface.h"
37
38 /* Device caps */
39 #define INITIAL_SHADER_HANDLE_TABLE_SIZE        64
40
41 /* CreateVertexShader can return > 0xFFFF */
42 #define VS_HIGHESTFIXEDFXF 0xF0000000
43
44 /* ===========================================================================
45     Macros
46    =========================================================================== */
47 /* Not nice, but it lets wined3d support different versions of directx */
48 #define D3D8CAPSTOWINECAPS(_pD3D8Caps, _pWineCaps) \
49     _pWineCaps->DeviceType                        = (WINED3DDEVTYPE *) &_pD3D8Caps->DeviceType; \
50     _pWineCaps->AdapterOrdinal                    = &_pD3D8Caps->AdapterOrdinal; \
51     _pWineCaps->Caps                              = &_pD3D8Caps->Caps; \
52     _pWineCaps->Caps2                             = &_pD3D8Caps->Caps2; \
53     _pWineCaps->Caps3                             = &_pD3D8Caps->Caps3; \
54     _pWineCaps->PresentationIntervals             = &_pD3D8Caps->PresentationIntervals; \
55     _pWineCaps->CursorCaps                        = &_pD3D8Caps->CursorCaps; \
56     _pWineCaps->DevCaps                           = &_pD3D8Caps->DevCaps; \
57     _pWineCaps->PrimitiveMiscCaps                 = &_pD3D8Caps->PrimitiveMiscCaps; \
58     _pWineCaps->RasterCaps                        = &_pD3D8Caps->RasterCaps; \
59     _pWineCaps->ZCmpCaps                          = &_pD3D8Caps->ZCmpCaps; \
60     _pWineCaps->SrcBlendCaps                      = &_pD3D8Caps->SrcBlendCaps; \
61     _pWineCaps->DestBlendCaps                     = &_pD3D8Caps->DestBlendCaps; \
62     _pWineCaps->AlphaCmpCaps                      = &_pD3D8Caps->AlphaCmpCaps; \
63     _pWineCaps->ShadeCaps                         = &_pD3D8Caps->ShadeCaps; \
64     _pWineCaps->TextureCaps                       = &_pD3D8Caps->TextureCaps; \
65     _pWineCaps->TextureFilterCaps                 = &_pD3D8Caps->TextureFilterCaps; \
66     _pWineCaps->CubeTextureFilterCaps             = &_pD3D8Caps->CubeTextureFilterCaps; \
67     _pWineCaps->VolumeTextureFilterCaps           = &_pD3D8Caps->VolumeTextureFilterCaps; \
68     _pWineCaps->TextureAddressCaps                = &_pD3D8Caps->TextureAddressCaps; \
69     _pWineCaps->VolumeTextureAddressCaps          = &_pD3D8Caps->VolumeTextureAddressCaps; \
70     _pWineCaps->LineCaps                          = &_pD3D8Caps->LineCaps; \
71     _pWineCaps->MaxTextureWidth                   = &_pD3D8Caps->MaxTextureWidth; \
72     _pWineCaps->MaxTextureHeight                  = &_pD3D8Caps->MaxTextureHeight; \
73     _pWineCaps->MaxVolumeExtent                   = &_pD3D8Caps->MaxVolumeExtent; \
74     _pWineCaps->MaxTextureRepeat                  = &_pD3D8Caps->MaxTextureRepeat; \
75     _pWineCaps->MaxTextureAspectRatio             = &_pD3D8Caps->MaxTextureAspectRatio; \
76     _pWineCaps->MaxAnisotropy                     = &_pD3D8Caps->MaxAnisotropy; \
77     _pWineCaps->MaxVertexW                        = &_pD3D8Caps->MaxVertexW; \
78     _pWineCaps->GuardBandLeft                     = &_pD3D8Caps->GuardBandLeft; \
79     _pWineCaps->GuardBandTop                      = &_pD3D8Caps->GuardBandTop; \
80     _pWineCaps->GuardBandRight                    = &_pD3D8Caps->GuardBandRight; \
81     _pWineCaps->GuardBandBottom                   = &_pD3D8Caps->GuardBandBottom; \
82     _pWineCaps->ExtentsAdjust                     = &_pD3D8Caps->ExtentsAdjust; \
83     _pWineCaps->StencilCaps                       = &_pD3D8Caps->StencilCaps; \
84     _pWineCaps->FVFCaps                           = &_pD3D8Caps->FVFCaps; \
85     _pWineCaps->TextureOpCaps                     = &_pD3D8Caps->TextureOpCaps; \
86     _pWineCaps->MaxTextureBlendStages             = &_pD3D8Caps->MaxTextureBlendStages; \
87     _pWineCaps->MaxSimultaneousTextures           = &_pD3D8Caps->MaxSimultaneousTextures; \
88     _pWineCaps->VertexProcessingCaps              = &_pD3D8Caps->VertexProcessingCaps; \
89     _pWineCaps->MaxActiveLights                   = &_pD3D8Caps->MaxActiveLights; \
90     _pWineCaps->MaxUserClipPlanes                 = &_pD3D8Caps->MaxUserClipPlanes; \
91     _pWineCaps->MaxVertexBlendMatrices            = &_pD3D8Caps->MaxVertexBlendMatrices; \
92     _pWineCaps->MaxVertexBlendMatrixIndex         = &_pD3D8Caps->MaxVertexBlendMatrixIndex; \
93     _pWineCaps->MaxPointSize                      = &_pD3D8Caps->MaxPointSize; \
94     _pWineCaps->MaxPrimitiveCount                 = &_pD3D8Caps->MaxPrimitiveCount; \
95     _pWineCaps->MaxVertexIndex                    = &_pD3D8Caps->MaxVertexIndex; \
96     _pWineCaps->MaxStreams                        = &_pD3D8Caps->MaxStreams; \
97     _pWineCaps->MaxStreamStride                   = &_pD3D8Caps->MaxStreamStride; \
98     _pWineCaps->VertexShaderVersion               = &_pD3D8Caps->VertexShaderVersion; \
99     _pWineCaps->MaxVertexShaderConst              = &_pD3D8Caps->MaxVertexShaderConst; \
100     _pWineCaps->PixelShaderVersion                = &_pD3D8Caps->PixelShaderVersion; \
101     _pWineCaps->PixelShader1xMaxValue             = &_pD3D8Caps->MaxPixelShaderValue;
102
103 /* Direct3D8 Interfaces: */
104 typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
105 typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
106 typedef struct IDirect3D8Impl IDirect3D8Impl;
107 typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl;
108 typedef struct IDirect3DTexture8Impl IDirect3DTexture8Impl;
109 typedef struct IDirect3DCubeTexture8Impl IDirect3DCubeTexture8Impl;
110 typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
111 typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
112 typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
113 typedef struct IDirect3DResource8Impl IDirect3DResource8Impl;
114 typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
115 typedef struct IDirect3DVertexBuffer8Impl IDirect3DVertexBuffer8Impl;
116
117 /** Private Interfaces: */
118 typedef struct IDirect3DStateBlockImpl IDirect3DStateBlockImpl;
119 typedef struct IDirect3DVertexShaderImpl IDirect3DVertexShaderImpl;
120 typedef struct IDirect3DPixelShaderImpl IDirect3DPixelShaderImpl;
121 typedef struct IDirect3DVertexShaderDeclarationImpl IDirect3DVertexShaderDeclarationImpl;
122
123 /* Advance declaration of structures to satisfy compiler */
124 typedef struct IDirect3DVertexShader8Impl IDirect3DVertexShader8Impl;
125
126 /* Global critical section */
127 extern CRITICAL_SECTION d3d8_cs;
128
129 /* ===========================================================================
130     The interfactes themselves
131    =========================================================================== */
132
133 /* ---------- */
134 /* IDirect3D8 */
135 /* ---------- */
136
137 /*****************************************************************************
138  * Predeclare the interface implementation structures
139  */
140 extern const IDirect3D8Vtbl Direct3D8_Vtbl;
141
142 /*****************************************************************************
143  * IDirect3D implementation structure
144  */
145 struct IDirect3D8Impl
146 {
147     /* IUnknown fields */
148     const IDirect3D8Vtbl   *lpVtbl;
149     LONG                    ref;
150
151     /* The WineD3D device */
152     IWineD3D               *WineD3D;
153 };
154
155 /* ---------------- */
156 /* IDirect3DDevice8 */
157 /* ---------------- */
158
159 /*****************************************************************************
160  * Predeclare the interface implementation structures
161  */
162 extern const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl;
163
164 /*****************************************************************************
165  * IDirect3DDevice8 implementation structure
166  */
167
168 typedef void * shader_handle;
169
170 struct FvfToDecl
171 {
172     DWORD fvf;
173     IWineD3DVertexDeclaration *decl;
174 };
175
176 struct IDirect3DDevice8Impl
177 {
178     /* IUnknown fields */
179     const IDirect3DDevice8Vtbl   *lpVtbl;
180     LONG                         ref;
181 /* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */
182     IWineD3DDevice               *WineD3DDevice;
183     DWORD                         shader_handle_table_size;
184     DWORD                         allocated_shader_handles;
185     shader_handle                *shader_handles;
186     shader_handle                *free_shader_handles;
187
188     /* FVF management */
189     struct FvfToDecl       *decls;
190     UINT                    numConvertedDecls, declArraySize;
191
192     /* Avoids recursion with nested ReleaseRef to 0 */
193     BOOL                          inDestruction;
194 };
195
196 /* ---------------- */
197 /* IDirect3DVolume8 */
198 /* ---------------- */
199
200 /*****************************************************************************
201  * IDirect3DVolume8 implementation structure
202  */
203 struct IDirect3DVolume8Impl
204 {
205     /* IUnknown fields */
206     const IDirect3DVolume8Vtbl *lpVtbl;
207     LONG                        ref;
208
209     /* IDirect3DVolume8 fields */
210     IWineD3DVolume             *wineD3DVolume;
211
212     /* The volume container */
213     IUnknown                    *container;
214
215     /* If set forward refcounting to this object */
216     IUnknown                    *forwardReference;
217 };
218
219 /* ------------------- */
220 /* IDirect3DSwapChain8 */
221 /* ------------------- */
222
223 /*****************************************************************************
224  * Predeclare the interface implementation structures
225  */
226 extern const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl;
227
228 /*****************************************************************************
229  * IDirect3DSwapChain8 implementation structure
230  */
231 struct IDirect3DSwapChain8Impl
232 {
233     /* IUnknown fields */
234     const IDirect3DSwapChain8Vtbl *lpVtbl;
235     LONG                           ref;
236
237     /* IDirect3DSwapChain8 fields */
238     IWineD3DSwapChain             *wineD3DSwapChain;
239
240     /* Parent reference */
241     LPDIRECT3DDEVICE8              parentDevice;
242 };
243
244 /* ----------------- */
245 /* IDirect3DSurface8 */
246 /* ----------------- */
247
248 /*****************************************************************************
249  * Predeclare the interface implementation structures
250  */
251 extern const IDirect3DSurface8Vtbl Direct3DSurface8_Vtbl;
252
253 /*****************************************************************************
254  * IDirect3DSurface8 implementation structure
255  */
256 struct IDirect3DSurface8Impl
257 {
258     /* IUnknown fields */
259     const IDirect3DSurface8Vtbl *lpVtbl;
260     LONG                         ref;
261
262     /* IDirect3DSurface8 fields */
263     IWineD3DSurface             *wineD3DSurface;
264
265     /* Parent reference */
266     LPDIRECT3DDEVICE8                  parentDevice;
267
268     /* The surface container */
269     IUnknown                    *container;
270
271     /* If set forward refcounting to this object */
272     IUnknown                    *forwardReference;
273
274     /* Flags an implicit surface */
275     BOOL                        isImplicit;
276 };
277
278 /* ------------------ */
279 /* IDirect3DResource8 */
280 /* ------------------ */
281
282 /*****************************************************************************
283  * Predeclare the interface implementation structures
284  */
285 extern const IDirect3DResource8Vtbl Direct3DResource8_Vtbl;
286
287 /*****************************************************************************
288  * IDirect3DResource8 implementation structure
289  */
290 struct IDirect3DResource8Impl
291 {
292     /* IUnknown fields */
293     const IDirect3DResource8Vtbl *lpVtbl;
294     LONG                          ref;
295
296     /* IDirect3DResource8 fields */
297     IWineD3DResource             *wineD3DResource;
298 };
299 extern HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice);
300
301 /* ---------------------- */
302 /* IDirect3DVertexBuffer8 */
303 /* ---------------------- */
304
305 /*****************************************************************************
306  * Predeclare the interface implementation structures
307  */
308 extern const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl;
309
310 /*****************************************************************************
311  * IDirect3DVertexBuffer8 implementation structure
312  */
313 struct IDirect3DVertexBuffer8Impl
314 {
315     /* IUnknown fields */
316     const IDirect3DVertexBuffer8Vtbl *lpVtbl;
317     LONG                              ref;
318
319     /* IDirect3DResource8 fields */
320     IWineD3DVertexBuffer             *wineD3DVertexBuffer;
321
322     /* Parent reference */
323     LPDIRECT3DDEVICE8                 parentDevice;
324 };
325
326 /* --------------------- */
327 /* IDirect3DIndexBuffer8 */
328 /* --------------------- */
329
330 /*****************************************************************************
331  * Predeclare the interface implementation structures
332  */
333 extern const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl;
334
335 /*****************************************************************************
336  * IDirect3DIndexBuffer8 implementation structure
337  */
338 struct IDirect3DIndexBuffer8Impl
339 {
340     /* IUnknown fields */
341     const IDirect3DIndexBuffer8Vtbl *lpVtbl;
342     LONG                             ref;
343
344     /* IDirect3DResource8 fields */
345     IWineD3DIndexBuffer             *wineD3DIndexBuffer;
346
347     /* Parent reference */
348     LPDIRECT3DDEVICE8                parentDevice;
349 };
350
351 /* --------------------- */
352 /* IDirect3DBaseTexture8 */
353 /* --------------------- */
354
355 /*****************************************************************************
356  * IDirect3DBaseTexture8 implementation structure
357  */
358 struct IDirect3DBaseTexture8Impl
359 {
360     /* IUnknown fields */
361     const IDirect3DBaseTexture8Vtbl *lpVtbl;
362     LONG                   ref;
363
364     /* IDirect3DResource8 fields */
365     IWineD3DBaseTexture             *wineD3DBaseTexture;
366 };
367
368 /* --------------------- */
369 /* IDirect3DCubeTexture8 */
370 /* --------------------- */
371
372 /*****************************************************************************
373  * Predeclare the interface implementation structures
374  */
375 extern const IDirect3DCubeTexture8Vtbl Direct3DCubeTexture8_Vtbl;
376
377 /*****************************************************************************
378  * IDirect3DCubeTexture8 implementation structure
379  */
380 struct IDirect3DCubeTexture8Impl
381 {
382     /* IUnknown fields */
383     const IDirect3DCubeTexture8Vtbl *lpVtbl;
384     LONG                   ref;
385
386     /* IDirect3DResource8 fields */
387     IWineD3DCubeTexture             *wineD3DCubeTexture;
388
389     /* Parent reference */
390     LPDIRECT3DDEVICE8                parentDevice;
391 };
392
393 /* ----------------- */
394 /* IDirect3DTexture8 */
395 /* ----------------- */
396
397 /*****************************************************************************
398  * Predeclare the interface implementation structures
399  */
400 extern const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl;
401
402 /*****************************************************************************
403  * IDirect3DTexture8 implementation structure
404  */
405 struct IDirect3DTexture8Impl
406 {
407     /* IUnknown fields */
408     const IDirect3DTexture8Vtbl *lpVtbl;
409     LONG                   ref;
410
411     /* IDirect3DResourc8 fields */
412     IWineD3DTexture             *wineD3DTexture;
413
414     /* Parent reference */
415     LPDIRECT3DDEVICE8            parentDevice;
416 };
417
418 /* ----------------------- */
419 /* IDirect3DVolumeTexture8 */
420 /* ----------------------- */
421
422 /*****************************************************************************
423  * Predeclare the interface implementation structures
424  */
425 extern const IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl;
426
427 /*****************************************************************************
428  * IDirect3DVolumeTexture8 implementation structure
429  */
430 struct IDirect3DVolumeTexture8Impl
431 {
432     /* IUnknown fields */
433     const IDirect3DVolumeTexture8Vtbl *lpVtbl;
434     LONG                   ref;
435
436     /* IDirect3DResource8 fields */
437     IWineD3DVolumeTexture             *wineD3DVolumeTexture;
438
439     /* Parent reference */
440     LPDIRECT3DDEVICE8                  parentDevice;
441 };
442
443 /* ----------------------- */
444 /* IDirect3DStateBlockImpl */
445 /* ----------------------- */
446
447 /* TODO: Generate a valid GUIDs */
448 /* {83B073CE-6F30-11d9-C687-00046142C14F} */
449 DEFINE_GUID(IID_IDirect3DStateBlock8, 
450 0x83b073ce, 0x6f30, 0x11d9, 0xc6, 0x87, 0x0, 0x4, 0x61, 0x42, 0xc1, 0x4f);
451
452 DEFINE_GUID(IID_IDirect3DVertexDeclaration8,
453 0x5dd7478d, 0xcbf3, 0x41a6, 0x8c, 0xfd, 0xfd, 0x19, 0x2b, 0x11, 0xc7, 0x90);
454
455 DEFINE_GUID(IID_IDirect3DVertexShader8,
456 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36);
457
458 DEFINE_GUID(IID_IDirect3DPixelShader8,
459 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89);
460
461
462 /*****************************************************************************
463  * IDirect3DStateBlock8 interface
464  */
465 #define INTERFACE IDirect3DStateBlock8
466 DECLARE_INTERFACE_(IDirect3DStateBlock8, IUnknown)
467 {
468     /*** IUnknown methods ***/
469     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
470     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
471     STDMETHOD_(ULONG,Release)(THIS) PURE;
472     /*** IDirect3DStateBlock9 methods ***/
473     STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
474     STDMETHOD(Capture)(THIS) PURE;
475     STDMETHOD(Apply)(THIS) PURE;
476 };
477 #undef INTERFACE
478
479 /*** IUnknown methods ***/
480 #define IDirect3DStateBlock8_QueryInterface(p,a,b)  (p)->lpVtbl->QueryInterface(p,a,b)
481 #define IDirect3DStateBlock8_AddRef(p)              (p)->lpVtbl->AddRef(p)
482 #define IDirect3DStateBlock8_Release(p)             (p)->lpVtbl->Release(p)
483 /*** IDirect3DStateBlock9 methods ***/
484 #define IDirect3DStateBlock8_GetDevice(p,a)         (p)->lpVtbl->GetDevice(p,a)
485 #define IDirect3DStateBlock8_Capture(p)             (p)->lpVtbl->Capture(p)
486 #define IDirect3DStateBlock8_Apply(p)               (p)->lpVtbl->Apply(p)
487
488 /*****************************************************************************
489  * Predeclare the interface implementation structures
490  */
491 extern const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl;
492
493 /*****************************************************************************
494  * IDirect3DStateBlock implementation structure
495  */
496 typedef struct  IDirect3DStateBlock8Impl {
497     /* IUnknown fields */
498     const IDirect3DStateBlock8Vtbl *lpVtbl;
499     LONG                   ref;
500
501     /* IDirect3DResource8 fields */
502     IWineD3DStateBlock             *wineD3DStateBlock;
503 } IDirect3DStateBlock8Impl;
504
505 /*****************************************************************************
506  * IDirect3DVertexDeclaration8 interface
507  */
508 #define INTERFACE IDirect3DVertexDeclaration8
509 DECLARE_INTERFACE_(IDirect3DVertexDeclaration8, IUnknown)
510 {
511     /*** IUnknown methods ***/
512     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** obj_ptr) PURE;
513     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
514     STDMETHOD_(ULONG,Release)(THIS) PURE;
515 };
516 #undef INTERFACE
517
518 /*** IUnknown methods ***/
519 #define IDirect3DVertexDeclaration8_QueryInterface(p,a,b)  (p)->lpVtbl->QueryInterface(p,a,b)
520 #define IDirect3DVertexDeclaration8_AddRef(p)              (p)->lpVtbl->AddRef(p)
521 #define IDirect3DVertexDeclaration8_Release(p)             (p)->lpVtbl->Release(p)
522
523 /*** Implementation ***/
524 extern const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl;
525
526 typedef struct {
527     const IDirect3DVertexDeclaration8Vtbl *lpVtbl;
528     LONG ref_count;
529
530     DWORD *elements;
531     DWORD elements_size; /* Size of elements, in bytes */
532
533     IWineD3DVertexDeclaration *wined3d_vertex_declaration;
534 } IDirect3DVertexDeclaration8Impl;
535
536
537 /*****************************************************************************
538  * IDirect3DVertexShader9 interface
539  */
540 #define INTERFACE IDirect3DVertexShader8
541 DECLARE_INTERFACE_(IDirect3DVertexShader8, IUnknown)
542 {
543     /*** IUnknown methods ***/
544     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
545     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
546     STDMETHOD_(ULONG,Release)(THIS) PURE;
547     /*** IDirect3DVertexShader9 methods ***/
548     STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
549     STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE;
550 };
551 #undef INTERFACE
552
553 /*** IUnknown methods ***/
554 #define IDirect3DVertexShader8_QueryInterface(p,a,b)  (p)->lpVtbl->QueryInterface(p,a,b)
555 #define IDirect3DVertexShader8_AddRef(p)              (p)->lpVtbl->AddRef(p)
556 #define IDirect3DVertexShader8_Release(p)             (p)->lpVtbl->Release(p)
557 /*** IDirect3DVertexShader8 methods ***/
558 #define IDirect3DVertexShader8_GetDevice(p,a)         (p)->lpVtbl->GetDevice(p,a)
559 #define IDirect3DVertexShader8_GetFunction(p,a,b)     (p)->lpVtbl->GetFunction(p,a,b)
560
561 /* ------------------------- */
562 /* IDirect3DVertexShader8Impl */
563 /* ------------------------- */
564
565 /*****************************************************************************
566  * IDirect3DPixelShader9 interface
567  */
568 #define INTERFACE IDirect3DPixelShader8
569 DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown)
570 {
571     /*** IUnknown methods ***/
572     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
573     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
574     STDMETHOD_(ULONG,Release)(THIS) PURE;
575     /*** IDirect3DPixelShader8 methods ***/
576     STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
577     STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE;
578 };
579 #undef INTERFACE
580
581 /*** IUnknown methods ***/
582 #define IDirect3DPixelShader8_QueryInterface(p,a,b)  (p)->lpVtbl->QueryInterface(p,a,b)
583 #define IDirect3DPixelShader8_AddRef(p)              (p)->lpVtbl->AddRef(p)
584 #define IDirect3DPixelShader8_Release(p)             (p)->lpVtbl->Release(p)
585 /*** IDirect3DPixelShader8 methods ***/
586 #define IDirect3DPixelShader8_GetDevice(p,a)         (p)->lpVtbl->GetDevice(p,a)
587 #define IDirect3DPixelShader8_GetFunction(p,a,b)     (p)->lpVtbl->GetFunction(p,a,b)
588
589
590 /*****************************************************************************
591  * Predeclare the interface implementation structures
592  */
593 extern const IDirect3DVertexShader8Vtbl Direct3DVertexShader8_Vtbl;
594
595 /*****************************************************************************
596  * IDirect3DVertexShader implementation structure
597  */
598
599 struct IDirect3DVertexShader8Impl {
600   const IDirect3DVertexShader8Vtbl *lpVtbl;
601   LONG ref;
602
603   shader_handle                    *handle;
604   IDirect3DVertexDeclaration8      *vertex_declaration;
605   IWineD3DVertexShader             *wineD3DVertexShader;
606 };
607
608
609 /* ------------------------ */
610 /* IDirect3DPixelShaderImpl */
611 /* ------------------------ */
612
613
614 /*****************************************************************************
615  * Predeclare the interface implementation structures
616  */
617 extern const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl;
618
619 /*****************************************************************************
620  * IDirect3DPixelShader implementation structure
621  */
622 typedef struct IDirect3DPixelShader8Impl {
623     const IDirect3DPixelShader8Vtbl *lpVtbl;
624     LONG                             ref;
625
626     shader_handle                   *handle;
627     /* The device, to be replaced by an IDirect3DDeviceImpl */
628     IWineD3DPixelShader             *wineD3DPixelShader;
629 } IDirect3DPixelShader8Impl;
630
631 /**
632  * Internals functions
633  *
634  * to see how not defined it here
635  */
636 void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wined3d_vertex_shader);
637 size_t convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements);
638
639 /* Callbacks */
640 extern HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
641                                          WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level,
642                                          WINED3DCUBEMAP_FACES Face, IWineD3DSurface** ppSurface,
643                                          HANDLE* pSharedHandle);
644
645 extern HRESULT WINAPI D3D8CB_CreateVolume(IUnknown  *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth,
646                                           WINED3DFORMAT  Format, WINED3DPOOL Pool, DWORD Usage,
647                                           IWineD3DVolume **ppVolume,
648                                           HANDLE   * pSharedHandle);
649
650 extern HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
651                                          WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
652                                          DWORD MultisampleQuality, BOOL Discard,
653                                          IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
654
655 extern HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
656                                          WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
657                                          DWORD MultisampleQuality, BOOL Lockable,
658                                          IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
659
660 extern ULONG WINAPI D3D8CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain);
661
662 extern ULONG WINAPI D3D8CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface);
663
664 extern ULONG WINAPI D3D8CB_DestroyRenderTarget (IWineD3DSurface *pSurface);
665
666 extern ULONG WINAPI D3D8CB_DestroySurface(IWineD3DSurface *pSurface);
667
668 extern ULONG WINAPI D3D8CB_DestroyVolume(IWineD3DVolume *pVolume);
669
670 #endif /* __WINE_D3DX8_PRIVATE_H */