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