2 * Copyright (c) 1998 Lionel ULMER
4 * This file contains all the common stuff for D3D devices.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/debug.h"
32 #include "d3d_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
37 DWORD InitRenderStateTab[] = {
38 D3DRENDERSTATE_TEXTUREHANDLE, (DWORD)NULL,
39 D3DRENDERSTATE_ANTIALIAS, D3DANTIALIAS_NONE,
40 /* FIXME: D3DRENDERSTATE_TEXTUREADDRESS */
41 D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE,
42 /* FIXME: D3DRENDERSTATE_WRAPU */
43 /* FIXME: D3DRENDERSTATE_WRAPV */
44 D3DRENDERSTATE_ZENABLE, D3DZB_TRUE, /* This needs to be set differently according to the Z buffer status */
45 D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID,
46 D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD,
47 D3DRENDERSTATE_LINEPATTERN, 0,
48 D3DRENDERSTATE_MONOENABLE, FALSE,
49 D3DRENDERSTATE_ROP2, R2_COPYPEN,
50 D3DRENDERSTATE_PLANEMASK, 0xFFFFFFFF,
51 D3DRENDERSTATE_ZWRITEENABLE, TRUE,
52 D3DRENDERSTATE_ALPHATESTENABLE, FALSE,
53 D3DRENDERSTATE_LASTPIXEL, TRUE,
54 D3DRENDERSTATE_TEXTUREMAG, D3DFILTER_NEAREST,
55 D3DRENDERSTATE_TEXTUREMIN, D3DFILTER_NEAREST,
56 D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE,
57 D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO,
58 D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE,
59 D3DRENDERSTATE_CULLMODE, D3DCULL_CCW,
60 D3DRENDERSTATE_ZFUNC, D3DCMP_LESSEQUAL,
61 D3DRENDERSTATE_ALPHAREF, 0,
62 D3DRENDERSTATE_ALPHAFUNC, D3DCMP_ALWAYS,
63 D3DRENDERSTATE_DITHERENABLE, FALSE,
64 D3DRENDERSTATE_ALPHABLENDENABLE, FALSE,
65 D3DRENDERSTATE_FOGENABLE, FALSE,
66 D3DRENDERSTATE_SPECULARENABLE, FALSE,
67 D3DRENDERSTATE_ZVISIBLE, FALSE,
68 D3DRENDERSTATE_SUBPIXEL, FALSE,
69 D3DRENDERSTATE_SUBPIXELX, FALSE,
70 D3DRENDERSTATE_STIPPLEDALPHA, FALSE,
71 D3DRENDERSTATE_FOGCOLOR, D3DRGBA(0,0,0,0),
72 D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_NONE,
73 /* FIXME: D3DRENDERSTATE_FOGTABLESTART (same as D3DRENDERSTATE_FOGSTART) */
74 /* FIXME: D3DRENDERSTATE_FOGTABLEEND (same as D3DRENDERSTATE_FOGEND) */
75 D3DRENDERSTATE_FOGTABLEDENSITY, 0x3F80000, /* 1.0f (same as D3DRENDERSTATE_FOGDENSITY) */
76 /* FIXME: D3DRENDERSTATE_STIPPLEENABLE */
77 D3DRENDERSTATE_EDGEANTIALIAS, FALSE,
78 D3DRENDERSTATE_COLORKEYENABLE, FALSE,
79 /* FIXME: D3DRENDERSTATE_BORDERCOLOR */
80 D3DRENDERSTATE_TEXTUREADDRESSU, D3DTADDRESS_WRAP,
81 D3DRENDERSTATE_TEXTUREADDRESSV, D3DTADDRESS_WRAP,
82 D3DRENDERSTATE_MIPMAPLODBIAS, 0x00000000, /* 0.0f */
83 D3DRENDERSTATE_ZBIAS, 0,
84 D3DRENDERSTATE_RANGEFOGENABLE, FALSE,
85 /* FIXME: D3DRENDERSTATE_ANISOTROPY */
86 /* FIXME: D3DRENDERSTATE_FLUSHBATCH */
87 /* FIXME: D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT */
88 D3DRENDERSTATE_STENCILENABLE, FALSE,
89 D3DRENDERSTATE_STENCILFAIL, D3DSTENCILOP_KEEP,
90 D3DRENDERSTATE_STENCILZFAIL, D3DSTENCILOP_KEEP,
91 D3DRENDERSTATE_STENCILPASS, D3DSTENCILOP_KEEP,
92 D3DRENDERSTATE_STENCILFUNC, D3DCMP_ALWAYS,
93 D3DRENDERSTATE_STENCILREF, 0,
94 D3DRENDERSTATE_STENCILMASK, 0xFFFFFFFF,
95 D3DRENDERSTATE_STENCILWRITEMASK, 0xFFFFFFFF,
96 /* FIXME: D3DRENDERSTATE_TEXTUREFACTOR */
97 /* FIXME: D3DRENDERSTATE_STIPPLEPATTERN00..31 */
98 D3DRENDERSTATE_WRAP0, 0,
99 D3DRENDERSTATE_WRAP1, 0,
100 D3DRENDERSTATE_WRAP2, 0,
101 D3DRENDERSTATE_WRAP3, 0,
102 D3DRENDERSTATE_WRAP4, 0,
103 D3DRENDERSTATE_WRAP5, 0,
104 D3DRENDERSTATE_WRAP6, 0,
105 D3DRENDERSTATE_WRAP7, 0,
106 D3DRENDERSTATE_CLIPPING, FALSE,
107 D3DRENDERSTATE_LIGHTING, TRUE,
108 D3DRENDERSTATE_EXTENTS, FALSE,
109 D3DRENDERSTATE_AMBIENT, D3DRGBA(0,0,0,0),
110 D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE,
111 D3DRENDERSTATE_COLORVERTEX, TRUE,
112 D3DRENDERSTATE_LOCALVIEWER, TRUE,
113 D3DRENDERSTATE_NORMALIZENORMALS, FALSE,
114 /* FIXME: D3DRENDER_STATE_COLORKEYBLENDENABLE */
115 D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1,
116 D3DRENDERSTATE_SPECULARMATERIALSOURCE, D3DMCS_COLOR2,
117 D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2,
118 D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL,
119 D3DRENDERSTATE_VERTEXBLEND, D3DVBLEND_DISABLE,
120 D3DRENDERSTATE_CLIPPLANEENABLE, 0
123 DWORD InitLightStateTab[] = {
124 D3DLIGHTSTATE_MATERIAL, (DWORD)NULL,
125 D3DLIGHTSTATE_AMBIENT, D3DRGBA(0,0,0,0),
126 D3DLIGHTSTATE_COLORMODEL, D3DCOLOR_RGB,
127 D3DLIGHTSTATE_FOGMODE, D3DFOG_NONE,
128 D3DLIGHTSTATE_FOGSTART, 0x3F80000, /* 1.0f */
129 D3DLIGHTSTATE_FOGEND, 0x42C8000, /* 100.0f */
130 D3DLIGHTSTATE_FOGDENSITY, 0x3F80000 /* 1.0f */
131 /* FIXME: D3DLIGHTSTATE_COLORVERTEX */
134 DWORD InitTextureStageStateTab[] = {
135 D3DTSS_COLOROP, D3DTOP_DISABLE, /* Note, it's manually set for stage 0 */
136 D3DTSS_COLORARG1, D3DTA_TEXTURE,
137 D3DTSS_COLORARG2, D3DTA_CURRENT,
138 D3DTSS_ALPHAOP, D3DTOP_DISABLE, /* Note, it's manually set for stage 0 */
139 D3DTSS_ALPHAARG1, D3DTA_TEXTURE,
140 D3DTSS_ALPHAARG2, D3DTA_CURRENT,
141 /* FIXME: D3DTSS_BUMPENVMAT00,01,10,11 */
142 /* D3DTSS_TEXCOORDINDEX is set manually */
143 D3DTSS_ADDRESS, D3DTADDRESS_WRAP,
144 D3DTSS_ADDRESSU, D3DTADDRESS_WRAP,
145 D3DTSS_ADDRESSV, D3DTADDRESS_WRAP,
146 D3DTSS_BORDERCOLOR, 0x00000000,
147 D3DTSS_MAGFILTER, D3DTFG_POINT,
148 D3DTSS_MINFILTER, D3DTFN_POINT,
149 D3DTSS_MIPFILTER, D3DTFP_NONE,
150 D3DTSS_MIPMAPLODBIAS, 0x00000000, /* 0.0f */
151 D3DTSS_MAXMIPLEVEL, 0,
152 /* D3DTSS_MAXANISOTROPY, 1, */ /* This is to prevent warnings :-) */
153 /* FIXME: D3DTSS_BUMPENVLSCALE */
154 /* FIXME: D3DTSS_NUMPENVLOFFSET */
155 /* FIXME: D3DTSS_TEXTURETRANSFORMFLAGS */
159 void InitDefaultStateBlock(STATEBLOCK* lpStateBlock, int version)
162 TRACE("(%p,%d)\n", lpStateBlock, version);
163 memset(lpStateBlock, 0, sizeof(STATEBLOCK));
165 /* Initialize render states */
166 for (i = 0; i < sizeof(InitRenderStateTab) / sizeof(InitRenderStateTab[0]); i += 2)
168 lpStateBlock->render_state[InitRenderStateTab[i] - 1] = InitRenderStateTab[i + 1];
169 lpStateBlock->set_flags.render_state[InitRenderStateTab[i] - 1] = TRUE;
172 /* Initialize texture stages states */
173 for (i = 0; i < MAX_TEXTURES; i++)
175 for (j = 0; j < sizeof(InitTextureStageStateTab) / sizeof(InitTextureStageStateTab[0]); j += 2)
177 lpStateBlock->texture_stage_state[i][InitTextureStageStateTab[j] - 1] = InitTextureStageStateTab[j + 1];
178 lpStateBlock->set_flags.texture_stage_state[i][InitTextureStageStateTab[j] - 1] = TRUE;
180 /* Map texture coords 0 to stage 0, 1 to stage 1, etc... */
181 lpStateBlock->texture_stage_state[i][D3DTSS_TEXCOORDINDEX - 1] = i;
182 lpStateBlock->set_flags.texture_stage_state[i][D3DTSS_TEXCOORDINDEX - 1] = TRUE;
185 /* The first texture is particular, update it consequently */
186 lpStateBlock->texture_stage_state[0][D3DTSS_COLOROP - 1] = D3DTOP_MODULATE;
187 lpStateBlock->texture_stage_state[0][D3DTSS_ALPHAOP - 1] = D3DTOP_SELECTARG1;
188 lpStateBlock->texture_stage_state[0][D3DTSS_COLORARG2 - 1] = D3DTA_DIFFUSE;
189 lpStateBlock->texture_stage_state[0][D3DTSS_ALPHAARG2 - 1] = D3DTA_DIFFUSE;
191 /* Updates for particular versions */
192 if ((version == 1) || (version==2))
193 lpStateBlock->render_state[D3DRENDERSTATE_SPECULARENABLE - 1] = TRUE;
197 Main_IDirect3DDeviceImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3DDEVICE7 iface,
201 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
202 TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
206 if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
207 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
209 TRACE(" Creating IUnknown interface at %p.\n", *obp);
212 if ( IsEqualGUID( &IID_IDirect3DDevice, riid ) ) {
213 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
214 *obp = ICOM_INTERFACE(This, IDirect3DDevice);
215 TRACE(" Creating IDirect3DDevice interface %p\n", *obp);
218 if ( IsEqualGUID( &IID_IDirect3DDevice2, riid ) ) {
219 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
220 *obp = ICOM_INTERFACE(This, IDirect3DDevice2);
221 TRACE(" Creating IDirect3DDevice2 interface %p\n", *obp);
224 if ( IsEqualGUID( &IID_IDirect3DDevice3, riid ) ) {
225 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
226 *obp = ICOM_INTERFACE(This, IDirect3DDevice3);
227 TRACE(" Creating IDirect3DDevice3 interface %p\n", *obp);
230 if ( IsEqualGUID( &IID_IDirect3DDevice7, riid ) ) {
231 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
232 *obp = ICOM_INTERFACE(This, IDirect3DDevice7);
233 TRACE(" Creating IDirect3DDevice7 interface %p\n", *obp);
236 FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
237 return OLE_E_ENUM_NOMORE;
241 Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef(LPDIRECT3DDEVICE7 iface)
243 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
244 TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
245 return ++(This->ref);
249 Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
251 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
252 TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
253 if (!--(This->ref)) {
255 /* Release texture associated with the device */
256 for (i = 0; i < MAX_TEXTURES; i++) {
257 if (This->current_texture[i] != NULL)
258 IDirect3DTexture2_Release(ICOM_INTERFACE(This->current_texture[i], IDirect3DTexture2));
261 HeapFree(GetProcessHeap(), 0, This);
268 Main_IDirect3DDeviceImpl_7_GetCaps(LPDIRECT3DDEVICE7 iface,
269 LPD3DDEVICEDESC7 lpD3DHELDevDesc)
271 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
272 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DHELDevDesc);
277 Main_IDirect3DDeviceImpl_7_3T_EnumTextureFormats(LPDIRECT3DDEVICE7 iface,
278 LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
281 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
282 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DEnumPixelProc, lpArg);
287 Main_IDirect3DDeviceImpl_7_3T_2T_1T_BeginScene(LPDIRECT3DDEVICE7 iface)
289 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
290 TRACE("(%p/%p)->()\n", This, iface);
296 Main_IDirect3DDeviceImpl_7_3T_2T_1T_EndScene(LPDIRECT3DDEVICE7 iface)
298 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
299 TRACE("(%p/%p)->()\n", This, iface);
305 Main_IDirect3DDeviceImpl_7_3T_2T_1T_GetDirect3D(LPDIRECT3DDEVICE7 iface,
306 LPDIRECT3D7* lplpDirect3D3)
308 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
309 TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3D3);
311 *lplpDirect3D3 = ICOM_INTERFACE(This->d3d, IDirect3D7);
312 IDirect3D7_AddRef(ICOM_INTERFACE(This->d3d, IDirect3D7));
314 TRACE(" returning interface %p\n", *lplpDirect3D3);
319 Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderTarget(LPDIRECT3DDEVICE7 iface,
320 LPDIRECTDRAWSURFACE7 lpNewRenderTarget,
323 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
324 IDirectDrawSurfaceImpl *target_impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpNewRenderTarget);
326 TRACE("(%p/%p)->(%p,%08lx)\n", This, iface, lpNewRenderTarget, dwFlags);
327 if (target_impl != This->surface) {
328 WARN(" Change of rendering target not handled yet !\n");
334 Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderTarget(LPDIRECT3DDEVICE7 iface,
335 LPDIRECTDRAWSURFACE7* lplpRenderTarget)
337 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
338 TRACE("(%p/%p)->(%p)\n", This, iface, lplpRenderTarget);
340 *lplpRenderTarget = ICOM_INTERFACE(This->surface, IDirectDrawSurface7);
341 IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->surface, IDirectDrawSurface7));
343 TRACE(" returning surface at %p.\n", *lplpRenderTarget);
349 Main_IDirect3DDeviceImpl_7_Clear(LPDIRECT3DDEVICE7 iface,
357 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
358 TRACE("(%p/%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, iface, dwCount, lpRects, dwFlags, (DWORD) dwColor, dvZ, dwStencil);
359 return This->clear(This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
363 Main_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface,
364 D3DTRANSFORMSTATETYPE dtstTransformStateType,
365 LPD3DMATRIX lpD3DMatrix)
367 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
368 DWORD matrix_changed = 0x00000000;
370 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
372 switch (dtstTransformStateType) {
373 case D3DTRANSFORMSTATE_WORLD: {
374 if (TRACE_ON(ddraw)) {
375 TRACE(" D3DTRANSFORMSTATE_WORLD :\n"); dump_D3DMATRIX(lpD3DMatrix);
377 memcpy(This->world_mat, lpD3DMatrix, 16 * sizeof(float));
378 matrix_changed = WORLDMAT_CHANGED;
381 case D3DTRANSFORMSTATE_VIEW: {
382 if (TRACE_ON(ddraw)) {
383 TRACE(" D3DTRANSFORMSTATE_VIEW :\n"); dump_D3DMATRIX(lpD3DMatrix);
385 memcpy(This->view_mat, lpD3DMatrix, 16 * sizeof(float));
386 matrix_changed = VIEWMAT_CHANGED;
389 case D3DTRANSFORMSTATE_PROJECTION: {
390 if (TRACE_ON(ddraw)) {
391 TRACE(" D3DTRANSFORMSTATE_PROJECTION :\n"); dump_D3DMATRIX(lpD3DMatrix);
393 memcpy(This->proj_mat, lpD3DMatrix, 16 * sizeof(float));
394 matrix_changed = PROJMAT_CHANGED;
398 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
402 if (matrix_changed != 0x00000000) This->matrices_updated(This, matrix_changed);
408 Main_IDirect3DDeviceImpl_7_3T_2T_GetTransform(LPDIRECT3DDEVICE7 iface,
409 D3DTRANSFORMSTATETYPE dtstTransformStateType,
410 LPD3DMATRIX lpD3DMatrix)
412 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
413 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
415 switch (dtstTransformStateType) {
416 case D3DTRANSFORMSTATE_WORLD: {
417 memcpy(lpD3DMatrix, This->world_mat, 16 * sizeof(D3DVALUE));
418 if (TRACE_ON(ddraw)) {
419 TRACE(" returning D3DTRANSFORMSTATE_WORLD :\n");
420 dump_D3DMATRIX(lpD3DMatrix);
424 case D3DTRANSFORMSTATE_VIEW: {
425 memcpy(lpD3DMatrix, This->view_mat, 16 * sizeof(D3DVALUE));
426 if (TRACE_ON(ddraw)) {
427 TRACE(" returning D3DTRANSFORMSTATE_VIEW :\n");
428 dump_D3DMATRIX(lpD3DMatrix);
432 case D3DTRANSFORMSTATE_PROJECTION: {
433 memcpy(lpD3DMatrix, This->proj_mat, 16 * sizeof(D3DVALUE));
434 if (TRACE_ON(ddraw)) {
435 TRACE(" returning D3DTRANSFORMSTATE_PROJECTION :\n");
436 dump_D3DMATRIX(lpD3DMatrix);
441 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
442 return DDERR_INVALIDPARAMS;
449 Main_IDirect3DDeviceImpl_7_3T_2T_MultiplyTransform(LPDIRECT3DDEVICE7 iface,
450 D3DTRANSFORMSTATETYPE dtstTransformStateType,
451 LPD3DMATRIX lpD3DMatrix)
453 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
456 DWORD matrix_changed = 0x00000000;
458 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
460 if (TRACE_ON(ddraw)) {
461 TRACE(" Multiplying by :\n"); dump_D3DMATRIX(lpD3DMatrix);
464 switch (dtstTransformStateType) {
465 case D3DTRANSFORMSTATE_WORLD: {
466 if (TRACE_ON(ddraw)) {
467 TRACE(" Resulting D3DTRANSFORMSTATE_WORLD matrix is :\n");
469 mat = This->world_mat;
470 matrix_changed = WORLDMAT_CHANGED;
473 case D3DTRANSFORMSTATE_VIEW: {
474 if (TRACE_ON(ddraw)) {
475 TRACE(" Resulting D3DTRANSFORMSTATE_VIEW matrix is :\n");
477 mat = This->view_mat;
478 matrix_changed = VIEWMAT_CHANGED;
481 case D3DTRANSFORMSTATE_PROJECTION: {
482 if (TRACE_ON(ddraw)) {
483 TRACE(" Resulting D3DTRANSFORMSTATE_PROJECTION matrix is :\n");
485 mat = This->proj_mat;
486 matrix_changed = PROJMAT_CHANGED;
490 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
491 return DDERR_INVALIDPARAMS;
494 /* Now do the multiplication 'by hand'.
495 I know that all this could be optimised, but this will be done later :-) */
496 temp._11 = (mat->_11 * lpD3DMatrix->_11) + (mat->_21 * lpD3DMatrix->_12) + (mat->_31 * lpD3DMatrix->_13) + (mat->_41 * lpD3DMatrix->_14);
497 temp._21 = (mat->_11 * lpD3DMatrix->_21) + (mat->_21 * lpD3DMatrix->_22) + (mat->_31 * lpD3DMatrix->_23) + (mat->_41 * lpD3DMatrix->_24);
498 temp._31 = (mat->_11 * lpD3DMatrix->_31) + (mat->_21 * lpD3DMatrix->_32) + (mat->_31 * lpD3DMatrix->_33) + (mat->_41 * lpD3DMatrix->_34);
499 temp._41 = (mat->_11 * lpD3DMatrix->_41) + (mat->_21 * lpD3DMatrix->_42) + (mat->_31 * lpD3DMatrix->_43) + (mat->_41 * lpD3DMatrix->_44);
501 temp._12 = (mat->_12 * lpD3DMatrix->_11) + (mat->_22 * lpD3DMatrix->_12) + (mat->_32 * lpD3DMatrix->_13) + (mat->_42 * lpD3DMatrix->_14);
502 temp._22 = (mat->_12 * lpD3DMatrix->_21) + (mat->_22 * lpD3DMatrix->_22) + (mat->_32 * lpD3DMatrix->_23) + (mat->_42 * lpD3DMatrix->_24);
503 temp._32 = (mat->_12 * lpD3DMatrix->_31) + (mat->_22 * lpD3DMatrix->_32) + (mat->_32 * lpD3DMatrix->_33) + (mat->_42 * lpD3DMatrix->_34);
504 temp._42 = (mat->_12 * lpD3DMatrix->_41) + (mat->_22 * lpD3DMatrix->_42) + (mat->_32 * lpD3DMatrix->_43) + (mat->_42 * lpD3DMatrix->_44);
506 temp._13 = (mat->_13 * lpD3DMatrix->_11) + (mat->_23 * lpD3DMatrix->_12) + (mat->_33 * lpD3DMatrix->_13) + (mat->_43 * lpD3DMatrix->_14);
507 temp._23 = (mat->_13 * lpD3DMatrix->_21) + (mat->_23 * lpD3DMatrix->_22) + (mat->_33 * lpD3DMatrix->_23) + (mat->_43 * lpD3DMatrix->_24);
508 temp._33 = (mat->_13 * lpD3DMatrix->_31) + (mat->_23 * lpD3DMatrix->_32) + (mat->_33 * lpD3DMatrix->_33) + (mat->_43 * lpD3DMatrix->_34);
509 temp._43 = (mat->_13 * lpD3DMatrix->_41) + (mat->_23 * lpD3DMatrix->_42) + (mat->_33 * lpD3DMatrix->_43) + (mat->_43 * lpD3DMatrix->_44);
511 temp._14 = (mat->_14 * lpD3DMatrix->_11) + (mat->_24 * lpD3DMatrix->_12) + (mat->_34 * lpD3DMatrix->_13) + (mat->_44 * lpD3DMatrix->_14);
512 temp._24 = (mat->_14 * lpD3DMatrix->_21) + (mat->_24 * lpD3DMatrix->_22) + (mat->_34 * lpD3DMatrix->_23) + (mat->_44 * lpD3DMatrix->_24);
513 temp._34 = (mat->_14 * lpD3DMatrix->_31) + (mat->_24 * lpD3DMatrix->_32) + (mat->_34 * lpD3DMatrix->_33) + (mat->_44 * lpD3DMatrix->_34);
514 temp._44 = (mat->_14 * lpD3DMatrix->_41) + (mat->_24 * lpD3DMatrix->_42) + (mat->_34 * lpD3DMatrix->_43) + (mat->_44 * lpD3DMatrix->_44);
517 /* And copy the new matrix in the good storage.. */
518 memcpy(mat, &temp, 16 * sizeof(D3DVALUE));
519 if (TRACE_ON(ddraw)) {
523 if (matrix_changed != 0x00000000) This->matrices_updated(This, matrix_changed);
529 Main_IDirect3DDeviceImpl_7_SetViewport(LPDIRECT3DDEVICE7 iface,
530 LPD3DVIEWPORT7 lpData)
532 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
533 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
535 if (TRACE_ON(ddraw)) {
536 TRACE(" viewport is : \n");
537 TRACE(" - dwX = %ld dwY = %ld\n",
538 lpData->dwX, lpData->dwY);
539 TRACE(" - dwWidth = %ld dwHeight = %ld\n",
540 lpData->dwWidth, lpData->dwHeight);
541 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
542 lpData->dvMinZ, lpData->dvMaxZ);
544 This->active_viewport = *lpData;
550 Main_IDirect3DDeviceImpl_7_GetViewport(LPDIRECT3DDEVICE7 iface,
551 LPD3DVIEWPORT7 lpData)
553 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
554 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
556 *lpData = This->active_viewport;
558 if (TRACE_ON(ddraw)) {
559 TRACE(" returning viewport : \n");
560 TRACE(" - dwX = %ld dwY = %ld\n",
561 lpData->dwX, lpData->dwY);
562 TRACE(" - dwWidth = %ld dwHeight = %ld\n",
563 lpData->dwWidth, lpData->dwHeight);
564 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
565 lpData->dvMinZ, lpData->dvMaxZ);
572 Main_IDirect3DDeviceImpl_7_SetMaterial(LPDIRECT3DDEVICE7 iface,
573 LPD3DMATERIAL7 lpMat)
575 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
576 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpMat);
581 Main_IDirect3DDeviceImpl_7_GetMaterial(LPDIRECT3DDEVICE7 iface,
582 LPD3DMATERIAL7 lpMat)
584 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
585 TRACE("(%p/%p)->(%p)\n", This, iface, lpMat);
587 *lpMat = This->current_material;
589 if (TRACE_ON(ddraw)) {
590 TRACE(" returning material : \n");
591 dump_D3DMATERIAL7(lpMat);
598 Main_IDirect3DDeviceImpl_7_SetLight(LPDIRECT3DDEVICE7 iface,
602 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
603 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwLightIndex, lpLight);
608 Main_IDirect3DDeviceImpl_7_GetLight(LPDIRECT3DDEVICE7 iface,
612 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
613 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwLightIndex, lpLight);
615 if (dwLightIndex > MAX_LIGHTS) return DDERR_INVALIDPARAMS;
616 *lpLight = This->light_parameters[dwLightIndex];
618 if (TRACE_ON(ddraw)) {
619 TRACE(" returning light : \n");
620 dump_D3DLIGHT7(lpLight);
627 Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderState(LPDIRECT3DDEVICE7 iface,
628 D3DRENDERSTATETYPE dwRenderStateType,
631 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
632 FIXME("(%p/%p)->(%08x,%08lx): stub!\n", This, iface, dwRenderStateType, dwRenderState);
637 Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderState(LPDIRECT3DDEVICE7 iface,
638 D3DRENDERSTATETYPE dwRenderStateType,
639 LPDWORD lpdwRenderState)
641 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
642 FIXME("(%p/%p)->(%08x,%p): stub!\n", This, iface, dwRenderStateType, lpdwRenderState);
647 Main_IDirect3DDeviceImpl_7_BeginStateBlock(LPDIRECT3DDEVICE7 iface)
649 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
650 FIXME("(%p/%p)->(): stub!\n", This, iface);
655 Main_IDirect3DDeviceImpl_7_EndStateBlock(LPDIRECT3DDEVICE7 iface,
656 LPDWORD lpdwBlockHandle)
658 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
659 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpdwBlockHandle);
664 Main_IDirect3DDeviceImpl_7_PreLoad(LPDIRECT3DDEVICE7 iface,
665 LPDIRECTDRAWSURFACE7 lpddsTexture)
667 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
668 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpddsTexture);
673 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitive(LPDIRECT3DDEVICE7 iface,
674 D3DPRIMITIVETYPE d3dptPrimitiveType,
675 DWORD d3dvtVertexType,
680 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
681 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
686 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitive(LPDIRECT3DDEVICE7 iface,
687 D3DPRIMITIVETYPE d3dptPrimitiveType,
688 DWORD d3dvtVertexType,
695 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
696 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
701 Main_IDirect3DDeviceImpl_7_3T_2T_SetClipStatus(LPDIRECT3DDEVICE7 iface,
702 LPD3DCLIPSTATUS lpD3DClipStatus)
704 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
705 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DClipStatus);
710 Main_IDirect3DDeviceImpl_7_3T_2T_GetClipStatus(LPDIRECT3DDEVICE7 iface,
711 LPD3DCLIPSTATUS lpD3DClipStatus)
713 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
714 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DClipStatus);
719 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
720 D3DPRIMITIVETYPE d3dptPrimitiveType,
722 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
726 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
727 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags);
732 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
733 D3DPRIMITIVETYPE d3dptPrimitiveType,
735 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
741 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
742 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
747 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface,
748 D3DPRIMITIVETYPE d3dptPrimitiveType,
749 LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
754 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
755 FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags);
760 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
761 D3DPRIMITIVETYPE d3dptPrimitiveType,
762 LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
769 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
770 FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
775 Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface,
776 LPD3DVECTOR lpCenters,
780 LPDWORD lpdwReturnValues)
782 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
783 FIXME("(%p/%p)->(%p,%p,%08lx,%08lx,%p): stub!\n", This, iface, lpCenters, lpRadii, dwNumSpheres, dwFlags, lpdwReturnValues);
788 Main_IDirect3DDeviceImpl_7_3T_GetTexture(LPDIRECT3DDEVICE7 iface,
790 LPDIRECTDRAWSURFACE7* lpTexture)
792 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
793 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwStage, lpTexture);
795 if (This->current_texture[dwStage] != NULL) {
796 *lpTexture = ICOM_INTERFACE(This->current_texture[dwStage], IDirectDrawSurface7);
801 TRACE(" returning interface at %p (for implementation at %p).\n", *lpTexture, This->current_texture[dwStage]);
803 /* Note: should this method increase the reference count for this ?? */
809 Main_IDirect3DDeviceImpl_7_3T_SetTexture(LPDIRECT3DDEVICE7 iface,
811 LPDIRECTDRAWSURFACE7 lpTexture)
813 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
814 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwStage, lpTexture);
819 Main_IDirect3DDeviceImpl_7_3T_GetTextureStageState(LPDIRECT3DDEVICE7 iface,
821 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
824 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
825 TRACE("(%p/%p)->(%08lx,%08x,%p)\n", This, iface, dwStage, d3dTexStageStateType, lpdwState);
826 if (lpdwState && (dwStage < 8) && d3dTexStageStateType && (d3dTexStageStateType < HIGHEST_TEXTURE_STAGE_STATE) ) {
827 *lpdwState = This->state_block.texture_stage_state[dwStage][d3dTexStageStateType-1];
830 return DDERR_INVALIDPARAMS;
834 Main_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface,
836 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
839 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
840 FIXME("(%p/%p)->(%08lx,%08x,%08lx): stub!\n", This, iface, dwStage, d3dTexStageStateType, dwState);
845 Main_IDirect3DDeviceImpl_7_3T_ValidateDevice(LPDIRECT3DDEVICE7 iface,
848 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
849 FIXME("(%p/%p)->(%p): semi-stub!\n", This, iface, lpdwPasses);
851 /* For the moment, we have a VERY good hardware which does everything in one pass :-) */
858 Main_IDirect3DDeviceImpl_7_ApplyStateBlock(LPDIRECT3DDEVICE7 iface,
861 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
862 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
867 Main_IDirect3DDeviceImpl_7_CaptureStateBlock(LPDIRECT3DDEVICE7 iface,
870 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
871 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
876 Main_IDirect3DDeviceImpl_7_DeleteStateBlock(LPDIRECT3DDEVICE7 iface,
879 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
880 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
885 Main_IDirect3DDeviceImpl_7_CreateStateBlock(LPDIRECT3DDEVICE7 iface,
886 D3DSTATEBLOCKTYPE d3dsbType,
887 LPDWORD lpdwBlockHandle)
889 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
890 FIXME("(%p/%p)->(%08x,%p): stub!\n", This, iface, d3dsbType, lpdwBlockHandle);
895 Main_IDirect3DDeviceImpl_7_Load(LPDIRECT3DDEVICE7 iface,
896 LPDIRECTDRAWSURFACE7 lpDestTex,
898 LPDIRECTDRAWSURFACE7 lpSrcTex,
902 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
903 FIXME("(%p/%p)->(%p,%p,%p,%p,%08lx): Partially Implemented!\n", This, iface, lpDestTex, lpDestPoint, lpSrcTex, lprcSrcRect, dwFlags);
904 IDirect3DTexture2_Load(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpDestTex),
905 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpSrcTex));
910 Main_IDirect3DDeviceImpl_7_LightEnable(LPDIRECT3DDEVICE7 iface,
914 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
915 FIXME("(%p/%p)->(%08lx,%d): stub!\n", This, iface, dwLightIndex, bEnable);
920 Main_IDirect3DDeviceImpl_7_GetLightEnable(LPDIRECT3DDEVICE7 iface,
924 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
925 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwLightIndex, pbEnable);
927 if (dwLightIndex > MAX_LIGHTS) *pbEnable = 0;
928 else *pbEnable = ((0x00000001 << dwLightIndex) & This->active_lights) != 0;
930 TRACE(" returning %d.\n", *pbEnable);
936 Main_IDirect3DDeviceImpl_7_SetClipPlane(LPDIRECT3DDEVICE7 iface,
938 D3DVALUE* pPlaneEquation)
940 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
941 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwIndex, pPlaneEquation);
946 Main_IDirect3DDeviceImpl_7_GetClipPlane(LPDIRECT3DDEVICE7 iface, DWORD dwIndex, D3DVALUE* pPlaneEquation)
948 ICOM_THIS(IDirect3DDeviceImpl,iface);
950 TRACE("(%p)->(%ld,%p)\n", This, dwIndex, pPlaneEquation);
952 if (dwIndex>=This->max_clipping_planes) {
953 return DDERR_INVALIDPARAMS;
956 memcpy( pPlaneEquation, This->clipping_planes[dwIndex].plane, sizeof(D3DVALUE[4]));
962 Main_IDirect3DDeviceImpl_7_GetInfo(LPDIRECT3DDEVICE7 iface,
964 LPVOID pDevInfoStruct,
967 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
968 TRACE("(%p/%p)->(%08lx,%p,%08lx)\n", This, iface, dwDevInfoID, pDevInfoStruct, dwSize);
970 if (TRACE_ON(ddraw)) {
971 TRACE(" info requested : ");
972 switch (dwDevInfoID) {
973 case D3DDEVINFOID_TEXTUREMANAGER: TRACE("D3DDEVINFOID_TEXTUREMANAGER\n"); break;
974 case D3DDEVINFOID_D3DTEXTUREMANAGER: TRACE("D3DDEVINFOID_D3DTEXTUREMANAGER\n"); break;
975 case D3DDEVINFOID_TEXTURING: TRACE("D3DDEVINFOID_TEXTURING\n"); break;
976 default: ERR(" invalid flag !!!\n"); return DDERR_INVALIDPARAMS;
980 return S_FALSE; /* According to MSDN, this is valid for a non-debug driver */
984 Main_IDirect3DDeviceImpl_3_2T_1T_GetCaps(LPDIRECT3DDEVICE3 iface,
985 LPD3DDEVICEDESC lpD3DHWDevDesc,
986 LPD3DDEVICEDESC lpD3DHELDevDesc)
988 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
989 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
994 Main_IDirect3DDeviceImpl_3_2T_1T_GetStats(LPDIRECT3DDEVICE3 iface,
995 LPD3DSTATS lpD3DStats)
997 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
998 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DStats);
1003 Main_IDirect3DDeviceImpl_3_2T_1T_AddViewport(LPDIRECT3DDEVICE3 iface,
1004 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1006 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1007 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1009 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1011 lpDirect3DViewportImpl->next = This->viewport_list;
1012 This->viewport_list = lpDirect3DViewportImpl;
1018 Main_IDirect3DDeviceImpl_3_2T_1T_DeleteViewport(LPDIRECT3DDEVICE3 iface,
1019 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1021 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1022 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1023 IDirect3DViewportImpl *cur_viewport, *prev_viewport = NULL;
1025 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1027 cur_viewport = This->viewport_list;
1028 while (cur_viewport != NULL) {
1029 if (cur_viewport == lpDirect3DViewportImpl) {
1030 if (prev_viewport == NULL) This->viewport_list = cur_viewport->next;
1031 else prev_viewport->next = cur_viewport->next;
1032 /* TODO : add desactivate of the viewport and all associated lights... */
1035 prev_viewport = cur_viewport;
1036 cur_viewport = cur_viewport->next;
1039 return DDERR_INVALIDPARAMS;
1043 Main_IDirect3DDeviceImpl_3_2T_1T_NextViewport(LPDIRECT3DDEVICE3 iface,
1044 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3,
1045 LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3,
1048 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1049 IDirect3DViewportImpl *res = NULL;
1051 TRACE("(%p/%p)->(%p,%p,%08lx)\n", This, iface, lpDirect3DViewport3, lplpDirect3DViewport3, dwFlags);
1054 case D3DNEXT_NEXT: {
1055 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1056 res = lpDirect3DViewportImpl->next;
1058 case D3DNEXT_HEAD: {
1059 res = This->viewport_list;
1061 case D3DNEXT_TAIL: {
1062 IDirect3DViewportImpl *cur_viewport = This->viewport_list;
1063 if (cur_viewport != NULL) {
1064 while (cur_viewport->next != NULL) cur_viewport = cur_viewport->next;
1069 *lplpDirect3DViewport3 = NULL;
1070 return DDERR_INVALIDPARAMS;
1072 *lplpDirect3DViewport3 = ICOM_INTERFACE(res, IDirect3DViewport3);
1077 Main_IDirect3DDeviceImpl_3_2T_SetCurrentViewport(LPDIRECT3DDEVICE3 iface,
1078 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1080 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1081 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1083 /* Should check if the viewport was added or not */
1085 /* Set this viewport as the current viewport */
1086 This->current_viewport = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1088 /* Activate this viewport */
1089 This->current_viewport->active_device = This;
1090 This->current_viewport->activate(This->current_viewport);
1092 /* And copy the values in the structure used by the device */
1093 if (This->current_viewport->use_vp2) {
1094 This->active_viewport.dwX = This->current_viewport->viewports.vp2.dwX;
1095 This->active_viewport.dwY = This->current_viewport->viewports.vp2.dwY;
1096 This->active_viewport.dwHeight = This->current_viewport->viewports.vp2.dwHeight;
1097 This->active_viewport.dwWidth = This->current_viewport->viewports.vp2.dwWidth;
1098 This->active_viewport.dvMinZ = This->current_viewport->viewports.vp2.dvMinZ;
1099 This->active_viewport.dvMaxZ = This->current_viewport->viewports.vp2.dvMaxZ;
1101 This->active_viewport.dwX = This->current_viewport->viewports.vp1.dwX;
1102 This->active_viewport.dwY = This->current_viewport->viewports.vp1.dwY;
1103 This->active_viewport.dwHeight = This->current_viewport->viewports.vp1.dwHeight;
1104 This->active_viewport.dwWidth = This->current_viewport->viewports.vp1.dwWidth;
1105 This->active_viewport.dvMinZ = This->current_viewport->viewports.vp1.dvMinZ;
1106 This->active_viewport.dvMaxZ = This->current_viewport->viewports.vp1.dvMaxZ;
1113 Main_IDirect3DDeviceImpl_3_2T_GetCurrentViewport(LPDIRECT3DDEVICE3 iface,
1114 LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3)
1116 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1117 TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3DViewport3);
1119 *lplpDirect3DViewport3 = ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3);
1120 TRACE(" returning interface %p\n", *lplpDirect3DViewport3);
1126 Main_IDirect3DDeviceImpl_3_Begin(LPDIRECT3DDEVICE3 iface,
1127 D3DPRIMITIVETYPE d3dptPrimitiveType,
1128 DWORD dwVertexTypeDesc,
1131 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1132 FIXME("(%p/%p)->(%08x,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexTypeDesc, dwFlags);
1137 Main_IDirect3DDeviceImpl_3_BeginIndexed(LPDIRECT3DDEVICE3 iface,
1138 D3DPRIMITIVETYPE d3dptPrimitiveType,
1139 DWORD d3dvtVertexType,
1141 DWORD dwNumVertices,
1144 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1145 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwNumVertices, dwFlags);
1150 Main_IDirect3DDeviceImpl_3_2T_Vertex(LPDIRECT3DDEVICE3 iface,
1151 LPVOID lpVertexType)
1153 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1154 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpVertexType);
1159 Main_IDirect3DDeviceImpl_3_2T_Index(LPDIRECT3DDEVICE3 iface,
1162 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1163 FIXME("(%p/%p)->(%04x): stub!\n", This, iface, wVertexIndex);
1168 Main_IDirect3DDeviceImpl_3_2T_End(LPDIRECT3DDEVICE3 iface,
1171 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1172 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwFlags);
1177 Main_IDirect3DDeviceImpl_3_2T_GetLightState(LPDIRECT3DDEVICE3 iface,
1178 D3DLIGHTSTATETYPE dwLightStateType,
1179 LPDWORD lpdwLightState)
1181 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1182 FIXME("(%p/%p)->(%08x,%p): stub !\n", This, iface, dwLightStateType, lpdwLightState);
1187 Main_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
1188 D3DLIGHTSTATETYPE dwLightStateType,
1191 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1192 FIXME("(%p/%p)->(%08x,%08lx): stub!\n", This, iface, dwLightStateType, dwLightState);
1197 Main_IDirect3DDeviceImpl_2_1T_SwapTextureHandles(LPDIRECT3DDEVICE2 iface,
1198 LPDIRECT3DTEXTURE2 lpD3DTex1,
1199 LPDIRECT3DTEXTURE2 lpD3DTex2)
1201 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1202 IDirectDrawSurfaceImpl tmp,*surf1,*surf2;
1203 TRACE("(%p/%p)->(%p,%p):\n", This, iface, lpD3DTex1, lpD3DTex2);
1205 surf1 = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirect3DTexture2,lpD3DTex1);
1206 surf2 = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirect3DTexture2,lpD3DTex2);
1215 Main_IDirect3DDeviceImpl_2_NextViewport(LPDIRECT3DDEVICE2 iface,
1216 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2,
1217 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2,
1220 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1221 FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DViewport2, lplpDirect3DViewport2, dwFlags);
1226 Main_IDirect3DDeviceImpl_2_1T_EnumTextureFormats(LPDIRECT3DDEVICE2 iface,
1227 LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
1230 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1231 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DEnumTextureProc, lpArg);
1236 Main_IDirect3DDeviceImpl_2_Begin(LPDIRECT3DDEVICE2 iface,
1237 D3DPRIMITIVETYPE d3dpt,
1238 D3DVERTEXTYPE dwVertexTypeDesc,
1241 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1242 FIXME("(%p/%p)->(%08x,%08x,%08lx): stub!\n", This, iface, d3dpt, dwVertexTypeDesc, dwFlags);
1247 Main_IDirect3DDeviceImpl_2_BeginIndexed(LPDIRECT3DDEVICE2 iface,
1248 D3DPRIMITIVETYPE d3dptPrimitiveType,
1249 D3DVERTEXTYPE d3dvtVertexType,
1251 DWORD dwNumVertices,
1254 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1255 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwNumVertices, dwFlags);
1260 Main_IDirect3DDeviceImpl_2_DrawPrimitive(LPDIRECT3DDEVICE2 iface,
1261 D3DPRIMITIVETYPE d3dptPrimitiveType,
1262 D3DVERTEXTYPE d3dvtVertexType,
1264 DWORD dwVertexCount,
1267 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1268 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
1273 Main_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(LPDIRECT3DDEVICE2 iface,
1274 D3DPRIMITIVETYPE d3dptPrimitiveType,
1275 D3DVERTEXTYPE d3dvtVertexType,
1277 DWORD dwVertexCount,
1282 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1283 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
1288 Main_IDirect3DDeviceImpl_1_Initialize(LPDIRECT3DDEVICE iface,
1289 LPDIRECT3D lpDirect3D,
1291 LPD3DDEVICEDESC lpD3DDVDesc)
1293 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1294 FIXME("(%p/%p)->(%p,%p,%p): stub!\n", This, iface, lpDirect3D, lpGUID, lpD3DDVDesc);
1299 Main_IDirect3DDeviceImpl_1_CreateExecuteBuffer(LPDIRECT3DDEVICE iface,
1300 LPD3DEXECUTEBUFFERDESC lpDesc,
1301 LPDIRECT3DEXECUTEBUFFER* lplpDirect3DExecuteBuffer,
1302 IUnknown* pUnkOuter)
1304 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1305 FIXME("(%p/%p)->(%p,%p,%p): stub!\n", This, iface, lpDesc, lplpDirect3DExecuteBuffer, pUnkOuter);
1310 Main_IDirect3DDeviceImpl_1_Execute(LPDIRECT3DDEVICE iface,
1311 LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
1312 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1315 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1316 IDirect3DExecuteBufferImpl *lpDirect3DExecuteBufferImpl = ICOM_OBJECT(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, lpDirect3DExecuteBuffer);
1317 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport);
1319 TRACE("(%p/%p)->(%p,%p,%08lx)\n", This, iface, lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags);
1321 /* Put this as the default context */
1324 lpDirect3DExecuteBufferImpl->execute(lpDirect3DExecuteBufferImpl, This, lpDirect3DViewportImpl);
1330 Main_IDirect3DDeviceImpl_1_NextViewport(LPDIRECT3DDEVICE iface,
1331 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1332 LPDIRECT3DVIEWPORT* lplpDirect3DViewport,
1335 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1336 FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DViewport, lplpDirect3DViewport, dwFlags);
1341 Main_IDirect3DDeviceImpl_1_Pick(LPDIRECT3DDEVICE iface,
1342 LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
1343 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1347 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1348 FIXME("(%p/%p)->(%p,%p,%08lx,%p): stub!\n", This, iface, lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags, lpRect);
1353 Main_IDirect3DDeviceImpl_1_GetPickRecords(LPDIRECT3DDEVICE iface,
1355 LPD3DPICKRECORD lpD3DPickRec)
1357 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1358 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpCount, lpD3DPickRec);
1363 Main_IDirect3DDeviceImpl_1_CreateMatrix(LPDIRECT3DDEVICE iface,
1364 LPD3DMATRIXHANDLE lpD3DMatHandle)
1366 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1367 TRACE("(%p/%p)->(%p)\n", This, iface, lpD3DMatHandle);
1369 *lpD3DMatHandle = (D3DMATRIXHANDLE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(D3DMATRIX));
1370 TRACE(" returning matrix handle %p\n", (void *) *lpD3DMatHandle);
1376 Main_IDirect3DDeviceImpl_1_SetMatrix(LPDIRECT3DDEVICE iface,
1377 D3DMATRIXHANDLE D3DMatHandle,
1378 LPD3DMATRIX lpD3DMatrix)
1380 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1381 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, (DWORD) D3DMatHandle, lpD3DMatrix);
1383 dump_D3DMATRIX(lpD3DMatrix);
1384 *((D3DMATRIX *) D3DMatHandle) = *lpD3DMatrix;
1390 Main_IDirect3DDeviceImpl_1_GetMatrix(LPDIRECT3DDEVICE iface,
1391 D3DMATRIXHANDLE D3DMatHandle,
1392 LPD3DMATRIX lpD3DMatrix)
1394 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1395 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, (DWORD) D3DMatHandle, lpD3DMatrix);
1397 *lpD3DMatrix = *((D3DMATRIX *) D3DMatHandle);
1403 Main_IDirect3DDeviceImpl_1_DeleteMatrix(LPDIRECT3DDEVICE iface,
1404 D3DMATRIXHANDLE D3DMatHandle)
1406 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1407 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) D3DMatHandle);
1409 HeapFree(GetProcessHeap(), 0, (void *) D3DMatHandle);
1415 Thunk_IDirect3DDeviceImpl_3_QueryInterface(LPDIRECT3DDEVICE3 iface,
1419 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1420 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1426 Thunk_IDirect3DDeviceImpl_2_QueryInterface(LPDIRECT3DDEVICE2 iface,
1430 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1431 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1437 Thunk_IDirect3DDeviceImpl_1_QueryInterface(LPDIRECT3DDEVICE iface,
1441 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1442 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface),
1448 Thunk_IDirect3DDeviceImpl_3_AddRef(LPDIRECT3DDEVICE3 iface)
1450 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1451 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1455 Thunk_IDirect3DDeviceImpl_2_AddRef(LPDIRECT3DDEVICE2 iface)
1457 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1458 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1462 Thunk_IDirect3DDeviceImpl_1_AddRef(LPDIRECT3DDEVICE iface)
1464 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1465 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1469 Thunk_IDirect3DDeviceImpl_3_Release(LPDIRECT3DDEVICE3 iface)
1471 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1472 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1476 Thunk_IDirect3DDeviceImpl_2_Release(LPDIRECT3DDEVICE2 iface)
1478 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1479 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1483 Thunk_IDirect3DDeviceImpl_1_Release(LPDIRECT3DDEVICE iface)
1485 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1486 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1490 Thunk_IDirect3DDeviceImpl_2_AddViewport(LPDIRECT3DDEVICE2 iface,
1491 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1493 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1494 return IDirect3DDevice3_AddViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1495 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1499 Thunk_IDirect3DDeviceImpl_1_AddViewport(LPDIRECT3DDEVICE iface,
1500 LPDIRECT3DVIEWPORT lpDirect3DViewport)
1502 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport);
1503 return IDirect3DDevice3_AddViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1504 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */);
1508 Thunk_IDirect3DDeviceImpl_2_DeleteViewport(LPDIRECT3DDEVICE2 iface,
1509 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1511 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1512 return IDirect3DDevice3_DeleteViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1513 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1517 Thunk_IDirect3DDeviceImpl_1_DeleteViewport(LPDIRECT3DDEVICE iface,
1518 LPDIRECT3DVIEWPORT lpDirect3DViewport)
1520 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport);
1521 return IDirect3DDevice3_DeleteViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1522 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */);
1526 Thunk_IDirect3DDeviceImpl_2_NextViewport(LPDIRECT3DDEVICE3 iface,
1527 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2,
1528 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2,
1531 TRACE("(%p)->(%p,%p,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2, lplpDirect3DViewport2, dwFlags);
1532 return IDirect3DDevice3_NextViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1533 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */,
1534 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport2,
1539 Thunk_IDirect3DDeviceImpl_1_NextViewport(LPDIRECT3DDEVICE3 iface,
1540 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1541 LPDIRECT3DVIEWPORT* lplpDirect3DViewport,
1544 TRACE("(%p)->(%p,%p,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport, lplpDirect3DViewport, dwFlags);
1545 return IDirect3DDevice3_NextViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1546 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */,
1547 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport,
1552 Thunk_IDirect3DDeviceImpl_3_GetDirect3D(LPDIRECT3DDEVICE3 iface,
1553 LPDIRECT3D3* lplpDirect3D3)
1556 LPDIRECT3D7 ret_ptr;
1558 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D3);
1559 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1561 *lplpDirect3D3 = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D3, ret_ptr);
1562 TRACE(" returning interface %p\n", *lplpDirect3D3);
1567 Thunk_IDirect3DDeviceImpl_2_GetDirect3D(LPDIRECT3DDEVICE2 iface,
1568 LPDIRECT3D2* lplpDirect3D2)
1571 LPDIRECT3D7 ret_ptr;
1573 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D2);
1574 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1576 *lplpDirect3D2 = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D2, ret_ptr);
1577 TRACE(" returning interface %p\n", *lplpDirect3D2);
1582 Thunk_IDirect3DDeviceImpl_1_GetDirect3D(LPDIRECT3DDEVICE iface,
1583 LPDIRECT3D* lplpDirect3D)
1586 LPDIRECT3D7 ret_ptr;
1588 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D);
1589 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface),
1591 *lplpDirect3D = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D, ret_ptr);
1592 TRACE(" returning interface %p\n", *lplpDirect3D);
1597 Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport(LPDIRECT3DDEVICE2 iface,
1598 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1600 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1601 return IDirect3DDevice3_SetCurrentViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1602 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1606 Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport(LPDIRECT3DDEVICE2 iface,
1607 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2)
1609 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lplpDirect3DViewport2);
1610 return IDirect3DDevice3_GetCurrentViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1611 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1615 Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats(LPDIRECT3DDEVICE3 iface,
1616 LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
1619 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DEnumPixelProc, lpArg);
1620 return IDirect3DDevice7_EnumTextureFormats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1626 Thunk_IDirect3DDeviceImpl_3_BeginScene(LPDIRECT3DDEVICE3 iface)
1628 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1629 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1633 Thunk_IDirect3DDeviceImpl_2_BeginScene(LPDIRECT3DDEVICE2 iface)
1635 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1636 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1640 Thunk_IDirect3DDeviceImpl_1_BeginScene(LPDIRECT3DDEVICE iface)
1642 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1643 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1647 Thunk_IDirect3DDeviceImpl_3_EndScene(LPDIRECT3DDEVICE3 iface)
1649 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1650 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1654 Thunk_IDirect3DDeviceImpl_2_EndScene(LPDIRECT3DDEVICE2 iface)
1656 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1657 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1661 Thunk_IDirect3DDeviceImpl_1_EndScene(LPDIRECT3DDEVICE iface)
1663 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1664 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1668 Thunk_IDirect3DDeviceImpl_3_SetTransform(LPDIRECT3DDEVICE3 iface,
1669 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1670 LPD3DMATRIX lpD3DMatrix)
1672 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1673 return IDirect3DDevice7_SetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1674 dtstTransformStateType,
1679 Thunk_IDirect3DDeviceImpl_2_SetTransform(LPDIRECT3DDEVICE2 iface,
1680 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1681 LPD3DMATRIX lpD3DMatrix)
1683 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1684 return IDirect3DDevice7_SetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1685 dtstTransformStateType,
1690 Thunk_IDirect3DDeviceImpl_3_GetTransform(LPDIRECT3DDEVICE3 iface,
1691 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1692 LPD3DMATRIX lpD3DMatrix)
1694 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1695 return IDirect3DDevice7_GetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1696 dtstTransformStateType,
1701 Thunk_IDirect3DDeviceImpl_2_GetTransform(LPDIRECT3DDEVICE2 iface,
1702 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1703 LPD3DMATRIX lpD3DMatrix)
1705 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1706 return IDirect3DDevice7_GetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1707 dtstTransformStateType,
1712 Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(LPDIRECT3DDEVICE3 iface,
1713 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1714 LPD3DMATRIX lpD3DMatrix)
1716 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1717 return IDirect3DDevice7_MultiplyTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1718 dtstTransformStateType,
1723 Thunk_IDirect3DDeviceImpl_2_MultiplyTransform(LPDIRECT3DDEVICE2 iface,
1724 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1725 LPD3DMATRIX lpD3DMatrix)
1727 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1728 return IDirect3DDevice7_MultiplyTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1729 dtstTransformStateType,
1734 Thunk_IDirect3DDeviceImpl_3_SetRenderState(LPDIRECT3DDEVICE3 iface,
1735 D3DRENDERSTATETYPE dwRenderStateType,
1736 DWORD dwRenderState)
1738 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, dwRenderState);
1739 return IDirect3DDevice7_SetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1745 Thunk_IDirect3DDeviceImpl_2_SetRenderState(LPDIRECT3DDEVICE2 iface,
1746 D3DRENDERSTATETYPE dwRenderStateType,
1747 DWORD dwRenderState)
1749 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, dwRenderState);
1750 return IDirect3DDevice7_SetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1756 Thunk_IDirect3DDeviceImpl_3_GetRenderState(LPDIRECT3DDEVICE3 iface,
1757 D3DRENDERSTATETYPE dwRenderStateType,
1758 LPDWORD lpdwRenderState)
1760 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, lpdwRenderState);
1761 return IDirect3DDevice7_GetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1767 Thunk_IDirect3DDeviceImpl_2_GetRenderState(LPDIRECT3DDEVICE2 iface,
1768 D3DRENDERSTATETYPE dwRenderStateType,
1769 LPDWORD lpdwRenderState)
1771 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, lpdwRenderState);
1772 return IDirect3DDevice7_GetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1778 Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(LPDIRECT3DDEVICE3 iface,
1779 D3DPRIMITIVETYPE d3dptPrimitiveType,
1780 DWORD d3dvtVertexType,
1782 DWORD dwVertexCount,
1785 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
1786 return IDirect3DDevice7_DrawPrimitive(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1795 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(LPDIRECT3DDEVICE3 iface,
1796 D3DPRIMITIVETYPE d3dptPrimitiveType,
1797 DWORD d3dvtVertexType,
1799 DWORD dwVertexCount,
1804 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
1805 return IDirect3DDevice7_DrawIndexedPrimitive(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1816 Thunk_IDirect3DDeviceImpl_3_SetClipStatus(LPDIRECT3DDEVICE3 iface,
1817 LPD3DCLIPSTATUS lpD3DClipStatus)
1819 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1820 return IDirect3DDevice7_SetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1825 Thunk_IDirect3DDeviceImpl_2_SetClipStatus(LPDIRECT3DDEVICE2 iface,
1826 LPD3DCLIPSTATUS lpD3DClipStatus)
1828 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1829 return IDirect3DDevice7_SetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1834 Thunk_IDirect3DDeviceImpl_3_GetClipStatus(LPDIRECT3DDEVICE3 iface,
1835 LPD3DCLIPSTATUS lpD3DClipStatus)
1837 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1838 return IDirect3DDevice7_GetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1843 Thunk_IDirect3DDeviceImpl_2_GetClipStatus(LPDIRECT3DDEVICE2 iface,
1844 LPD3DCLIPSTATUS lpD3DClipStatus)
1846 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1847 return IDirect3DDevice7_GetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1852 Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
1853 D3DPRIMITIVETYPE d3dptPrimitiveType,
1855 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
1856 DWORD dwVertexCount,
1859 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags);
1860 return IDirect3DDevice7_DrawPrimitiveStrided(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1863 lpD3DDrawPrimStrideData,
1869 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
1870 D3DPRIMITIVETYPE d3dptPrimitiveType,
1872 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
1873 DWORD dwVertexCount,
1878 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
1879 return IDirect3DDevice7_DrawIndexedPrimitiveStrided(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1882 lpD3DDrawPrimStrideData,
1890 Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility(LPDIRECT3DDEVICE3 iface,
1891 LPD3DVECTOR lpCenters,
1895 LPDWORD lpdwReturnValues)
1897 TRACE("(%p)->(%p,%p,%08lx,%08lx,%p) thunking to IDirect3DDevice7 interface.\n", iface, lpCenters, lpRadii, dwNumSpheres, dwFlags, lpdwReturnValues);
1898 return IDirect3DDevice7_ComputeSphereVisibility(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1907 Thunk_IDirect3DDeviceImpl_3_GetTextureStageState(LPDIRECT3DDEVICE3 iface,
1909 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
1912 TRACE("(%p)->(%08lx,%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, d3dTexStageStateType, lpdwState);
1913 return IDirect3DDevice7_GetTextureStageState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1915 d3dTexStageStateType,
1920 Thunk_IDirect3DDeviceImpl_3_SetTextureStageState(LPDIRECT3DDEVICE3 iface,
1922 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
1925 TRACE("(%p)->(%08lx,%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, d3dTexStageStateType, dwState);
1926 return IDirect3DDevice7_SetTextureStageState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1928 d3dTexStageStateType,
1933 Thunk_IDirect3DDeviceImpl_3_ValidateDevice(LPDIRECT3DDEVICE3 iface,
1936 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpdwPasses);
1937 return IDirect3DDevice7_ValidateDevice(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1942 Thunk_IDirect3DDeviceImpl_2_GetCaps(LPDIRECT3DDEVICE2 iface,
1943 LPD3DDEVICEDESC lpD3DHWDevDesc,
1944 LPD3DDEVICEDESC lpD3DHELDevDesc)
1946 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
1947 return IDirect3DDevice3_GetCaps(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1953 Thunk_IDirect3DDeviceImpl_1_GetCaps(LPDIRECT3DDEVICE iface,
1954 LPD3DDEVICEDESC lpD3DHWDevDesc,
1955 LPD3DDEVICEDESC lpD3DHELDevDesc)
1957 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
1958 return IDirect3DDevice3_GetCaps(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1964 Thunk_IDirect3DDeviceImpl_1_SwapTextureHandles(LPDIRECT3DDEVICE iface,
1965 LPDIRECT3DTEXTURE lpD3DTex1,
1966 LPDIRECT3DTEXTURE lpD3DTex2)
1968 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", iface, lpD3DTex1, lpD3DTex2);
1969 return IDirect3DDevice2_SwapTextureHandles(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice2, iface),
1970 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirect3DTexture2, lpD3DTex1),
1971 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirect3DTexture2, lpD3DTex2));
1975 Thunk_IDirect3DDeviceImpl_2_GetStats(LPDIRECT3DDEVICE2 iface,
1976 LPD3DSTATS lpD3DStats)
1978 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DStats);
1979 return IDirect3DDevice3_GetStats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1984 Thunk_IDirect3DDeviceImpl_1_GetStats(LPDIRECT3DDEVICE iface,
1985 LPD3DSTATS lpD3DStats)
1987 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DStats);
1988 return IDirect3DDevice3_GetStats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1993 Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(LPDIRECT3DDEVICE3 iface,
1994 LPDIRECTDRAWSURFACE4 lpNewRenderTarget,
1997 TRACE("(%p)->(%p,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, lpNewRenderTarget, dwFlags);
1998 return IDirect3DDevice7_SetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1999 (LPDIRECTDRAWSURFACE7) lpNewRenderTarget /* No cast needed as DSurf4 == DSurf7 */,
2004 Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(LPDIRECT3DDEVICE3 iface,
2005 LPDIRECTDRAWSURFACE4* lplpRenderTarget)
2007 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpRenderTarget);
2008 return IDirect3DDevice7_GetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2009 (LPDIRECTDRAWSURFACE7*) lplpRenderTarget /* No cast needed as DSurf4 == DSurf7 */);
2013 Thunk_IDirect3DDeviceImpl_2_SetRenderTarget(LPDIRECT3DDEVICE2 iface,
2014 LPDIRECTDRAWSURFACE lpNewRenderTarget,
2017 TRACE("(%p)->(%p,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, lpNewRenderTarget, dwFlags);
2018 return IDirect3DDevice7_SetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
2019 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, lpNewRenderTarget),
2024 Thunk_IDirect3DDeviceImpl_2_GetRenderTarget(LPDIRECT3DDEVICE2 iface,
2025 LPDIRECTDRAWSURFACE* lplpRenderTarget)
2028 LPDIRECTDRAWSURFACE7 ret_val;
2030 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpRenderTarget);
2031 ret = IDirect3DDevice7_GetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
2033 *lplpRenderTarget = (LPDIRECTDRAWSURFACE) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirectDrawSurface3, ret_val);
2034 TRACE(" returning interface %p\n", *lplpRenderTarget);
2039 Thunk_IDirect3DDeviceImpl_2_Vertex(LPDIRECT3DDEVICE2 iface,
2040 LPVOID lpVertexType)
2042 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpVertexType);
2043 return IDirect3DDevice3_Vertex(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2048 Thunk_IDirect3DDeviceImpl_2_Index(LPDIRECT3DDEVICE2 iface,
2051 TRACE("(%p)->(%04x) thunking to IDirect3DDevice3 interface.\n", iface, wVertexIndex);
2052 return IDirect3DDevice3_Index(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2057 Thunk_IDirect3DDeviceImpl_2_End(LPDIRECT3DDEVICE2 iface,
2060 TRACE("(%p)->(%08lx) thunking to IDirect3DDevice3 interface.\n", iface, dwFlags);
2061 return IDirect3DDevice3_End(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2066 Thunk_IDirect3DDeviceImpl_2_GetLightState(LPDIRECT3DDEVICE2 iface,
2067 D3DLIGHTSTATETYPE dwLightStateType,
2068 LPDWORD lpdwLightState)
2070 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice3 interface.\n", iface, dwLightStateType, lpdwLightState);
2071 return IDirect3DDevice3_GetLightState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2077 Thunk_IDirect3DDeviceImpl_2_SetLightState(LPDIRECT3DDEVICE2 iface,
2078 D3DLIGHTSTATETYPE dwLightStateType,
2081 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, dwLightStateType, dwLightState);
2082 return IDirect3DDevice3_SetLightState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2088 Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(LPDIRECT3DDEVICE iface,
2089 LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
2092 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", iface, lpD3DEnumTextureProc, lpArg);
2093 return IDirect3DDevice2_EnumTextureFormats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice2, iface),
2094 lpD3DEnumTextureProc,
2099 Thunk_IDirect3DDeviceImpl_3_SetTexture(LPDIRECT3DDEVICE3 iface,
2101 LPDIRECT3DTEXTURE2 lpTexture2)
2103 TRACE("(%p)->(%ld,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, lpTexture2);
2104 return IDirect3DDevice7_SetTexture(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2106 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture2, IDirectDrawSurface7, lpTexture2));
2110 Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface,
2111 D3DPRIMITIVETYPE d3dptPrimitiveType,
2112 LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
2113 DWORD dwStartVertex,
2114 DWORD dwNumVertices,
2117 TRACE("(%p)->(%08x,%p,%08lx,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface,
2118 d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags);
2119 return IDirect3DDevice7_DrawPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2121 COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf),
2128 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface,
2129 D3DPRIMITIVETYPE d3dptPrimitiveType,
2130 LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
2135 TRACE("(%p)->(%08x,%p,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface,
2136 d3dptPrimitiveType, lpD3DVertexBuf, lpwIndices, dwIndexCount, dwFlags);
2137 return IDirect3DDevice7_DrawIndexedPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2139 COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf),
2148 Thunk_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface,
2150 LPDIRECT3DTEXTURE2* lplpTexture2)
2153 LPDIRECTDRAWSURFACE7 ret_val;
2155 TRACE("(%p)->(%ld,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, lplpTexture2);
2156 ret = IDirect3DDevice7_GetTexture(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2160 *lplpTexture2 = COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, ret_val);
2162 TRACE(" returning interface %p.\n", *lplpTexture2);