4 * Copyright (c) 1998-2004 Lionel Ulmer
5 * Copyright (c) 2002-2005 Christian Costa
7 * This file contains all the common stuff for D3D devices.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
36 #include "wine/debug.h"
38 #include "d3d_private.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
42 DWORD InitRenderStateTab[] = {
43 D3DRENDERSTATE_TEXTUREHANDLE, (DWORD)NULL,
44 D3DRENDERSTATE_ANTIALIAS, D3DANTIALIAS_NONE,
45 /* FIXME: D3DRENDERSTATE_TEXTUREADDRESS */
46 D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE,
47 /* FIXME: D3DRENDERSTATE_WRAPU */
48 /* FIXME: D3DRENDERSTATE_WRAPV */
49 D3DRENDERSTATE_ZENABLE, D3DZB_TRUE, /* This needs to be set differently according to the Z buffer status */
50 D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID,
51 D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD,
52 D3DRENDERSTATE_LINEPATTERN, 0,
53 D3DRENDERSTATE_MONOENABLE, FALSE,
54 D3DRENDERSTATE_ROP2, R2_COPYPEN,
55 D3DRENDERSTATE_PLANEMASK, 0xFFFFFFFF,
56 D3DRENDERSTATE_ZWRITEENABLE, TRUE,
57 D3DRENDERSTATE_ALPHATESTENABLE, FALSE,
58 D3DRENDERSTATE_LASTPIXEL, TRUE,
59 D3DRENDERSTATE_TEXTUREMAG, D3DFILTER_NEAREST,
60 D3DRENDERSTATE_TEXTUREMIN, D3DFILTER_NEAREST,
61 D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE,
62 D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO,
63 D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE,
64 D3DRENDERSTATE_CULLMODE, D3DCULL_CCW,
65 D3DRENDERSTATE_ZFUNC, D3DCMP_LESSEQUAL,
66 D3DRENDERSTATE_ALPHAREF, 0,
67 D3DRENDERSTATE_ALPHAFUNC, D3DCMP_ALWAYS,
68 D3DRENDERSTATE_DITHERENABLE, FALSE,
69 D3DRENDERSTATE_ALPHABLENDENABLE, FALSE,
70 D3DRENDERSTATE_FOGENABLE, FALSE,
71 D3DRENDERSTATE_SPECULARENABLE, FALSE,
72 D3DRENDERSTATE_ZVISIBLE, FALSE,
73 D3DRENDERSTATE_SUBPIXEL, FALSE,
74 D3DRENDERSTATE_SUBPIXELX, FALSE,
75 D3DRENDERSTATE_STIPPLEDALPHA, FALSE,
76 D3DRENDERSTATE_FOGCOLOR, D3DRGBA(0,0,0,0),
77 D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_NONE,
78 /* FIXME: D3DRENDERSTATE_FOGTABLESTART (same as D3DRENDERSTATE_FOGSTART) */
79 /* FIXME: D3DRENDERSTATE_FOGTABLEEND (same as D3DRENDERSTATE_FOGEND) */
80 D3DRENDERSTATE_FOGTABLEDENSITY, 0x3F80000, /* 1.0f (same as D3DRENDERSTATE_FOGDENSITY) */
81 /* FIXME: D3DRENDERSTATE_STIPPLEENABLE */
82 D3DRENDERSTATE_EDGEANTIALIAS, FALSE,
83 D3DRENDERSTATE_COLORKEYENABLE, FALSE,
84 /* FIXME: D3DRENDERSTATE_BORDERCOLOR */
85 D3DRENDERSTATE_TEXTUREADDRESSU, D3DTADDRESS_WRAP,
86 D3DRENDERSTATE_TEXTUREADDRESSV, D3DTADDRESS_WRAP,
87 D3DRENDERSTATE_MIPMAPLODBIAS, 0x00000000, /* 0.0f */
88 D3DRENDERSTATE_ZBIAS, 0,
89 D3DRENDERSTATE_RANGEFOGENABLE, FALSE,
90 /* FIXME: D3DRENDERSTATE_ANISOTROPY */
91 /* FIXME: D3DRENDERSTATE_FLUSHBATCH */
92 /* FIXME: D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT */
93 D3DRENDERSTATE_STENCILENABLE, FALSE,
94 D3DRENDERSTATE_STENCILFAIL, D3DSTENCILOP_KEEP,
95 D3DRENDERSTATE_STENCILZFAIL, D3DSTENCILOP_KEEP,
96 D3DRENDERSTATE_STENCILPASS, D3DSTENCILOP_KEEP,
97 D3DRENDERSTATE_STENCILFUNC, D3DCMP_ALWAYS,
98 D3DRENDERSTATE_STENCILREF, 0,
99 D3DRENDERSTATE_STENCILMASK, 0xFFFFFFFF,
100 D3DRENDERSTATE_STENCILWRITEMASK, 0xFFFFFFFF,
101 /* FIXME: D3DRENDERSTATE_TEXTUREFACTOR */
102 /* FIXME: D3DRENDERSTATE_STIPPLEPATTERN00..31 */
103 D3DRENDERSTATE_WRAP0, 0,
104 D3DRENDERSTATE_WRAP1, 0,
105 D3DRENDERSTATE_WRAP2, 0,
106 D3DRENDERSTATE_WRAP3, 0,
107 D3DRENDERSTATE_WRAP4, 0,
108 D3DRENDERSTATE_WRAP5, 0,
109 D3DRENDERSTATE_WRAP6, 0,
110 D3DRENDERSTATE_WRAP7, 0,
111 D3DRENDERSTATE_CLIPPING, FALSE,
112 D3DRENDERSTATE_LIGHTING, TRUE,
113 D3DRENDERSTATE_EXTENTS, FALSE,
114 D3DRENDERSTATE_AMBIENT, D3DRGBA(0,0,0,0),
115 D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE,
116 D3DRENDERSTATE_COLORVERTEX, TRUE,
117 D3DRENDERSTATE_LOCALVIEWER, TRUE,
118 D3DRENDERSTATE_NORMALIZENORMALS, FALSE,
119 /* FIXME: D3DRENDER_STATE_COLORKEYBLENDENABLE */
120 D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1,
121 D3DRENDERSTATE_SPECULARMATERIALSOURCE, D3DMCS_COLOR2,
122 D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2,
123 D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL,
124 D3DRENDERSTATE_VERTEXBLEND, D3DVBLEND_DISABLE,
125 D3DRENDERSTATE_CLIPPLANEENABLE, 0
128 DWORD InitLightStateTab[] = {
129 D3DLIGHTSTATE_MATERIAL, (DWORD)NULL,
130 D3DLIGHTSTATE_AMBIENT, D3DRGBA(0,0,0,0),
131 D3DLIGHTSTATE_COLORMODEL, D3DCOLOR_RGB,
132 D3DLIGHTSTATE_FOGMODE, D3DFOG_NONE,
133 D3DLIGHTSTATE_FOGSTART, 0x3F80000, /* 1.0f */
134 D3DLIGHTSTATE_FOGEND, 0x42C8000, /* 100.0f */
135 D3DLIGHTSTATE_FOGDENSITY, 0x3F80000 /* 1.0f */
136 /* FIXME: D3DLIGHTSTATE_COLORVERTEX */
139 DWORD InitTextureStageStateTab[] = {
140 D3DTSS_COLOROP, D3DTOP_DISABLE, /* Note, it's manually set for stage 0 */
141 D3DTSS_COLORARG1, D3DTA_TEXTURE,
142 D3DTSS_COLORARG2, D3DTA_CURRENT,
143 D3DTSS_ALPHAOP, D3DTOP_DISABLE, /* Note, it's manually set for stage 0 */
144 D3DTSS_ALPHAARG1, D3DTA_TEXTURE,
145 D3DTSS_ALPHAARG2, D3DTA_CURRENT,
146 /* FIXME: D3DTSS_BUMPENVMAT00,01,10,11 */
147 /* D3DTSS_TEXCOORDINDEX is set manually */
148 D3DTSS_ADDRESS, D3DTADDRESS_WRAP,
149 D3DTSS_ADDRESSU, D3DTADDRESS_WRAP,
150 D3DTSS_ADDRESSV, D3DTADDRESS_WRAP,
151 D3DTSS_BORDERCOLOR, 0x00000000,
152 D3DTSS_MAGFILTER, D3DTFG_POINT,
153 D3DTSS_MINFILTER, D3DTFN_POINT,
154 D3DTSS_MIPFILTER, D3DTFP_NONE,
155 D3DTSS_MIPMAPLODBIAS, 0x00000000, /* 0.0f */
156 D3DTSS_MAXMIPLEVEL, 0,
157 /* D3DTSS_MAXANISOTROPY, 1, */ /* This is to prevent warnings :-) */
158 /* FIXME: D3DTSS_BUMPENVLSCALE */
159 /* FIXME: D3DTSS_NUMPENVLOFFSET */
160 /* FIXME: D3DTSS_TEXTURETRANSFORMFLAGS */
164 void InitDefaultStateBlock(STATEBLOCK* lpStateBlock, int version)
167 TRACE("(%p,%d)\n", lpStateBlock, version);
168 memset(lpStateBlock, 0, sizeof(STATEBLOCK));
170 /* Initialize render states */
171 for (i = 0; i < sizeof(InitRenderStateTab) / sizeof(InitRenderStateTab[0]); i += 2)
173 lpStateBlock->render_state[InitRenderStateTab[i] - 1] = InitRenderStateTab[i + 1];
174 lpStateBlock->set_flags.render_state[InitRenderStateTab[i] - 1] = TRUE;
177 /* Initialize texture stages states */
178 for (i = 0; i < MAX_TEXTURES; i++)
180 for (j = 0; j < sizeof(InitTextureStageStateTab) / sizeof(InitTextureStageStateTab[0]); j += 2)
182 lpStateBlock->texture_stage_state[i][InitTextureStageStateTab[j] - 1] = InitTextureStageStateTab[j + 1];
183 lpStateBlock->set_flags.texture_stage_state[i][InitTextureStageStateTab[j] - 1] = TRUE;
185 /* Map texture coords 0 to stage 0, 1 to stage 1, etc... */
186 lpStateBlock->texture_stage_state[i][D3DTSS_TEXCOORDINDEX - 1] = i;
187 lpStateBlock->set_flags.texture_stage_state[i][D3DTSS_TEXCOORDINDEX - 1] = TRUE;
190 /* The first texture is particular, update it consequently */
191 lpStateBlock->texture_stage_state[0][D3DTSS_COLOROP - 1] = D3DTOP_MODULATE;
192 lpStateBlock->texture_stage_state[0][D3DTSS_ALPHAOP - 1] = D3DTOP_SELECTARG1;
193 lpStateBlock->texture_stage_state[0][D3DTSS_COLORARG2 - 1] = D3DTA_DIFFUSE;
194 lpStateBlock->texture_stage_state[0][D3DTSS_ALPHAARG2 - 1] = D3DTA_DIFFUSE;
196 /* Updates for particular versions */
197 if ((version == 1) || (version==2))
198 lpStateBlock->render_state[D3DRENDERSTATE_SPECULARENABLE - 1] = TRUE;
202 Main_IDirect3DDeviceImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3DDEVICE7 iface,
206 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
207 TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
211 /* Note: We cannot get an interface whose version is higher than the
212 * Direct3D object that created the device */
214 if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
215 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
217 TRACE(" Creating IUnknown interface at %p.\n", *obp);
220 if ( IsEqualGUID( &IID_IDirect3DDevice, riid ) ) {
221 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
222 *obp = ICOM_INTERFACE(This, IDirect3DDevice);
223 TRACE(" Creating IDirect3DDevice interface %p\n", *obp);
226 if ( IsEqualGUID( &IID_IDirect3DDevice2, riid ) && (This->version >= 2)) {
227 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
228 *obp = ICOM_INTERFACE(This, IDirect3DDevice2);
229 TRACE(" Creating IDirect3DDevice2 interface %p\n", *obp);
232 if ( IsEqualGUID( &IID_IDirect3DDevice3, riid ) && (This->version >= 3)) {
233 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
234 *obp = ICOM_INTERFACE(This, IDirect3DDevice3);
235 TRACE(" Creating IDirect3DDevice3 interface %p\n", *obp);
238 if ( IsEqualGUID( &IID_IDirect3DDevice7, riid ) && (This->version >= 7)) {
239 IDirect3DDevice7_AddRef(ICOM_INTERFACE(This, IDirect3DDevice7));
240 *obp = ICOM_INTERFACE(This, IDirect3DDevice7);
241 TRACE(" Creating IDirect3DDevice7 interface %p\n", *obp);
244 if ( IsEqualGUID( &IID_IDirectDrawSurface, riid ) ||
245 IsEqualGUID( &IID_IDirectDrawSurface2, riid ) ||
246 IsEqualGUID( &IID_IDirectDrawSurface3, riid ) ) {
247 IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->surface, IDirectDrawSurface7));
248 *obp = ICOM_INTERFACE(This->surface, IDirectDrawSurface3);
249 TRACE(" Return IDirectDrawSurface3 interface %p\n", *obp);
252 if ( IsEqualGUID( &IID_IDirectDrawSurface4, riid ) ||
253 IsEqualGUID( &IID_IDirectDrawSurface7, riid ) ) {
254 IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->surface, IDirectDrawSurface7));
255 *obp = ICOM_INTERFACE(This->surface, IDirectDrawSurface7);
256 TRACE(" Return IDirectDrawSurface7 interface %p\n", *obp);
259 FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
260 return OLE_E_ENUM_NOMORE;
264 Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef(LPDIRECT3DDEVICE7 iface)
266 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
267 ULONG ref = InterlockedIncrement(&This->ref);
269 TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1);
275 Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
277 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
278 ULONG ref = InterlockedDecrement(&This->ref);
280 TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1);
284 /* Release texture associated with the device */
285 for (i = 0; i < MAX_TEXTURES; i++) {
286 if (This->current_texture[i] != NULL)
287 IDirect3DTexture2_Release(ICOM_INTERFACE(This->current_texture[i], IDirect3DTexture2));
289 HeapFree(GetProcessHeap(), 0, This->vertex_buffer);
290 HeapFree(GetProcessHeap(), 0, This);
297 Main_IDirect3DDeviceImpl_7_GetCaps(LPDIRECT3DDEVICE7 iface,
298 LPD3DDEVICEDESC7 lpD3DHELDevDesc)
300 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
301 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DHELDevDesc);
306 Main_IDirect3DDeviceImpl_7_3T_EnumTextureFormats(LPDIRECT3DDEVICE7 iface,
307 LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
310 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
311 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DEnumPixelProc, lpArg);
316 Main_IDirect3DDeviceImpl_7_3T_2T_1T_BeginScene(LPDIRECT3DDEVICE7 iface)
318 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
319 TRACE("(%p/%p)->()\n", This, iface);
325 Main_IDirect3DDeviceImpl_7_3T_2T_1T_EndScene(LPDIRECT3DDEVICE7 iface)
327 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
328 TRACE("(%p/%p)->()\n", This, iface);
334 Main_IDirect3DDeviceImpl_7_3T_2T_1T_GetDirect3D(LPDIRECT3DDEVICE7 iface,
335 LPDIRECT3D7* lplpDirect3D7)
337 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
338 TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3D7);
340 *lplpDirect3D7 = ICOM_INTERFACE(This->d3d, IDirect3D7);
341 IDirect3D7_AddRef(ICOM_INTERFACE(This->d3d, IDirect3D7));
343 TRACE(" returning interface %p\n", *lplpDirect3D7);
348 Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderTarget(LPDIRECT3DDEVICE7 iface,
349 LPDIRECTDRAWSURFACE7 lpNewRenderTarget,
352 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
353 IDirectDrawSurfaceImpl *target_impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpNewRenderTarget);
355 TRACE("(%p/%p)->(%p,%08lx)\n", This, iface, lpNewRenderTarget, dwFlags);
356 if (target_impl != This->surface) {
357 WARN(" Change of rendering target not handled yet !\n");
363 Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderTarget(LPDIRECT3DDEVICE7 iface,
364 LPDIRECTDRAWSURFACE7* lplpRenderTarget)
366 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
367 TRACE("(%p/%p)->(%p)\n", This, iface, lplpRenderTarget);
369 *lplpRenderTarget = ICOM_INTERFACE(This->surface, IDirectDrawSurface7);
370 IDirectDrawSurface7_AddRef(ICOM_INTERFACE(This->surface, IDirectDrawSurface7));
372 TRACE(" returning surface at %p.\n", *lplpRenderTarget);
378 Main_IDirect3DDeviceImpl_7_Clear(LPDIRECT3DDEVICE7 iface,
386 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
387 TRACE("(%p/%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, iface, dwCount, lpRects, dwFlags, (DWORD) dwColor, dvZ, dwStencil);
388 return This->clear(This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
392 Main_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface,
393 D3DTRANSFORMSTATETYPE dtstTransformStateType,
394 LPD3DMATRIX lpD3DMatrix)
396 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
397 DWORD matrix_changed = 0x00000000;
399 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
401 switch (dtstTransformStateType) {
402 case D3DTRANSFORMSTATE_WORLD: {
403 if (TRACE_ON(ddraw)) {
404 TRACE(" D3DTRANSFORMSTATE_WORLD :\n"); dump_D3DMATRIX(lpD3DMatrix);
406 memcpy(This->world_mat, lpD3DMatrix, 16 * sizeof(float));
407 matrix_changed = WORLDMAT_CHANGED;
410 case D3DTRANSFORMSTATE_VIEW: {
411 if (TRACE_ON(ddraw)) {
412 TRACE(" D3DTRANSFORMSTATE_VIEW :\n"); dump_D3DMATRIX(lpD3DMatrix);
414 memcpy(This->view_mat, lpD3DMatrix, 16 * sizeof(float));
415 matrix_changed = VIEWMAT_CHANGED;
418 case D3DTRANSFORMSTATE_PROJECTION: {
419 if (TRACE_ON(ddraw)) {
420 TRACE(" D3DTRANSFORMSTATE_PROJECTION :\n"); dump_D3DMATRIX(lpD3DMatrix);
422 memcpy(This->proj_mat, lpD3DMatrix, 16 * sizeof(float));
423 matrix_changed = PROJMAT_CHANGED;
426 case D3DTRANSFORMSTATE_TEXTURE0:
427 case D3DTRANSFORMSTATE_TEXTURE1:
428 case D3DTRANSFORMSTATE_TEXTURE2:
429 case D3DTRANSFORMSTATE_TEXTURE3:
430 case D3DTRANSFORMSTATE_TEXTURE4:
431 case D3DTRANSFORMSTATE_TEXTURE5:
432 case D3DTRANSFORMSTATE_TEXTURE6:
433 case D3DTRANSFORMSTATE_TEXTURE7: {
434 DWORD mat_num = dtstTransformStateType - D3DTRANSFORMSTATE_TEXTURE0;
435 if (TRACE_ON(ddraw)) {
436 TRACE(" D3DTRANSFORMSTATE_TEXTURE%ld :\n", mat_num); dump_D3DMATRIX(lpD3DMatrix);
438 memcpy(This->tex_mat[mat_num], lpD3DMatrix, 16 * sizeof(float));
439 matrix_changed = TEXMAT0_CHANGED << mat_num;
443 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
447 if (matrix_changed != 0x00000000) This->matrices_updated(This, matrix_changed);
453 Main_IDirect3DDeviceImpl_7_3T_2T_GetTransform(LPDIRECT3DDEVICE7 iface,
454 D3DTRANSFORMSTATETYPE dtstTransformStateType,
455 LPD3DMATRIX lpD3DMatrix)
457 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
458 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
460 switch (dtstTransformStateType) {
461 case D3DTRANSFORMSTATE_WORLD: {
462 memcpy(lpD3DMatrix, This->world_mat, 16 * sizeof(D3DVALUE));
463 if (TRACE_ON(ddraw)) {
464 TRACE(" returning D3DTRANSFORMSTATE_WORLD :\n");
465 dump_D3DMATRIX(lpD3DMatrix);
469 case D3DTRANSFORMSTATE_VIEW: {
470 memcpy(lpD3DMatrix, This->view_mat, 16 * sizeof(D3DVALUE));
471 if (TRACE_ON(ddraw)) {
472 TRACE(" returning D3DTRANSFORMSTATE_VIEW :\n");
473 dump_D3DMATRIX(lpD3DMatrix);
477 case D3DTRANSFORMSTATE_PROJECTION: {
478 memcpy(lpD3DMatrix, This->proj_mat, 16 * sizeof(D3DVALUE));
479 if (TRACE_ON(ddraw)) {
480 TRACE(" returning D3DTRANSFORMSTATE_PROJECTION :\n");
481 dump_D3DMATRIX(lpD3DMatrix);
485 case D3DTRANSFORMSTATE_TEXTURE0:
486 case D3DTRANSFORMSTATE_TEXTURE1:
487 case D3DTRANSFORMSTATE_TEXTURE2:
488 case D3DTRANSFORMSTATE_TEXTURE3:
489 case D3DTRANSFORMSTATE_TEXTURE4:
490 case D3DTRANSFORMSTATE_TEXTURE5:
491 case D3DTRANSFORMSTATE_TEXTURE6:
492 case D3DTRANSFORMSTATE_TEXTURE7: {
493 DWORD mat_num = dtstTransformStateType - D3DTRANSFORMSTATE_TEXTURE0;
494 memcpy(lpD3DMatrix, This->tex_mat[mat_num], 16 * sizeof(D3DVALUE));
495 if (TRACE_ON(ddraw)) {
496 TRACE(" returning D3DTRANSFORMSTATE_TEXTURE%ld :\n", mat_num);
497 dump_D3DMATRIX(lpD3DMatrix);
502 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
503 return DDERR_INVALIDPARAMS;
510 Main_IDirect3DDeviceImpl_7_3T_2T_MultiplyTransform(LPDIRECT3DDEVICE7 iface,
511 D3DTRANSFORMSTATETYPE dtstTransformStateType,
512 LPD3DMATRIX lpD3DMatrix)
514 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
516 DWORD matrix_changed = 0x00000000;
518 TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dtstTransformStateType, lpD3DMatrix);
520 if (TRACE_ON(ddraw)) {
521 TRACE(" Multiplying by :\n"); dump_D3DMATRIX(lpD3DMatrix);
524 switch (dtstTransformStateType) {
525 case D3DTRANSFORMSTATE_WORLD: {
526 if (TRACE_ON(ddraw)) {
527 TRACE(" Resulting D3DTRANSFORMSTATE_WORLD matrix is :\n");
529 mat = This->world_mat;
530 matrix_changed = WORLDMAT_CHANGED;
533 case D3DTRANSFORMSTATE_VIEW: {
534 if (TRACE_ON(ddraw)) {
535 TRACE(" Resulting D3DTRANSFORMSTATE_VIEW matrix is :\n");
537 mat = This->view_mat;
538 matrix_changed = VIEWMAT_CHANGED;
541 case D3DTRANSFORMSTATE_PROJECTION: {
542 if (TRACE_ON(ddraw)) {
543 TRACE(" Resulting D3DTRANSFORMSTATE_PROJECTION matrix is :\n");
545 mat = This->proj_mat;
546 matrix_changed = PROJMAT_CHANGED;
549 case D3DTRANSFORMSTATE_TEXTURE0:
550 case D3DTRANSFORMSTATE_TEXTURE1:
551 case D3DTRANSFORMSTATE_TEXTURE2:
552 case D3DTRANSFORMSTATE_TEXTURE3:
553 case D3DTRANSFORMSTATE_TEXTURE4:
554 case D3DTRANSFORMSTATE_TEXTURE5:
555 case D3DTRANSFORMSTATE_TEXTURE6:
556 case D3DTRANSFORMSTATE_TEXTURE7: {
557 DWORD mat_num = dtstTransformStateType - D3DTRANSFORMSTATE_TEXTURE0;
558 if (TRACE_ON(ddraw)) {
559 TRACE(" Resulting D3DTRANSFORMSTATE_TEXTURE%ld matrix is :\n", mat_num);
561 mat = This->tex_mat[mat_num];
562 matrix_changed = TEXMAT0_CHANGED << mat_num;
566 ERR("Unknown transform type %08x !!!\n", dtstTransformStateType);
567 return DDERR_INVALIDPARAMS;
570 multiply_matrix(mat,mat,lpD3DMatrix);
572 if (TRACE_ON(ddraw)) {
576 if (matrix_changed != 0x00000000) This->matrices_updated(This, matrix_changed);
582 Main_IDirect3DDeviceImpl_7_GetViewport(LPDIRECT3DDEVICE7 iface,
583 LPD3DVIEWPORT7 lpData)
585 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
586 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
588 *lpData = This->active_viewport;
590 if (TRACE_ON(ddraw)) {
591 TRACE(" returning viewport :\n");
592 TRACE(" - dwX = %ld dwY = %ld\n",
593 lpData->dwX, lpData->dwY);
594 TRACE(" - dwWidth = %ld dwHeight = %ld\n",
595 lpData->dwWidth, lpData->dwHeight);
596 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
597 lpData->dvMinZ, lpData->dvMaxZ);
604 Main_IDirect3DDeviceImpl_7_SetMaterial(LPDIRECT3DDEVICE7 iface,
605 LPD3DMATERIAL7 lpMat)
607 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
608 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpMat);
613 Main_IDirect3DDeviceImpl_7_GetMaterial(LPDIRECT3DDEVICE7 iface,
614 LPD3DMATERIAL7 lpMat)
616 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
617 TRACE("(%p/%p)->(%p)\n", This, iface, lpMat);
619 *lpMat = This->current_material;
621 if (TRACE_ON(ddraw)) {
622 TRACE(" returning material :\n");
623 dump_D3DMATERIAL7(lpMat);
630 Main_IDirect3DDeviceImpl_7_SetLight(LPDIRECT3DDEVICE7 iface,
634 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
635 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwLightIndex, lpLight);
640 Main_IDirect3DDeviceImpl_7_GetLight(LPDIRECT3DDEVICE7 iface,
644 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
645 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwLightIndex, lpLight);
647 if (dwLightIndex >= This->num_set_lights)
648 return DDERR_INVALIDPARAMS;
650 *lpLight = This->light_parameters[dwLightIndex];
652 /* If dltType is zero, then this light has never been set, either
653 by calling SetLight or implicitely by calling EnableLight without
654 calling SetLight first. */
655 if (lpLight->dltType == 0)
656 return DDERR_INVALIDPARAMS;
658 if (TRACE_ON(ddraw)) {
659 TRACE(" returning light :\n");
660 dump_D3DLIGHT7(lpLight);
667 Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderState(LPDIRECT3DDEVICE7 iface,
668 D3DRENDERSTATETYPE dwRenderStateType,
671 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
672 FIXME("(%p/%p)->(%08x,%08lx): stub!\n", This, iface, dwRenderStateType, dwRenderState);
677 Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderState(LPDIRECT3DDEVICE7 iface,
678 D3DRENDERSTATETYPE dwRenderStateType,
679 LPDWORD lpdwRenderState)
681 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
682 FIXME("(%p/%p)->(%08x,%p): stub!\n", This, iface, dwRenderStateType, lpdwRenderState);
687 Main_IDirect3DDeviceImpl_7_BeginStateBlock(LPDIRECT3DDEVICE7 iface)
689 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
690 FIXME("(%p/%p)->(): stub!\n", This, iface);
695 Main_IDirect3DDeviceImpl_7_EndStateBlock(LPDIRECT3DDEVICE7 iface,
696 LPDWORD lpdwBlockHandle)
698 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
699 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpdwBlockHandle);
704 Main_IDirect3DDeviceImpl_7_PreLoad(LPDIRECT3DDEVICE7 iface,
705 LPDIRECTDRAWSURFACE7 lpddsTexture)
707 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
708 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpddsTexture);
713 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitive(LPDIRECT3DDEVICE7 iface,
714 D3DPRIMITIVETYPE d3dptPrimitiveType,
715 DWORD d3dvtVertexType,
720 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
721 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
726 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitive(LPDIRECT3DDEVICE7 iface,
727 D3DPRIMITIVETYPE d3dptPrimitiveType,
728 DWORD d3dvtVertexType,
735 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
736 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
741 Main_IDirect3DDeviceImpl_7_3T_2T_SetClipStatus(LPDIRECT3DDEVICE7 iface,
742 LPD3DCLIPSTATUS lpD3DClipStatus)
744 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
745 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DClipStatus);
750 Main_IDirect3DDeviceImpl_7_3T_2T_GetClipStatus(LPDIRECT3DDEVICE7 iface,
751 LPD3DCLIPSTATUS lpD3DClipStatus)
753 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
754 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DClipStatus);
759 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
760 D3DPRIMITIVETYPE d3dptPrimitiveType,
762 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
766 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
767 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags);
772 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
773 D3DPRIMITIVETYPE d3dptPrimitiveType,
775 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
781 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
782 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
787 Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface,
788 D3DPRIMITIVETYPE d3dptPrimitiveType,
789 LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
794 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
795 FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags);
800 Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
801 D3DPRIMITIVETYPE d3dptPrimitiveType,
802 LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
809 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
810 FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
815 Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface,
816 LPD3DVECTOR lpCenters,
820 LPDWORD lpdwReturnValues)
822 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
823 FIXME("(%p/%p)->(%p,%p,%08lx,%08lx,%p): stub!\n", This, iface, lpCenters, lpRadii, dwNumSpheres, dwFlags, lpdwReturnValues);
828 Main_IDirect3DDeviceImpl_7_3T_GetTexture(LPDIRECT3DDEVICE7 iface,
830 LPDIRECTDRAWSURFACE7* lpTexture)
832 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
833 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwStage, lpTexture);
835 if (This->current_texture[dwStage] != NULL) {
836 *lpTexture = ICOM_INTERFACE(This->current_texture[dwStage], IDirectDrawSurface7);
837 IDirectDrawSurface7_AddRef(*lpTexture);
842 TRACE(" returning interface at %p (for implementation at %p).\n", *lpTexture, This->current_texture[dwStage]);
848 Main_IDirect3DDeviceImpl_7_3T_SetTexture(LPDIRECT3DDEVICE7 iface,
850 LPDIRECTDRAWSURFACE7 lpTexture)
852 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
853 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwStage, lpTexture);
858 Main_IDirect3DDeviceImpl_7_3T_GetTextureStageState(LPDIRECT3DDEVICE7 iface,
860 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
863 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
864 TRACE("(%p/%p)->(%08lx,%08x,%p)\n", This, iface, dwStage, d3dTexStageStateType, lpdwState);
865 if (lpdwState && (dwStage < 8) && d3dTexStageStateType && (d3dTexStageStateType <= HIGHEST_TEXTURE_STAGE_STATE) ) {
866 *lpdwState = This->state_block.texture_stage_state[dwStage][d3dTexStageStateType-1];
869 return DDERR_INVALIDPARAMS;
873 Main_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface,
875 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
878 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
879 FIXME("(%p/%p)->(%08lx,%08x,%08lx): stub!\n", This, iface, dwStage, d3dTexStageStateType, dwState);
884 Main_IDirect3DDeviceImpl_7_3T_ValidateDevice(LPDIRECT3DDEVICE7 iface,
887 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
888 FIXME("(%p/%p)->(%p): semi-stub!\n", This, iface, lpdwPasses);
890 /* For the moment, we have a VERY good hardware which does everything in one pass :-) */
897 Main_IDirect3DDeviceImpl_7_ApplyStateBlock(LPDIRECT3DDEVICE7 iface,
900 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
901 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
906 Main_IDirect3DDeviceImpl_7_CaptureStateBlock(LPDIRECT3DDEVICE7 iface,
909 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
910 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
915 Main_IDirect3DDeviceImpl_7_DeleteStateBlock(LPDIRECT3DDEVICE7 iface,
918 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
919 FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwBlockHandle);
924 Main_IDirect3DDeviceImpl_7_CreateStateBlock(LPDIRECT3DDEVICE7 iface,
925 D3DSTATEBLOCKTYPE d3dsbType,
926 LPDWORD lpdwBlockHandle)
928 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
929 FIXME("(%p/%p)->(%08x,%p): stub!\n", This, iface, d3dsbType, lpdwBlockHandle);
934 Main_IDirect3DDeviceImpl_7_Load(LPDIRECT3DDEVICE7 iface,
935 LPDIRECTDRAWSURFACE7 lpDestTex,
937 LPDIRECTDRAWSURFACE7 lpSrcTex,
941 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
942 FIXME("(%p/%p)->(%p,%p,%p,%p,%08lx): Partially Implemented!\n", This, iface, lpDestTex, lpDestPoint, lpSrcTex, lprcSrcRect, dwFlags);
943 IDirect3DTexture2_Load(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpDestTex),
944 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpSrcTex));
949 Main_IDirect3DDeviceImpl_7_LightEnable(LPDIRECT3DDEVICE7 iface,
953 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
954 FIXME("(%p/%p)->(%08lx,%d): stub!\n", This, iface, dwLightIndex, bEnable);
959 Main_IDirect3DDeviceImpl_7_GetLightEnable(LPDIRECT3DDEVICE7 iface,
965 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
966 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, dwLightIndex, pbEnable);
969 if (dwLightIndex >= This->num_set_lights)
970 return DDERR_INVALIDPARAMS;
972 /* If dltType is zero, then this light has never been set, either
973 by calling SetLight or implicitely by calling EnableLight without
974 calling SetLight first. */
975 if (This->light_parameters[dwLightIndex].dltType == 0)
976 return DDERR_INVALIDPARAMS;
978 for (i = 0; i < This->max_active_lights; i++)
979 if (This->active_lights[i] == dwLightIndex)
982 TRACE(" returning %d.\n", *pbEnable);
988 Main_IDirect3DDeviceImpl_7_SetClipPlane(LPDIRECT3DDEVICE7 iface,
990 D3DVALUE* pPlaneEquation)
992 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
993 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwIndex, pPlaneEquation);
998 Main_IDirect3DDeviceImpl_7_GetClipPlane(LPDIRECT3DDEVICE7 iface, DWORD dwIndex, D3DVALUE* pPlaneEquation)
1000 IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
1002 TRACE("(%p)->(%ld,%p)\n", This, dwIndex, pPlaneEquation);
1004 if (dwIndex>=This->max_clipping_planes) {
1005 return DDERR_INVALIDPARAMS;
1008 memcpy( pPlaneEquation, This->clipping_planes[dwIndex].plane, sizeof(D3DVALUE[4]));
1014 Main_IDirect3DDeviceImpl_7_GetInfo(LPDIRECT3DDEVICE7 iface,
1016 LPVOID pDevInfoStruct,
1019 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
1020 TRACE("(%p/%p)->(%08lx,%p,%08lx)\n", This, iface, dwDevInfoID, pDevInfoStruct, dwSize);
1022 if (TRACE_ON(ddraw)) {
1023 TRACE(" info requested : ");
1024 switch (dwDevInfoID) {
1025 case D3DDEVINFOID_TEXTUREMANAGER: TRACE("D3DDEVINFOID_TEXTUREMANAGER\n"); break;
1026 case D3DDEVINFOID_D3DTEXTUREMANAGER: TRACE("D3DDEVINFOID_D3DTEXTUREMANAGER\n"); break;
1027 case D3DDEVINFOID_TEXTURING: TRACE("D3DDEVINFOID_TEXTURING\n"); break;
1028 default: ERR(" invalid flag !!!\n"); return DDERR_INVALIDPARAMS;
1032 return S_FALSE; /* According to MSDN, this is valid for a non-debug driver */
1036 Main_IDirect3DDeviceImpl_3_2T_1T_GetCaps(LPDIRECT3DDEVICE3 iface,
1037 LPD3DDEVICEDESC lpD3DHWDevDesc,
1038 LPD3DDEVICEDESC lpD3DHELDevDesc)
1040 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1041 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
1046 Main_IDirect3DDeviceImpl_3_2T_1T_GetStats(LPDIRECT3DDEVICE3 iface,
1047 LPD3DSTATS lpD3DStats)
1049 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1050 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DStats);
1055 Main_IDirect3DDeviceImpl_3_2T_1T_AddViewport(LPDIRECT3DDEVICE3 iface,
1056 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1058 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1059 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1061 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1063 lpDirect3DViewportImpl->next = This->viewport_list;
1064 This->viewport_list = lpDirect3DViewportImpl;
1070 Main_IDirect3DDeviceImpl_3_2T_1T_DeleteViewport(LPDIRECT3DDEVICE3 iface,
1071 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1073 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1074 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1075 IDirect3DViewportImpl *cur_viewport, *prev_viewport = NULL;
1077 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1079 cur_viewport = This->viewport_list;
1080 while (cur_viewport != NULL) {
1081 if (cur_viewport == lpDirect3DViewportImpl) {
1082 if (prev_viewport == NULL) This->viewport_list = cur_viewport->next;
1083 else prev_viewport->next = cur_viewport->next;
1084 /* TODO : add desactivate of the viewport and all associated lights... */
1087 prev_viewport = cur_viewport;
1088 cur_viewport = cur_viewport->next;
1091 return DDERR_INVALIDPARAMS;
1095 Main_IDirect3DDeviceImpl_3_2T_1T_NextViewport(LPDIRECT3DDEVICE3 iface,
1096 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3,
1097 LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3,
1100 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1101 IDirect3DViewportImpl *res = NULL;
1103 TRACE("(%p/%p)->(%p,%p,%08lx)\n", This, iface, lpDirect3DViewport3, lplpDirect3DViewport3, dwFlags);
1106 case D3DNEXT_NEXT: {
1107 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1108 res = lpDirect3DViewportImpl->next;
1110 case D3DNEXT_HEAD: {
1111 res = This->viewport_list;
1113 case D3DNEXT_TAIL: {
1114 IDirect3DViewportImpl *cur_viewport = This->viewport_list;
1115 if (cur_viewport != NULL) {
1116 while (cur_viewport->next != NULL) cur_viewport = cur_viewport->next;
1121 *lplpDirect3DViewport3 = NULL;
1122 return DDERR_INVALIDPARAMS;
1124 *lplpDirect3DViewport3 = ICOM_INTERFACE(res, IDirect3DViewport3);
1129 Main_IDirect3DDeviceImpl_3_2T_SetCurrentViewport(LPDIRECT3DDEVICE3 iface,
1130 LPDIRECT3DVIEWPORT3 lpDirect3DViewport3)
1132 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1133 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DViewport3);
1135 /* Do nothing if the specified viewport is the same as the current one */
1136 if (This->current_viewport == ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3))
1139 /* Should check if the viewport was added or not */
1141 /* Release previous viewport and AddRef the new one */
1142 if (This->current_viewport)
1143 IDirect3DViewport3_Release(ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3));
1144 IDirect3DViewport3_AddRef(lpDirect3DViewport3);
1146 /* Set this viewport as the current viewport */
1147 This->current_viewport = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport3);
1149 /* Activate this viewport */
1150 This->current_viewport->active_device = This;
1151 This->current_viewport->activate(This->current_viewport);
1157 Main_IDirect3DDeviceImpl_3_2T_GetCurrentViewport(LPDIRECT3DDEVICE3 iface,
1158 LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3)
1160 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1161 TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3DViewport3);
1163 *lplpDirect3DViewport3 = ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3);
1165 /* AddRef the returned viewport */
1166 IDirect3DViewport3_AddRef(*lplpDirect3DViewport3);
1168 TRACE(" returning interface %p\n", *lplpDirect3DViewport3);
1174 Main_IDirect3DDeviceImpl_3_Begin(LPDIRECT3DDEVICE3 iface,
1175 D3DPRIMITIVETYPE d3dptPrimitiveType,
1176 DWORD dwVertexTypeDesc,
1179 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1180 TRACE("(%p/%p)->(%08x,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexTypeDesc, dwFlags);
1182 This->primitive_type = d3dptPrimitiveType;
1183 This->vertex_type = dwVertexTypeDesc;
1184 This->render_flags = dwFlags;
1185 This->vertex_size = get_flexible_vertex_size(This->vertex_type);
1186 This->nb_vertices = 0;
1192 Main_IDirect3DDeviceImpl_3_BeginIndexed(LPDIRECT3DDEVICE3 iface,
1193 D3DPRIMITIVETYPE d3dptPrimitiveType,
1194 DWORD d3dvtVertexType,
1196 DWORD dwNumVertices,
1199 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1200 FIXME("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwNumVertices, dwFlags);
1205 Main_IDirect3DDeviceImpl_3_2T_Vertex(LPDIRECT3DDEVICE3 iface,
1206 LPVOID lpVertexType)
1208 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1209 TRACE("(%p/%p)->(%p)\n", This, iface, lpVertexType);
1211 if ((This->nb_vertices+1)*This->vertex_size > This->buffer_size)
1214 This->buffer_size = This->buffer_size ? This->buffer_size * 2 : This->vertex_size * 3;
1215 old_buffer = This->vertex_buffer;
1216 This->vertex_buffer = HeapAlloc(GetProcessHeap(), 0, This->buffer_size);
1219 CopyMemory(This->vertex_buffer, old_buffer, This->nb_vertices * This->vertex_size);
1220 HeapFree(GetProcessHeap(), 0, old_buffer);
1224 CopyMemory(This->vertex_buffer + This->nb_vertices++ * This->vertex_size, lpVertexType, This->vertex_size);
1230 Main_IDirect3DDeviceImpl_3_2T_Index(LPDIRECT3DDEVICE3 iface,
1233 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1234 FIXME("(%p/%p)->(%04x): stub!\n", This, iface, wVertexIndex);
1239 Main_IDirect3DDeviceImpl_3_2T_End(LPDIRECT3DDEVICE3 iface,
1242 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1243 TRACE("(%p/%p)->(%08lx)\n", This, iface, dwFlags);
1245 IDirect3DDevice3_DrawPrimitive(iface, This->primitive_type, This->vertex_type, This->vertex_buffer, This->nb_vertices, This->render_flags);
1251 Main_IDirect3DDeviceImpl_3_2T_GetLightState(LPDIRECT3DDEVICE3 iface,
1252 D3DLIGHTSTATETYPE dwLightStateType,
1253 LPDWORD lpdwLightState)
1255 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1256 FIXME("(%p/%p)->(%08x,%p): stub !\n", This, iface, dwLightStateType, lpdwLightState);
1261 Main_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
1262 D3DLIGHTSTATETYPE dwLightStateType,
1265 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
1266 FIXME("(%p/%p)->(%08x,%08lx): stub!\n", This, iface, dwLightStateType, dwLightState);
1271 Main_IDirect3DDeviceImpl_2_1T_SwapTextureHandles(LPDIRECT3DDEVICE2 iface,
1272 LPDIRECT3DTEXTURE2 lpD3DTex1,
1273 LPDIRECT3DTEXTURE2 lpD3DTex2)
1275 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1276 IDirectDrawSurfaceImpl tmp,*surf1,*surf2;
1277 TRACE("(%p/%p)->(%p,%p):\n", This, iface, lpD3DTex1, lpD3DTex2);
1279 surf1 = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirect3DTexture2,lpD3DTex1);
1280 surf2 = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirect3DTexture2,lpD3DTex2);
1289 Main_IDirect3DDeviceImpl_2_NextViewport(LPDIRECT3DDEVICE2 iface,
1290 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2,
1291 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2,
1294 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1295 FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DViewport2, lplpDirect3DViewport2, dwFlags);
1300 Main_IDirect3DDeviceImpl_2_1T_EnumTextureFormats(LPDIRECT3DDEVICE2 iface,
1301 LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
1304 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1305 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DEnumTextureProc, lpArg);
1310 Main_IDirect3DDeviceImpl_2_Begin(LPDIRECT3DDEVICE2 iface,
1311 D3DPRIMITIVETYPE d3dpt,
1312 D3DVERTEXTYPE dwVertexTypeDesc,
1315 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1316 FIXME("(%p/%p)->(%08x,%08x,%08lx): stub!\n", This, iface, d3dpt, dwVertexTypeDesc, dwFlags);
1321 Main_IDirect3DDeviceImpl_2_BeginIndexed(LPDIRECT3DDEVICE2 iface,
1322 D3DPRIMITIVETYPE d3dptPrimitiveType,
1323 D3DVERTEXTYPE d3dvtVertexType,
1325 DWORD dwNumVertices,
1328 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1329 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwNumVertices, dwFlags);
1334 Main_IDirect3DDeviceImpl_2_DrawPrimitive(LPDIRECT3DDEVICE2 iface,
1335 D3DPRIMITIVETYPE d3dptPrimitiveType,
1336 D3DVERTEXTYPE d3dvtVertexType,
1338 DWORD dwVertexCount,
1341 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1342 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
1347 Main_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(LPDIRECT3DDEVICE2 iface,
1348 D3DPRIMITIVETYPE d3dptPrimitiveType,
1349 D3DVERTEXTYPE d3dvtVertexType,
1351 DWORD dwVertexCount,
1356 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
1357 FIXME("(%p/%p)->(%08x,%08x,%p,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
1362 Main_IDirect3DDeviceImpl_1_Initialize(LPDIRECT3DDEVICE iface,
1363 LPDIRECT3D lpDirect3D,
1365 LPD3DDEVICEDESC lpD3DDVDesc)
1367 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1368 FIXME("(%p/%p)->(%p,%p,%p): stub!\n", This, iface, lpDirect3D, lpGUID, lpD3DDVDesc);
1373 Main_IDirect3DDeviceImpl_1_CreateExecuteBuffer(LPDIRECT3DDEVICE iface,
1374 LPD3DEXECUTEBUFFERDESC lpDesc,
1375 LPDIRECT3DEXECUTEBUFFER* lplpDirect3DExecuteBuffer,
1376 IUnknown* pUnkOuter)
1378 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1379 FIXME("(%p/%p)->(%p,%p,%p): stub!\n", This, iface, lpDesc, lplpDirect3DExecuteBuffer, pUnkOuter);
1384 Main_IDirect3DDeviceImpl_1_Execute(LPDIRECT3DDEVICE iface,
1385 LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
1386 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1389 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1390 IDirect3DExecuteBufferImpl *lpDirect3DExecuteBufferImpl = ICOM_OBJECT(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, lpDirect3DExecuteBuffer);
1391 IDirect3DViewportImpl *lpDirect3DViewportImpl = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, lpDirect3DViewport);
1393 TRACE("(%p/%p)->(%p,%p,%08lx)\n", This, iface, lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags);
1395 /* Put this as the default context */
1398 lpDirect3DExecuteBufferImpl->execute(lpDirect3DExecuteBufferImpl, This, lpDirect3DViewportImpl);
1404 Main_IDirect3DDeviceImpl_1_NextViewport(LPDIRECT3DDEVICE iface,
1405 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1406 LPDIRECT3DVIEWPORT* lplpDirect3DViewport,
1409 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1410 FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DViewport, lplpDirect3DViewport, dwFlags);
1415 Main_IDirect3DDeviceImpl_1_Pick(LPDIRECT3DDEVICE iface,
1416 LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
1417 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1421 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1422 FIXME("(%p/%p)->(%p,%p,%08lx,%p): stub!\n", This, iface, lpDirect3DExecuteBuffer, lpDirect3DViewport, dwFlags, lpRect);
1427 Main_IDirect3DDeviceImpl_1_GetPickRecords(LPDIRECT3DDEVICE iface,
1429 LPD3DPICKRECORD lpD3DPickRec)
1431 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1432 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpCount, lpD3DPickRec);
1437 Main_IDirect3DDeviceImpl_1_CreateMatrix(LPDIRECT3DDEVICE iface,
1438 LPD3DMATRIXHANDLE lpD3DMatHandle)
1440 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1441 TRACE("(%p/%p)->(%p)\n", This, iface, lpD3DMatHandle);
1443 *lpD3DMatHandle = (D3DMATRIXHANDLE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(D3DMATRIX));
1444 TRACE(" returning matrix handle %p\n", (void *) *lpD3DMatHandle);
1450 Main_IDirect3DDeviceImpl_1_SetMatrix(LPDIRECT3DDEVICE iface,
1451 D3DMATRIXHANDLE D3DMatHandle,
1452 LPD3DMATRIX lpD3DMatrix)
1454 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1455 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, (DWORD) D3DMatHandle, lpD3DMatrix);
1457 if (TRACE_ON(ddraw)) {
1458 dump_D3DMATRIX(lpD3DMatrix);
1460 *((D3DMATRIX *) D3DMatHandle) = *lpD3DMatrix;
1466 Main_IDirect3DDeviceImpl_1_GetMatrix(LPDIRECT3DDEVICE iface,
1467 D3DMATRIXHANDLE D3DMatHandle,
1468 LPD3DMATRIX lpD3DMatrix)
1470 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1471 TRACE("(%p/%p)->(%08lx,%p)\n", This, iface, (DWORD) D3DMatHandle, lpD3DMatrix);
1473 *lpD3DMatrix = *((D3DMATRIX *) D3DMatHandle);
1479 Main_IDirect3DDeviceImpl_1_DeleteMatrix(LPDIRECT3DDEVICE iface,
1480 D3DMATRIXHANDLE D3DMatHandle)
1482 ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
1483 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) D3DMatHandle);
1485 HeapFree(GetProcessHeap(), 0, (void *) D3DMatHandle);
1491 Thunk_IDirect3DDeviceImpl_3_QueryInterface(LPDIRECT3DDEVICE3 iface,
1495 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1496 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1502 Thunk_IDirect3DDeviceImpl_2_QueryInterface(LPDIRECT3DDEVICE2 iface,
1506 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1507 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1513 Thunk_IDirect3DDeviceImpl_1_QueryInterface(LPDIRECT3DDEVICE iface,
1517 TRACE("(%p)->(%s,%p) thunking to IDirect3DDevice7 interface.\n", iface, debugstr_guid(riid), obp);
1518 return IDirect3DDevice7_QueryInterface(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface),
1524 Thunk_IDirect3DDeviceImpl_3_AddRef(LPDIRECT3DDEVICE3 iface)
1526 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1527 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1531 Thunk_IDirect3DDeviceImpl_2_AddRef(LPDIRECT3DDEVICE2 iface)
1533 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1534 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1538 Thunk_IDirect3DDeviceImpl_1_AddRef(LPDIRECT3DDEVICE iface)
1540 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1541 return IDirect3DDevice7_AddRef(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1545 Thunk_IDirect3DDeviceImpl_3_Release(LPDIRECT3DDEVICE3 iface)
1547 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1548 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1552 Thunk_IDirect3DDeviceImpl_2_Release(LPDIRECT3DDEVICE2 iface)
1554 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1555 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1559 Thunk_IDirect3DDeviceImpl_1_Release(LPDIRECT3DDEVICE iface)
1561 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1562 return IDirect3DDevice7_Release(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1566 Thunk_IDirect3DDeviceImpl_2_AddViewport(LPDIRECT3DDEVICE2 iface,
1567 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1569 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1570 return IDirect3DDevice3_AddViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1571 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1575 Thunk_IDirect3DDeviceImpl_1_AddViewport(LPDIRECT3DDEVICE iface,
1576 LPDIRECT3DVIEWPORT lpDirect3DViewport)
1578 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport);
1579 return IDirect3DDevice3_AddViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1580 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */);
1584 Thunk_IDirect3DDeviceImpl_2_DeleteViewport(LPDIRECT3DDEVICE2 iface,
1585 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1587 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1588 return IDirect3DDevice3_DeleteViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1589 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1593 Thunk_IDirect3DDeviceImpl_1_DeleteViewport(LPDIRECT3DDEVICE iface,
1594 LPDIRECT3DVIEWPORT lpDirect3DViewport)
1596 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport);
1597 return IDirect3DDevice3_DeleteViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1598 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */);
1602 Thunk_IDirect3DDeviceImpl_2_NextViewport(LPDIRECT3DDEVICE2 iface,
1603 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2,
1604 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2,
1607 TRACE("(%p)->(%p,%p,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2, lplpDirect3DViewport2, dwFlags);
1608 return IDirect3DDevice3_NextViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1609 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */,
1610 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport2,
1615 Thunk_IDirect3DDeviceImpl_1_NextViewport(LPDIRECT3DDEVICE iface,
1616 LPDIRECT3DVIEWPORT lpDirect3DViewport,
1617 LPDIRECT3DVIEWPORT* lplpDirect3DViewport,
1620 TRACE("(%p)->(%p,%p,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport, lplpDirect3DViewport, dwFlags);
1621 return IDirect3DDevice3_NextViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
1622 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport /* No need to cast here as all interfaces are equivalent */,
1623 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport,
1628 Thunk_IDirect3DDeviceImpl_3_GetDirect3D(LPDIRECT3DDEVICE3 iface,
1629 LPDIRECT3D3* lplpDirect3D3)
1632 LPDIRECT3D7 ret_ptr;
1634 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D3);
1635 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1637 *lplpDirect3D3 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D3, ret_ptr);
1638 TRACE(" returning interface %p\n", *lplpDirect3D3);
1643 Thunk_IDirect3DDeviceImpl_2_GetDirect3D(LPDIRECT3DDEVICE2 iface,
1644 LPDIRECT3D2* lplpDirect3D2)
1647 LPDIRECT3D7 ret_ptr;
1649 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D2);
1650 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1652 *lplpDirect3D2 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D2, ret_ptr);
1653 TRACE(" returning interface %p\n", *lplpDirect3D2);
1658 Thunk_IDirect3DDeviceImpl_1_GetDirect3D(LPDIRECT3DDEVICE iface,
1659 LPDIRECT3D* lplpDirect3D)
1662 LPDIRECT3D7 ret_ptr;
1664 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D);
1665 ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface),
1667 *lplpDirect3D = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D, ret_ptr);
1668 TRACE(" returning interface %p\n", *lplpDirect3D);
1673 Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport(LPDIRECT3DDEVICE2 iface,
1674 LPDIRECT3DVIEWPORT2 lpDirect3DViewport2)
1676 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpDirect3DViewport2);
1677 return IDirect3DDevice3_SetCurrentViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1678 (LPDIRECT3DVIEWPORT3) lpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1682 Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport(LPDIRECT3DDEVICE2 iface,
1683 LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2)
1685 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lplpDirect3DViewport2);
1686 return IDirect3DDevice3_GetCurrentViewport(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
1687 (LPDIRECT3DVIEWPORT3*) lplpDirect3DViewport2 /* No need to cast here as all interfaces are equivalent */);
1691 Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats(LPDIRECT3DDEVICE3 iface,
1692 LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
1695 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DEnumPixelProc, lpArg);
1696 return IDirect3DDevice7_EnumTextureFormats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1702 Thunk_IDirect3DDeviceImpl_3_BeginScene(LPDIRECT3DDEVICE3 iface)
1704 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1705 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1709 Thunk_IDirect3DDeviceImpl_2_BeginScene(LPDIRECT3DDEVICE2 iface)
1711 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1712 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1716 Thunk_IDirect3DDeviceImpl_1_BeginScene(LPDIRECT3DDEVICE iface)
1718 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1719 return IDirect3DDevice7_BeginScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1723 Thunk_IDirect3DDeviceImpl_3_EndScene(LPDIRECT3DDEVICE3 iface)
1725 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1726 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface));
1730 Thunk_IDirect3DDeviceImpl_2_EndScene(LPDIRECT3DDEVICE2 iface)
1732 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1733 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface));
1737 Thunk_IDirect3DDeviceImpl_1_EndScene(LPDIRECT3DDEVICE iface)
1739 TRACE("(%p)->() thunking to IDirect3DDevice7 interface.\n", iface);
1740 return IDirect3DDevice7_EndScene(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface));
1744 Thunk_IDirect3DDeviceImpl_3_SetTransform(LPDIRECT3DDEVICE3 iface,
1745 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1746 LPD3DMATRIX lpD3DMatrix)
1748 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1749 return IDirect3DDevice7_SetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1750 dtstTransformStateType,
1755 Thunk_IDirect3DDeviceImpl_2_SetTransform(LPDIRECT3DDEVICE2 iface,
1756 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1757 LPD3DMATRIX lpD3DMatrix)
1759 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1760 return IDirect3DDevice7_SetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1761 dtstTransformStateType,
1766 Thunk_IDirect3DDeviceImpl_3_GetTransform(LPDIRECT3DDEVICE3 iface,
1767 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1768 LPD3DMATRIX lpD3DMatrix)
1770 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1771 return IDirect3DDevice7_GetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1772 dtstTransformStateType,
1777 Thunk_IDirect3DDeviceImpl_2_GetTransform(LPDIRECT3DDEVICE2 iface,
1778 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1779 LPD3DMATRIX lpD3DMatrix)
1781 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1782 return IDirect3DDevice7_GetTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1783 dtstTransformStateType,
1788 Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(LPDIRECT3DDEVICE3 iface,
1789 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1790 LPD3DMATRIX lpD3DMatrix)
1792 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1793 return IDirect3DDevice7_MultiplyTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1794 dtstTransformStateType,
1799 Thunk_IDirect3DDeviceImpl_2_MultiplyTransform(LPDIRECT3DDEVICE2 iface,
1800 D3DTRANSFORMSTATETYPE dtstTransformStateType,
1801 LPD3DMATRIX lpD3DMatrix)
1803 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dtstTransformStateType, lpD3DMatrix);
1804 return IDirect3DDevice7_MultiplyTransform(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1805 dtstTransformStateType,
1810 Thunk_IDirect3DDeviceImpl_3_SetRenderState(LPDIRECT3DDEVICE3 iface,
1811 D3DRENDERSTATETYPE dwRenderStateType,
1812 DWORD dwRenderState)
1814 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, dwRenderState);
1815 return IDirect3DDevice7_SetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1821 Thunk_IDirect3DDeviceImpl_2_SetRenderState(LPDIRECT3DDEVICE2 iface,
1822 D3DRENDERSTATETYPE dwRenderStateType,
1823 DWORD dwRenderState)
1825 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, dwRenderState);
1826 return IDirect3DDevice7_SetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1832 Thunk_IDirect3DDeviceImpl_3_GetRenderState(LPDIRECT3DDEVICE3 iface,
1833 D3DRENDERSTATETYPE dwRenderStateType,
1834 LPDWORD lpdwRenderState)
1836 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, lpdwRenderState);
1837 return IDirect3DDevice7_GetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1843 Thunk_IDirect3DDeviceImpl_2_GetRenderState(LPDIRECT3DDEVICE2 iface,
1844 D3DRENDERSTATETYPE dwRenderStateType,
1845 LPDWORD lpdwRenderState)
1847 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwRenderStateType, lpdwRenderState);
1848 return IDirect3DDevice7_GetRenderState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1854 Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(LPDIRECT3DDEVICE3 iface,
1855 D3DPRIMITIVETYPE d3dptPrimitiveType,
1856 DWORD d3dvtVertexType,
1858 DWORD dwVertexCount,
1861 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
1862 return IDirect3DDevice7_DrawPrimitive(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1871 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(LPDIRECT3DDEVICE3 iface,
1872 D3DPRIMITIVETYPE d3dptPrimitiveType,
1873 DWORD d3dvtVertexType,
1875 DWORD dwVertexCount,
1880 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
1881 return IDirect3DDevice7_DrawIndexedPrimitive(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1892 Thunk_IDirect3DDeviceImpl_3_SetClipStatus(LPDIRECT3DDEVICE3 iface,
1893 LPD3DCLIPSTATUS lpD3DClipStatus)
1895 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1896 return IDirect3DDevice7_SetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1901 Thunk_IDirect3DDeviceImpl_2_SetClipStatus(LPDIRECT3DDEVICE2 iface,
1902 LPD3DCLIPSTATUS lpD3DClipStatus)
1904 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1905 return IDirect3DDevice7_SetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1910 Thunk_IDirect3DDeviceImpl_3_GetClipStatus(LPDIRECT3DDEVICE3 iface,
1911 LPD3DCLIPSTATUS lpD3DClipStatus)
1913 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1914 return IDirect3DDevice7_GetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1919 Thunk_IDirect3DDeviceImpl_2_GetClipStatus(LPDIRECT3DDEVICE2 iface,
1920 LPD3DCLIPSTATUS lpD3DClipStatus)
1922 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpD3DClipStatus);
1923 return IDirect3DDevice7_GetClipStatus(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
1928 Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
1929 D3DPRIMITIVETYPE d3dptPrimitiveType,
1931 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
1932 DWORD dwVertexCount,
1935 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags);
1936 return IDirect3DDevice7_DrawPrimitiveStrided(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1939 lpD3DDrawPrimStrideData,
1945 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
1946 D3DPRIMITIVETYPE d3dptPrimitiveType,
1948 LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
1949 DWORD dwVertexCount,
1954 TRACE("(%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
1955 return IDirect3DDevice7_DrawIndexedPrimitiveStrided(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1958 lpD3DDrawPrimStrideData,
1966 Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility(LPDIRECT3DDEVICE3 iface,
1967 LPD3DVECTOR lpCenters,
1971 LPDWORD lpdwReturnValues)
1973 TRACE("(%p)->(%p,%p,%08lx,%08lx,%p) thunking to IDirect3DDevice7 interface.\n", iface, lpCenters, lpRadii, dwNumSpheres, dwFlags, lpdwReturnValues);
1974 return IDirect3DDevice7_ComputeSphereVisibility(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1983 Thunk_IDirect3DDeviceImpl_3_GetTextureStageState(LPDIRECT3DDEVICE3 iface,
1985 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
1988 TRACE("(%p)->(%08lx,%08x,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, d3dTexStageStateType, lpdwState);
1989 return IDirect3DDevice7_GetTextureStageState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
1991 d3dTexStageStateType,
1996 Thunk_IDirect3DDeviceImpl_3_SetTextureStageState(LPDIRECT3DDEVICE3 iface,
1998 D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
2001 TRACE("(%p)->(%08lx,%08x,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, d3dTexStageStateType, dwState);
2002 return IDirect3DDevice7_SetTextureStageState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2004 d3dTexStageStateType,
2009 Thunk_IDirect3DDeviceImpl_3_ValidateDevice(LPDIRECT3DDEVICE3 iface,
2012 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lpdwPasses);
2013 return IDirect3DDevice7_ValidateDevice(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2018 Thunk_IDirect3DDeviceImpl_2_GetCaps(LPDIRECT3DDEVICE2 iface,
2019 LPD3DDEVICEDESC lpD3DHWDevDesc,
2020 LPD3DDEVICEDESC lpD3DHELDevDesc)
2022 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
2023 return IDirect3DDevice3_GetCaps(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2029 Thunk_IDirect3DDeviceImpl_1_GetCaps(LPDIRECT3DDEVICE iface,
2030 LPD3DDEVICEDESC lpD3DHWDevDesc,
2031 LPD3DDEVICEDESC lpD3DHELDevDesc)
2033 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DHWDevDesc, lpD3DHELDevDesc);
2034 return IDirect3DDevice3_GetCaps(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
2040 Thunk_IDirect3DDeviceImpl_1_SwapTextureHandles(LPDIRECT3DDEVICE iface,
2041 LPDIRECT3DTEXTURE lpD3DTex1,
2042 LPDIRECT3DTEXTURE lpD3DTex2)
2044 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", iface, lpD3DTex1, lpD3DTex2);
2045 return IDirect3DDevice2_SwapTextureHandles(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice2, iface),
2046 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirect3DTexture2, lpD3DTex1),
2047 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture, IDirect3DTexture2, lpD3DTex2));
2051 Thunk_IDirect3DDeviceImpl_2_GetStats(LPDIRECT3DDEVICE2 iface,
2052 LPD3DSTATS lpD3DStats)
2054 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DStats);
2055 return IDirect3DDevice3_GetStats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2060 Thunk_IDirect3DDeviceImpl_1_GetStats(LPDIRECT3DDEVICE iface,
2061 LPD3DSTATS lpD3DStats)
2063 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpD3DStats);
2064 return IDirect3DDevice3_GetStats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, iface),
2069 Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(LPDIRECT3DDEVICE3 iface,
2070 LPDIRECTDRAWSURFACE4 lpNewRenderTarget,
2073 TRACE("(%p)->(%p,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, lpNewRenderTarget, dwFlags);
2074 return IDirect3DDevice7_SetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2075 (LPDIRECTDRAWSURFACE7) lpNewRenderTarget /* No cast needed as DSurf4 == DSurf7 */,
2080 Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(LPDIRECT3DDEVICE3 iface,
2081 LPDIRECTDRAWSURFACE4* lplpRenderTarget)
2083 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpRenderTarget);
2084 return IDirect3DDevice7_GetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2085 (LPDIRECTDRAWSURFACE7*) lplpRenderTarget /* No cast needed as DSurf4 == DSurf7 */);
2089 Thunk_IDirect3DDeviceImpl_2_SetRenderTarget(LPDIRECT3DDEVICE2 iface,
2090 LPDIRECTDRAWSURFACE lpNewRenderTarget,
2093 TRACE("(%p)->(%p,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, lpNewRenderTarget, dwFlags);
2094 return IDirect3DDevice7_SetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
2095 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface3, IDirectDrawSurface7, lpNewRenderTarget),
2100 Thunk_IDirect3DDeviceImpl_2_GetRenderTarget(LPDIRECT3DDEVICE2 iface,
2101 LPDIRECTDRAWSURFACE* lplpRenderTarget)
2104 LPDIRECTDRAWSURFACE7 ret_val;
2106 TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpRenderTarget);
2107 ret = IDirect3DDevice7_GetRenderTarget(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
2109 *lplpRenderTarget = (LPDIRECTDRAWSURFACE) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirectDrawSurface3, ret_val);
2110 TRACE(" returning interface %p\n", *lplpRenderTarget);
2115 Thunk_IDirect3DDeviceImpl_2_Vertex(LPDIRECT3DDEVICE2 iface,
2116 LPVOID lpVertexType)
2118 TRACE("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", iface, lpVertexType);
2119 return IDirect3DDevice3_Vertex(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2124 Thunk_IDirect3DDeviceImpl_2_Index(LPDIRECT3DDEVICE2 iface,
2127 TRACE("(%p)->(%04x) thunking to IDirect3DDevice3 interface.\n", iface, wVertexIndex);
2128 return IDirect3DDevice3_Index(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2133 Thunk_IDirect3DDeviceImpl_2_End(LPDIRECT3DDEVICE2 iface,
2136 TRACE("(%p)->(%08lx) thunking to IDirect3DDevice3 interface.\n", iface, dwFlags);
2137 return IDirect3DDevice3_End(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2142 Thunk_IDirect3DDeviceImpl_2_GetLightState(LPDIRECT3DDEVICE2 iface,
2143 D3DLIGHTSTATETYPE dwLightStateType,
2144 LPDWORD lpdwLightState)
2146 TRACE("(%p)->(%08x,%p) thunking to IDirect3DDevice3 interface.\n", iface, dwLightStateType, lpdwLightState);
2147 return IDirect3DDevice3_GetLightState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2153 Thunk_IDirect3DDeviceImpl_2_SetLightState(LPDIRECT3DDEVICE2 iface,
2154 D3DLIGHTSTATETYPE dwLightStateType,
2157 TRACE("(%p)->(%08x,%08lx) thunking to IDirect3DDevice3 interface.\n", iface, dwLightStateType, dwLightState);
2158 return IDirect3DDevice3_SetLightState(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, iface),
2164 Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(LPDIRECT3DDEVICE iface,
2165 LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
2168 TRACE("(%p)->(%p,%p) thunking to IDirect3DDevice2 interface.\n", iface, lpD3DEnumTextureProc, lpArg);
2169 return IDirect3DDevice2_EnumTextureFormats(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice2, iface),
2170 lpD3DEnumTextureProc,
2175 Thunk_IDirect3DDeviceImpl_3_SetTexture(LPDIRECT3DDEVICE3 iface,
2177 LPDIRECT3DTEXTURE2 lpTexture2)
2179 TRACE("(%p)->(%ld,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, lpTexture2);
2180 return IDirect3DDevice7_SetTexture(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2182 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture2, IDirectDrawSurface7, lpTexture2));
2186 Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface,
2187 D3DPRIMITIVETYPE d3dptPrimitiveType,
2188 LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
2189 DWORD dwStartVertex,
2190 DWORD dwNumVertices,
2193 TRACE("(%p)->(%08x,%p,%08lx,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface,
2194 d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags);
2195 return IDirect3DDevice7_DrawPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2197 COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf),
2204 Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface,
2205 D3DPRIMITIVETYPE d3dptPrimitiveType,
2206 LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
2211 TRACE("(%p)->(%08x,%p,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface,
2212 d3dptPrimitiveType, lpD3DVertexBuf, lpwIndices, dwIndexCount, dwFlags);
2213 return IDirect3DDevice7_DrawIndexedPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2215 COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf),
2224 Thunk_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface,
2226 LPDIRECT3DTEXTURE2* lplpTexture2)
2229 LPDIRECTDRAWSURFACE7 ret_val;
2231 TRACE("(%p)->(%ld,%p) thunking to IDirect3DDevice7 interface.\n", iface, dwStage, lplpTexture2);
2232 ret = IDirect3DDevice7_GetTexture(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
2236 *lplpTexture2 = COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, ret_val);
2238 TRACE(" returning interface %p.\n", *lplpTexture2);