Removed some more uses of the non-standard ICOM_THIS macro.
[wine] / dlls / d3d9 / device.c
1 /*
2  * IDirect3DDevice9 implementation
3  *
4  * Copyright 2002-2003 Jason Edmeades
5  *                     Raphael Junqueira
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23
24 #include <math.h>
25 #include <stdarg.h>
26
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "wingdi.h"
33 #include "wine/debug.h"
34
35 #include "d3d9_private.h"
36
37 /** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
38 #undef GL_VERSION_1_4
39
40 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
41 WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
42
43
44 /* IDirect3D IUnknown parts follow: */
45 HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9 iface, REFIID riid, LPVOID* ppobj) {
46     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
47
48     if (IsEqualGUID(riid, &IID_IUnknown)
49         || IsEqualGUID(riid, &IID_IDirect3DDevice9)) {
50         IDirect3DDevice9Impl_AddRef(iface);
51         *ppobj = This;
52         return D3D_OK;
53     }
54
55     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
56     return E_NOINTERFACE;
57 }
58
59 ULONG WINAPI IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9 iface) {
60     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
61     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
62     return ++(This->ref);
63 }
64
65 ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
66     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
67     ULONG ref = --This->ref;
68     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
69     if (ref == 0) {
70       HeapFree(GetProcessHeap(), 0, This);
71     }
72     return ref;
73 }
74
75 /* IDirect3DDevice Interface follow: */
76 HRESULT  WINAPI  IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface) {
77     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
78     TRACE("(%p) : stub\n", This);    /* No way of notifying yet! */
79     return D3D_OK;
80 }
81
82 UINT     WINAPI  IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface) {
83     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
84     TRACE("(%p) : stub, emulating 32Mb for now\n", This);
85     /*
86      * pretend we have 32MB of any type of memory queried.
87      */
88     return (1024*1024*32);
89 }
90
91 HRESULT  WINAPI  IDirect3DDevice9Impl_EvictManagedRessources(LPDIRECT3DDEVICE9 iface) {
92     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
93     FIXME("(%p) : stub\n", This);    
94     return D3D_OK;
95 }
96
97 HRESULT  WINAPI  IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9) {
98     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
99     TRACE("(%p) : returning %p\n", This, This->direct3d);
100     /* Inc ref count */
101     *ppD3D9 = (IDirect3D9*) This->direct3d;
102     IDirect3D9_AddRef(*ppD3D9);
103     return D3D_OK;
104 }
105
106 HRESULT  WINAPI  IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface, D3DCAPS9* pCaps) {
107     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
108     FIXME("(%p) : stub, calling idirect3d for now\n", This);
109     IDirect3D9Impl_GetDeviceCaps((LPDIRECT3D9) This->direct3d, This->adapterNo, This->devType, pCaps);
110     return D3D_OK;
111 }
112
113 HRESULT  WINAPI  IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DDISPLAYMODE* pMode) {
114     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
115     FIXME("(%p) : stub\n", This);
116     return D3D_OK;
117 }
118
119 HRESULT  WINAPI  IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
120     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
121     TRACE("(%p) copying to %p\n", This, pParameters);    
122     memcpy(pParameters, &This->CreateParms, sizeof(D3DDEVICE_CREATION_PARAMETERS));
123     return D3D_OK;
124 }
125
126 HRESULT  WINAPI  IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
127     IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap;
128     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
129     TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
130
131     if (D3DFMT_A8R8G8B8 != pSur->myDesc.Format) {
132       ERR("(%p) : surface(%p) have a invalid format\n", This, pCursorBitmap);
133       return D3DERR_INVALIDCALL;
134     }
135     if (32 != pSur->myDesc.Height || 32 != pSur->myDesc.Width) {
136       ERR("(%p) : surface(%p) have a invalid size\n", This, pCursorBitmap);
137       return D3DERR_INVALIDCALL;
138     }
139
140     This->xHotSpot = XHotSpot;
141     This->yHotSpot = YHotSpot;
142     return D3D_OK;
143 }
144
145 void     WINAPI  IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9 iface, int XScreenSpace, int YScreenSpace, DWORD Flags) {
146     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
147     TRACE("(%p) : SetPos to (%u,%u)\n", This, XScreenSpace, YScreenSpace);
148     This->xScreenSpace = XScreenSpace;
149     This->yScreenSpace = YScreenSpace;
150     return;
151 }
152
153 BOOL     WINAPI  IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface, BOOL bShow) {
154     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
155     TRACE("(%p) : visible(%d)\n", This, bShow); 
156     This->bCursorVisible = bShow;
157     return D3D_OK;
158 }
159
160 HRESULT  WINAPI  IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
161     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
162     FIXME("(%p) : stub\n", This);
163     return D3D_OK;
164 }
165
166 HRESULT  WINAPI  IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
167     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
168     TRACE("(%p) : stub!\n", This);
169     return D3D_OK;
170 }
171
172 HRESULT  WINAPI  IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
173     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
174     *ppBackBuffer = (LPDIRECT3DSURFACE9) This->backBuffer;
175     TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
176     if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
177         FIXME("Only one backBuffer currently supported\n");
178         return D3DERR_INVALIDCALL;
179     }
180     /* Note inc ref on returned surface */
181     IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppBackBuffer);
182     return D3D_OK;
183 }
184
185 HRESULT  WINAPI  IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
186     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
187     FIXME("(%p) : stub\n", This);    
188     return D3D_OK;
189 }
190
191 HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BOOL bEnableDialogs) {
192     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
193     FIXME("(%p) : stub\n", This);    
194     return D3D_OK;
195 }
196
197 void WINAPI IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
198     HDC hDC;
199     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
200
201     FIXME("(%p) : pRamp@%p\n", This, pRamp);
202     hDC = GetDC(This->win_handle);
203     SetDeviceGammaRamp(hDC, (LPVOID) pRamp);
204     ReleaseDC(This->win_handle, hDC);
205     return;
206 }
207
208 void WINAPI IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DGAMMARAMP* pRamp) {
209     HDC hDC;
210     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
211
212     FIXME("(%p) : pRamp@%p\n", This, pRamp);
213     hDC = GetDC(This->win_handle);
214     GetDeviceGammaRamp(hDC, pRamp);
215     ReleaseDC(This->win_handle, hDC);
216     return;
217 }
218
219 HRESULT  WINAPI  IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
220     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
221     FIXME("(%p) : stub\n", This);    
222     return D3D_OK;
223 }
224
225 HRESULT  WINAPI  IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
226     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
227     FIXME("(%p) : stub\n", This);    
228     return D3D_OK;
229 }
230
231 HRESULT  WINAPI  IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) {
232     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
233     FIXME("(%p) : stub\n", This);
234     return D3D_OK;
235 }
236
237 HRESULT  WINAPI  IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9 iface, IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) {
238     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
239     FIXME("(%p) : stub\n", This);
240     return D3D_OK;
241 }
242
243 HRESULT  WINAPI  IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pDestSurface) {
244     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
245     FIXME("(%p) : stub\n", This);
246     return D3D_OK;
247 }
248
249 HRESULT  WINAPI  IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
250     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
251     FIXME("(%p) : stub\n", This);
252     return D3D_OK;
253 }
254
255 HRESULT  WINAPI  IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
256     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
257     FIXME("(%p) : stub\n", This);
258     return D3D_OK;
259 }
260
261 HRESULT  WINAPI  IDirect3DDevice9Impl_StretchRects(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) {
262     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
263     FIXME("(%p) : stub\n", This);
264     return D3D_OK;
265 }
266
267 HRESULT  WINAPI  IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) {
268     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
269     FIXME("(%p) : stub\n", This);
270     return D3D_OK;
271 }
272
273 HRESULT  WINAPI  IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
274     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
275     FIXME("(%p) : stub\n", This);
276     return D3D_OK;
277 }
278
279 HRESULT  WINAPI  IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
280     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
281     FIXME("(%p) : stub\n", This);
282     return D3D_OK;
283 }
284
285 HRESULT  WINAPI  IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) {
286     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
287     FIXME("(%p) : stub\n", This);
288     return D3D_OK;
289 }
290
291 HRESULT  WINAPI  IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pZStencilSurface) {
292     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
293     FIXME("(%p) : stub\n", This);
294     return D3D_OK;
295 }
296
297 HRESULT  WINAPI  IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9** ppZStencilSurface) {
298     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
299     FIXME("(%p) : stub\n", This);
300     return D3D_OK;
301 }
302
303 HRESULT  WINAPI  IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface) {
304     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
305     TRACE("(%p) : stub\n", This);
306     return D3D_OK;
307 }
308
309 HRESULT  WINAPI  IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface) {
310     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
311     FIXME("(%p) : stub\n", This);
312     return D3D_OK;
313 }
314
315 HRESULT  WINAPI  IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
316     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
317     FIXME("(%p) : stub\n", This);
318     return D3D_OK;
319 }
320
321 HRESULT  WINAPI  IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE d3dts, CONST D3DMATRIX* lpmatrix) {
322     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
323     FIXME("(%p) : stub\n", This);
324     return D3D_OK;
325 }
326
327 HRESULT  WINAPI  IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
328     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
329     TRACE("(%p) : for State %d\n", This, State);
330     memcpy(pMatrix, &This->StateBlock->transforms[State], sizeof(D3DMATRIX));
331     return D3D_OK;
332 }
333
334 HRESULT  WINAPI  IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
335     D3DMATRIX *mat = NULL;
336     D3DMATRIX temp;
337
338     /* Note: Using UpdateStateBlock means it would be recorded in a state block change,
339         but works regardless of recording being on. 
340         If this is found to be wrong, change to StateBlock.                             */
341     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
342     TRACE("(%p) : For state %u\n", This, State);
343
344     if (State < HIGHEST_TRANSFORMSTATE) {
345         mat = &This->UpdateStateBlock->transforms[State];
346     } else {
347         FIXME("Unhandled transform state!!\n");
348     }
349
350     /* Copied from ddraw code:  */
351     temp.u.s._11 = (mat->u.s._11 * pMatrix->u.s._11) + (mat->u.s._21 * pMatrix->u.s._12) + (mat->u.s._31 * pMatrix->u.s._13) + (mat->u.s._41 * pMatrix->u.s._14);
352     temp.u.s._21 = (mat->u.s._11 * pMatrix->u.s._21) + (mat->u.s._21 * pMatrix->u.s._22) + (mat->u.s._31 * pMatrix->u.s._23) + (mat->u.s._41 * pMatrix->u.s._24);
353     temp.u.s._31 = (mat->u.s._11 * pMatrix->u.s._31) + (mat->u.s._21 * pMatrix->u.s._32) + (mat->u.s._31 * pMatrix->u.s._33) + (mat->u.s._41 * pMatrix->u.s._34);
354     temp.u.s._41 = (mat->u.s._11 * pMatrix->u.s._41) + (mat->u.s._21 * pMatrix->u.s._42) + (mat->u.s._31 * pMatrix->u.s._43) + (mat->u.s._41 * pMatrix->u.s._44);
355
356     temp.u.s._12 = (mat->u.s._12 * pMatrix->u.s._11) + (mat->u.s._22 * pMatrix->u.s._12) + (mat->u.s._32 * pMatrix->u.s._13) + (mat->u.s._42 * pMatrix->u.s._14);
357     temp.u.s._22 = (mat->u.s._12 * pMatrix->u.s._21) + (mat->u.s._22 * pMatrix->u.s._22) + (mat->u.s._32 * pMatrix->u.s._23) + (mat->u.s._42 * pMatrix->u.s._24);
358     temp.u.s._32 = (mat->u.s._12 * pMatrix->u.s._31) + (mat->u.s._22 * pMatrix->u.s._32) + (mat->u.s._32 * pMatrix->u.s._33) + (mat->u.s._42 * pMatrix->u.s._34);
359     temp.u.s._42 = (mat->u.s._12 * pMatrix->u.s._41) + (mat->u.s._22 * pMatrix->u.s._42) + (mat->u.s._32 * pMatrix->u.s._43) + (mat->u.s._42 * pMatrix->u.s._44);
360
361     temp.u.s._13 = (mat->u.s._13 * pMatrix->u.s._11) + (mat->u.s._23 * pMatrix->u.s._12) + (mat->u.s._33 * pMatrix->u.s._13) + (mat->u.s._43 * pMatrix->u.s._14);
362     temp.u.s._23 = (mat->u.s._13 * pMatrix->u.s._21) + (mat->u.s._23 * pMatrix->u.s._22) + (mat->u.s._33 * pMatrix->u.s._23) + (mat->u.s._43 * pMatrix->u.s._24);
363     temp.u.s._33 = (mat->u.s._13 * pMatrix->u.s._31) + (mat->u.s._23 * pMatrix->u.s._32) + (mat->u.s._33 * pMatrix->u.s._33) + (mat->u.s._43 * pMatrix->u.s._34);
364     temp.u.s._43 = (mat->u.s._13 * pMatrix->u.s._41) + (mat->u.s._23 * pMatrix->u.s._42) + (mat->u.s._33 * pMatrix->u.s._43) + (mat->u.s._43 * pMatrix->u.s._44);
365
366     temp.u.s._14 = (mat->u.s._14 * pMatrix->u.s._11) + (mat->u.s._24 * pMatrix->u.s._12) + (mat->u.s._34 * pMatrix->u.s._13) + (mat->u.s._44 * pMatrix->u.s._14);
367     temp.u.s._24 = (mat->u.s._14 * pMatrix->u.s._21) + (mat->u.s._24 * pMatrix->u.s._22) + (mat->u.s._34 * pMatrix->u.s._23) + (mat->u.s._44 * pMatrix->u.s._24);
368     temp.u.s._34 = (mat->u.s._14 * pMatrix->u.s._31) + (mat->u.s._24 * pMatrix->u.s._32) + (mat->u.s._34 * pMatrix->u.s._33) + (mat->u.s._44 * pMatrix->u.s._34);
369     temp.u.s._44 = (mat->u.s._14 * pMatrix->u.s._41) + (mat->u.s._24 * pMatrix->u.s._42) + (mat->u.s._34 * pMatrix->u.s._43) + (mat->u.s._44 * pMatrix->u.s._44);
370
371     /* Apply change via set transform - will reapply to eg. lights this way */
372     IDirect3DDevice9Impl_SetTransform(iface, State, &temp);
373     return D3D_OK;
374 }
375
376 HRESULT  WINAPI  IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) {
377     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
378     FIXME("(%p) : stub\n", This);
379     return D3D_OK;
380 }
381
382 HRESULT  WINAPI  IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface, D3DVIEWPORT9* pViewport) {
383     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
384     TRACE("(%p)\n", This);
385     memcpy(pViewport, &This->StateBlock->viewport, sizeof(D3DVIEWPORT9));
386     return D3D_OK;
387 }
388
389 HRESULT  WINAPI  IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) {
390     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
391     FIXME("(%p) : stub\n", This);
392     return D3D_OK;
393 }
394
395 HRESULT  WINAPI  IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface, D3DMATERIAL9* pMaterial) {
396     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
397     memcpy(pMaterial, &This->UpdateStateBlock->material, sizeof (D3DMATERIAL9));
398     TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", This, pMaterial->Diffuse.r, pMaterial->Diffuse.g, pMaterial->Diffuse.b, pMaterial->Diffuse.a);
399     TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", This, pMaterial->Ambient.r, pMaterial->Ambient.g, pMaterial->Ambient.b, pMaterial->Ambient.a);
400     TRACE("(%p) : Specular (%f,%f,%f,%f)\n", This, pMaterial->Specular.r, pMaterial->Specular.g, pMaterial->Specular.b, pMaterial->Specular.a);
401     TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", This, pMaterial->Emissive.r, pMaterial->Emissive.g, pMaterial->Emissive.b, pMaterial->Emissive.a);
402     TRACE("(%p) : Power (%f)\n", This, pMaterial->Power);
403     return D3D_OK;
404 }
405
406 HRESULT  WINAPI  IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST D3DLIGHT9* pLight) {
407     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
408     FIXME("(%p) : stub\n", This);
409     return D3D_OK;
410 }
411
412 HRESULT  WINAPI  IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9 iface, DWORD Index,D3DLIGHT9* pLight) {
413     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
414     FIXME("(%p) : stub\n", This);
415     return D3D_OK;
416 }
417
418 HRESULT  WINAPI  IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL Enable) {
419     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
420     FIXME("(%p) : stub\n", This);
421     return D3D_OK;
422 }
423
424 HRESULT  WINAPI  IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL* pEnable) {
425     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
426     FIXME("(%p) : stub\n", This);
427     return D3D_OK;
428 }
429
430 HRESULT  WINAPI  IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST float* pPlane) {
431     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
432     FIXME("(%p) : stub\n", This);
433     return D3D_OK;
434 }
435
436 HRESULT  WINAPI  IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, float* pPlane) {
437     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
438     FIXME("(%p) : stub\n", This);
439     return D3D_OK;
440 }
441
442 HRESULT  WINAPI  IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD Value) {
443     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
444     FIXME("(%p) : stub\n", This);
445     return D3D_OK;
446 }
447
448 HRESULT  WINAPI  IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD* pValue) {
449     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
450     TRACE("(%p) for State %d = %ld\n", This, State, This->UpdateStateBlock->renderstate[State]);
451     *pValue = This->StateBlock->renderstate[State];
452     return D3D_OK;
453 }
454
455 HRESULT  WINAPI  IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface, CONST D3DCLIPSTATUS9* pClipStatus) {
456     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
457     FIXME("(%p) : stub\n", This);
458     return D3D_OK;
459 }
460
461 HRESULT  WINAPI  IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9 iface, D3DCLIPSTATUS9* pClipStatus) {
462     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
463     FIXME("(%p) : stub\n", This);
464     return D3D_OK;
465 }
466
467 HRESULT  WINAPI  IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9** ppTexture) {
468     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
469     TRACE("(%p) : returning %p for stage %ld\n", This, This->UpdateStateBlock->textures[Stage], Stage);
470     *ppTexture = (LPDIRECT3DBASETEXTURE9) This->UpdateStateBlock->textures[Stage];
471     IDirect3DBaseTexture9Impl_AddRef(*ppTexture);
472     return D3D_OK;
473 }
474
475 HRESULT  WINAPI  IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) {
476     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
477     FIXME("(%p) : stub\n", This);
478     return D3D_OK;
479 }
480
481 HRESULT  WINAPI  IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
482     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
483     TRACE("(%p) : requesting Stage %ld, Type %d getting %ld\n", This, Stage, Type, This->UpdateStateBlock->texture_state[Stage][Type]);
484     *pValue = This->UpdateStateBlock->texture_state[Stage][Type];
485     return D3D_OK;
486 }
487
488 HRESULT  WINAPI  IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
489     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
490     FIXME("(%p) : stub\n", This);
491     return D3D_OK;
492 }
493
494 HRESULT  WINAPI  IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) {
495     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
496     FIXME("(%p) : stub\n", This);
497     return D3D_OK;
498 }
499
500 HRESULT  WINAPI  IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) {
501     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
502     FIXME("(%p) : stub\n", This);
503     return D3D_OK;
504 }
505
506 HRESULT  WINAPI  IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9 iface, DWORD* pNumPasses) {
507     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
508     TRACE("(%p) : stub\n", This);
509     return D3D_OK;
510 }
511
512 HRESULT  WINAPI  IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
513     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
514     FIXME("(%p) : setting p[%u] <= RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber, pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
515     memcpy(This->palettes[PaletteNumber], pEntries, 256 * sizeof(PALETTEENTRY));
516     return D3D_OK;
517 }
518
519 HRESULT  WINAPI  IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
520     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
521     memcpy(pEntries, This->palettes[PaletteNumber], 256 * sizeof(PALETTEENTRY));
522     FIXME("(%p) : returning p[%u] => RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber, pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
523     return D3D_OK;
524 }
525
526 HRESULT  WINAPI  IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber) {
527     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
528     TRACE("(%p) : stub\n", This);
529     return D3D_OK;
530 }
531
532 HRESULT  WINAPI  IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT* PaletteNumber) {
533     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
534     *PaletteNumber = This->currentPalette;
535     FIXME("(%p) : Returning (%u)\n", This, *PaletteNumber);
536     return D3D_OK;
537 }
538
539 HRESULT  WINAPI  IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9 iface, CONST RECT* pRect) {
540     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
541     FIXME("(%p) : stub\n", This);
542     return D3D_OK;
543 }
544
545 HRESULT  WINAPI  IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9 iface, RECT* pRect) {
546     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
547     FIXME("(%p) : stub\n", This);
548     return D3D_OK;
549 }
550
551 HRESULT  WINAPI  IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface, BOOL bSoftware) {
552     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
553     FIXME("(%p) : stub\n", This);
554     return D3D_OK;
555 }
556
557 BOOL     WINAPI  IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface) {
558     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
559     FIXME("(%p) : stub\n", This);
560     return D3D_OK;
561 }
562
563 HRESULT  WINAPI  IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9 iface, float nSegments) {
564     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
565     FIXME("(%p) : stub\n", This);
566     return D3D_OK;
567 }
568
569 float    WINAPI  IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface) {
570     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
571     FIXME("(%p) : stub\n", This);
572     return 0.0f;
573 }
574
575 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
576     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
577     FIXME("(%p) : stub\n", This);
578     return D3D_OK;
579 }
580
581 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType,
582                                                            INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
583     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
584     FIXME("(%p) : stub\n", This);
585     return D3D_OK;
586 }
587
588 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
589     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
590     FIXME("(%p) : stub\n", This);
591     return D3D_OK;
592 }
593
594 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex,
595                                                              UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData,
596                                                              D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
597     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
598     FIXME("(%p) : stub\n", This);
599     return D3D_OK;
600 }
601
602 HRESULT  WINAPI  IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) {
603     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
604     FIXME("(%p) : stub\n", This);
605     return D3D_OK;
606 }
607
608 HRESULT  WINAPI  IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface, DWORD FVF) {
609     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
610     FIXME("(%p) : stub\n", This);    
611     return D3D_OK;
612 }
613
614 HRESULT  WINAPI  IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface, DWORD* pFVF) {
615     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
616     FIXME("(%p) : stub\n", This);    
617     return D3D_OK;
618 }
619
620 HRESULT  WINAPI  IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
621     IDirect3DVertexBuffer9 *oldSrc;
622     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
623
624     oldSrc = This->StateBlock->stream_source[StreamNumber];
625     TRACE("(%p) : StreamNo: %d, OldStream (%p), NewStream (%p), NewStride %d\n", This, StreamNumber, oldSrc, pStreamData, Stride);
626
627     This->UpdateStateBlock->Changed.stream_source[StreamNumber] = TRUE;
628     This->UpdateStateBlock->Set.stream_source[StreamNumber] = TRUE;
629     This->UpdateStateBlock->stream_stride[StreamNumber] = Stride;
630     This->UpdateStateBlock->stream_source[StreamNumber] = pStreamData;
631
632     /* Handle recording of state blocks */
633     if (This->isRecordingState) {
634         TRACE("Recording... not performing anything\n");
635         return D3D_OK;
636     }
637
638     if (oldSrc != NULL) IDirect3DVertexBuffer9Impl_Release(oldSrc);
639     if (pStreamData != NULL) IDirect3DVertexBuffer9Impl_AddRef(pStreamData);
640     return D3D_OK;
641 }
642
643 HRESULT  WINAPI  IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9** pStream, UINT* OffsetInBytes, UINT* pStride) {
644     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
645     TRACE("(%p) : StreamNo: %d, Stream (%p), Stride %d\n", This, StreamNumber, This->StateBlock->stream_source[StreamNumber], This->StateBlock->stream_stride[StreamNumber]);
646     *pStream = This->StateBlock->stream_source[StreamNumber];
647     *pStride = This->StateBlock->stream_stride[StreamNumber];
648     IDirect3DVertexBuffer9Impl_AddRef((LPDIRECT3DVERTEXBUFFER9) *pStream);
649     return D3D_OK;
650 }
651
652 HRESULT  WINAPI  IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT Divider) {
653     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
654     FIXME("(%p) : stub\n", This); 
655     return D3D_OK;
656 }
657
658 HRESULT  WINAPI  IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT* Divider) {
659     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
660     FIXME("(%p) : stub\n", This); 
661     return D3D_OK;
662 }
663
664 HRESULT  WINAPI  IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9* pIndexData) {
665     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
666     IDirect3DIndexBuffer9 *oldIdxs;
667
668     TRACE("(%p) : Setting to %p\n", This, pIndexData);
669     oldIdxs = This->StateBlock->pIndexData;
670
671     This->UpdateStateBlock->Changed.Indices = TRUE;
672     This->UpdateStateBlock->Set.Indices = TRUE;
673     This->UpdateStateBlock->pIndexData = pIndexData;
674
675     /* Handle recording of state blocks */
676     if (This->isRecordingState) {
677         TRACE("Recording... not performing anything\n");
678         return D3D_OK;
679     }
680
681     if (oldIdxs) IDirect3DIndexBuffer9Impl_Release(oldIdxs);
682     if (pIndexData) IDirect3DIndexBuffer9Impl_AddRef(This->StateBlock->pIndexData);
683     return D3D_OK;
684 }
685
686 HRESULT  WINAPI  IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9** ppIndexData) {
687     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
688     FIXME("(%p) : stub\n", This);
689
690     *ppIndexData = This->StateBlock->pIndexData;
691     /* up ref count on ppindexdata */
692     if (*ppIndexData) IDirect3DIndexBuffer9Impl_AddRef(*ppIndexData);
693
694     return D3D_OK;
695 }
696
697 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
698     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
699     FIXME("(%p) : stub\n", This);    
700     return D3D_OK;
701 }
702
703 HRESULT  WINAPI  IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
704     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
705     FIXME("(%p) : stub\n", This);    
706     return D3D_OK;
707 }
708
709 HRESULT  WINAPI  IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9 iface, UINT Handle) {
710     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
711     FIXME("(%p) : stub\n", This);
712     return D3D_OK;
713 }
714
715
716 IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl =
717 {
718     IDirect3DDevice9Impl_QueryInterface,
719     IDirect3DDevice9Impl_AddRef,
720     IDirect3DDevice9Impl_Release,
721     IDirect3DDevice9Impl_TestCooperativeLevel,
722     IDirect3DDevice9Impl_GetAvailableTextureMem,
723     IDirect3DDevice9Impl_EvictManagedRessources,
724     IDirect3DDevice9Impl_GetDirect3D,
725     IDirect3DDevice9Impl_GetDeviceCaps,
726     IDirect3DDevice9Impl_GetDisplayMode,
727     IDirect3DDevice9Impl_GetCreationParameters,
728     IDirect3DDevice9Impl_SetCursorProperties,
729     IDirect3DDevice9Impl_SetCursorPosition,
730     IDirect3DDevice9Impl_ShowCursor,
731     IDirect3DDevice9Impl_CreateAdditionalSwapChain,
732     IDirect3DDevice9Impl_GetSwapChain,
733     IDirect3DDevice9Impl_GetNumberOfSwapChains,
734     IDirect3DDevice9Impl_Reset,
735     IDirect3DDevice9Impl_Present,
736     IDirect3DDevice9Impl_GetBackBuffer,
737     IDirect3DDevice9Impl_GetRasterStatus,
738     IDirect3DDevice9Impl_SetDialogBoxMode,
739     IDirect3DDevice9Impl_SetGammaRamp,
740     IDirect3DDevice9Impl_GetGammaRamp,
741     IDirect3DDevice9Impl_CreateTexture,
742     IDirect3DDevice9Impl_CreateVolumeTexture,
743     IDirect3DDevice9Impl_CreateCubeTexture,
744     IDirect3DDevice9Impl_CreateVertexBuffer,
745     IDirect3DDevice9Impl_CreateIndexBuffer,
746     IDirect3DDevice9Impl_CreateRenderTarget,
747     IDirect3DDevice9Impl_CreateDepthStencilSurface,
748     IDirect3DDevice9Impl_UpdateSurface,
749     IDirect3DDevice9Impl_UpdateTexture,
750     IDirect3DDevice9Impl_GetRenderTargetData,
751     IDirect3DDevice9Impl_GetFrontBufferData,
752     IDirect3DDevice9Impl_StretchRects,
753     IDirect3DDevice9Impl_ColorFill,
754     IDirect3DDevice9Impl_CreateOffscreenPlainSurface,
755     IDirect3DDevice9Impl_SetRenderTarget,
756     IDirect3DDevice9Impl_GetRenderTarget,
757     IDirect3DDevice9Impl_SetDepthStencilSurface,
758     IDirect3DDevice9Impl_GetDepthStencilSurface,
759     IDirect3DDevice9Impl_BeginScene,
760     IDirect3DDevice9Impl_EndScene,
761     IDirect3DDevice9Impl_Clear,
762     IDirect3DDevice9Impl_SetTransform,
763     IDirect3DDevice9Impl_GetTransform,
764     IDirect3DDevice9Impl_MultiplyTransform,
765     IDirect3DDevice9Impl_SetViewport,
766     IDirect3DDevice9Impl_GetViewport,
767     IDirect3DDevice9Impl_SetMaterial,
768     IDirect3DDevice9Impl_GetMaterial,
769     IDirect3DDevice9Impl_SetLight,
770     IDirect3DDevice9Impl_GetLight,
771     IDirect3DDevice9Impl_LightEnable,
772     IDirect3DDevice9Impl_GetLightEnable,
773     IDirect3DDevice9Impl_SetClipPlane,
774     IDirect3DDevice9Impl_GetClipPlane,
775     IDirect3DDevice9Impl_SetRenderState,
776     IDirect3DDevice9Impl_GetRenderState,
777     IDirect3DDevice9Impl_CreateStateBlock,
778     IDirect3DDevice9Impl_BeginStateBlock,
779     IDirect3DDevice9Impl_EndStateBlock,
780     IDirect3DDevice9Impl_SetClipStatus,
781     IDirect3DDevice9Impl_GetClipStatus,
782     IDirect3DDevice9Impl_GetTexture,
783     IDirect3DDevice9Impl_SetTexture,
784     IDirect3DDevice9Impl_GetTextureStageState,
785     IDirect3DDevice9Impl_SetTextureStageState,
786     IDirect3DDevice9Impl_GetSamplerState,
787     IDirect3DDevice9Impl_SetSamplerState,
788     IDirect3DDevice9Impl_ValidateDevice,
789     IDirect3DDevice9Impl_SetPaletteEntries,
790     IDirect3DDevice9Impl_GetPaletteEntries,
791     IDirect3DDevice9Impl_SetCurrentTexturePalette,
792     IDirect3DDevice9Impl_GetCurrentTexturePalette,
793     IDirect3DDevice9Impl_SetScissorRect,
794     IDirect3DDevice9Impl_GetScissorRect,
795     IDirect3DDevice9Impl_SetSoftwareVertexProcessing,
796     IDirect3DDevice9Impl_GetSoftwareVertexProcessing,
797     IDirect3DDevice9Impl_SetNPatchMode,
798     IDirect3DDevice9Impl_GetNPatchMode,
799     IDirect3DDevice9Impl_DrawPrimitive,
800     IDirect3DDevice9Impl_DrawIndexedPrimitive,
801     IDirect3DDevice9Impl_DrawPrimitiveUP,
802     IDirect3DDevice9Impl_DrawIndexedPrimitiveUP,
803     IDirect3DDevice9Impl_ProcessVertices,
804     IDirect3DDevice9Impl_CreateVertexDeclaration,
805     IDirect3DDevice9Impl_SetVertexDeclaration,
806     IDirect3DDevice9Impl_GetVertexDeclaration,
807     IDirect3DDevice9Impl_SetFVF,
808     IDirect3DDevice9Impl_GetFVF,
809     IDirect3DDevice9Impl_CreateVertexShader,
810     IDirect3DDevice9Impl_SetVertexShader,
811     IDirect3DDevice9Impl_GetVertexShader,
812     IDirect3DDevice9Impl_SetVertexShaderConstantF,
813     IDirect3DDevice9Impl_GetVertexShaderConstantF,
814     IDirect3DDevice9Impl_SetVertexShaderConstantI,
815     IDirect3DDevice9Impl_GetVertexShaderConstantI,
816     IDirect3DDevice9Impl_SetVertexShaderConstantB,
817     IDirect3DDevice9Impl_GetVertexShaderConstantB,
818     IDirect3DDevice9Impl_SetStreamSource,
819     IDirect3DDevice9Impl_GetStreamSource,
820     IDirect3DDevice9Impl_SetStreamSourceFreq,
821     IDirect3DDevice9Impl_GetStreamSourceFreq,
822     IDirect3DDevice9Impl_SetIndices,
823     IDirect3DDevice9Impl_GetIndices,
824     IDirect3DDevice9Impl_CreatePixelShader,
825     IDirect3DDevice9Impl_SetPixelShader,
826     IDirect3DDevice9Impl_GetPixelShader,
827     IDirect3DDevice9Impl_SetPixelShaderConstantF,
828     IDirect3DDevice9Impl_GetPixelShaderConstantF,
829     IDirect3DDevice9Impl_SetPixelShaderConstantI,
830     IDirect3DDevice9Impl_GetPixelShaderConstantI,
831     IDirect3DDevice9Impl_SetPixelShaderConstantB,
832     IDirect3DDevice9Impl_GetPixelShaderConstantB,
833     IDirect3DDevice9Impl_DrawRectPatch,
834     IDirect3DDevice9Impl_DrawTriPatch,
835     IDirect3DDevice9Impl_DeletePatch,
836     IDirect3DDevice9Impl_CreateQuery
837 };