2 * IDirect3DDevice9 implementation
4 * Copyright 2002-2003 Jason Edmeades
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
33 #include "wine/debug.h"
35 #include "d3d9_private.h"
37 /** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
40 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
41 WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
44 /* IDirect3D IUnknown parts follow: */
45 HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9 iface, REFIID riid, LPVOID* ppobj) {
46 ICOM_THIS(IDirect3DDevice9Impl,iface);
48 if (IsEqualGUID(riid, &IID_IUnknown)
49 || IsEqualGUID(riid, &IID_IDirect3DDevice9)) {
50 IDirect3DDevice9Impl_AddRef(iface);
55 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
59 ULONG WINAPI IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9 iface) {
60 ICOM_THIS(IDirect3DDevice9Impl,iface);
61 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
65 ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
66 ICOM_THIS(IDirect3DDevice9Impl,iface);
67 ULONG ref = --This->ref;
68 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
70 HeapFree(GetProcessHeap(), 0, This);
75 /* IDirect3DDevice Interface follow: */
76 HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface) {
77 ICOM_THIS(IDirect3DDevice9Impl,iface);
78 TRACE("(%p) : stub\n", This); /* No way of notifying yet! */
82 UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface) {
83 ICOM_THIS(IDirect3DDevice9Impl,iface);
84 TRACE("(%p) : stub, emulating 32Mb for now\n", This);
86 * pretend we have 32MB of any type of memory queried.
88 return (1024*1024*32);
91 HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedRessources(LPDIRECT3DDEVICE9 iface) {
92 ICOM_THIS(IDirect3DDevice9Impl,iface);
93 FIXME("(%p) : stub\n", This);
97 HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9) {
98 ICOM_THIS(IDirect3DDevice9Impl,iface);
99 TRACE("(%p) : returning %p\n", This, This->direct3d);
101 *ppD3D9 = (IDirect3D9*) This->direct3d;
102 IDirect3D9_AddRef(*ppD3D9);
106 HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface, D3DCAPS9* pCaps) {
107 ICOM_THIS(IDirect3DDevice9Impl,iface);
108 FIXME("(%p) : stub, calling idirect3d for now\n", This);
109 IDirect3D9Impl_GetDeviceCaps((LPDIRECT3D9) This->direct3d, This->adapterNo, This->devType, pCaps);
113 HRESULT WINAPI IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DDISPLAYMODE* pMode) {
114 ICOM_THIS(IDirect3DDevice9Impl,iface);
115 FIXME("(%p) : stub\n", This);
119 HRESULT WINAPI IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
120 ICOM_THIS(IDirect3DDevice9Impl,iface);
121 TRACE("(%p) copying to %p\n", This, pParameters);
122 memcpy(pParameters, &This->CreateParms, sizeof(D3DDEVICE_CREATION_PARAMETERS));
126 HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
127 IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap;
128 ICOM_THIS(IDirect3DDevice9Impl,iface);
129 TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
131 if (D3DFMT_A8R8G8B8 != pSur->myDesc.Format) {
132 ERR("(%p) : surface(%p) have a invalid format\n", This, pCursorBitmap);
133 return D3DERR_INVALIDCALL;
135 if (32 != pSur->myDesc.Height || 32 != pSur->myDesc.Width) {
136 ERR("(%p) : surface(%p) have a invalid size\n", This, pCursorBitmap);
137 return D3DERR_INVALIDCALL;
140 This->xHotSpot = XHotSpot;
141 This->yHotSpot = YHotSpot;
145 void WINAPI IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9 iface, int XScreenSpace, int YScreenSpace, DWORD Flags) {
146 ICOM_THIS(IDirect3DDevice9Impl,iface);
147 TRACE("(%p) : SetPos to (%u,%u)\n", This, XScreenSpace, YScreenSpace);
148 This->xScreenSpace = XScreenSpace;
149 This->yScreenSpace = YScreenSpace;
153 BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface, BOOL bShow) {
154 ICOM_THIS(IDirect3DDevice9Impl,iface);
155 TRACE("(%p) : visible(%d)\n", This, bShow);
156 This->bCursorVisible = bShow;
160 HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
161 ICOM_THIS(IDirect3DDevice9Impl,iface);
162 FIXME("(%p) : stub\n", This);
166 HRESULT WINAPI IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
167 ICOM_THIS(IDirect3DDevice9Impl,iface);
168 TRACE("(%p) : stub!\n", This);
172 HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
173 ICOM_THIS(IDirect3DDevice9Impl,iface);
174 *ppBackBuffer = (LPDIRECT3DSURFACE9) This->backBuffer;
175 TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
176 if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
177 FIXME("Only one backBuffer currently supported\n");
178 return D3DERR_INVALIDCALL;
180 /* Note inc ref on returned surface */
181 IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppBackBuffer);
185 HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
186 ICOM_THIS(IDirect3DDevice9Impl,iface);
187 FIXME("(%p) : stub\n", This);
191 HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BOOL bEnableDialogs) {
192 ICOM_THIS(IDirect3DDevice9Impl,iface);
193 FIXME("(%p) : stub\n", This);
197 void WINAPI IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
199 ICOM_THIS(IDirect3DDevice9Impl,iface);
201 FIXME("(%p) : pRamp@%p\n", This, pRamp);
202 hDC = GetDC(This->win_handle);
203 SetDeviceGammaRamp(hDC, (LPVOID) pRamp);
204 ReleaseDC(This->win_handle, hDC);
208 void WINAPI IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DGAMMARAMP* pRamp) {
210 ICOM_THIS(IDirect3DDevice9Impl,iface);
212 FIXME("(%p) : pRamp@%p\n", This, pRamp);
213 hDC = GetDC(This->win_handle);
214 GetDeviceGammaRamp(hDC, pRamp);
215 ReleaseDC(This->win_handle, hDC);
219 HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
220 ICOM_THIS(IDirect3DDevice9Impl,iface);
221 FIXME("(%p) : stub\n", This);
225 HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
226 ICOM_THIS(IDirect3DDevice9Impl,iface);
227 FIXME("(%p) : stub\n", This);
231 HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) {
232 ICOM_THIS(IDirect3DDevice9Impl,iface);
233 FIXME("(%p) : stub\n", This);
237 HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9 iface, IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) {
238 ICOM_THIS(IDirect3DDevice9Impl,iface);
239 FIXME("(%p) : stub\n", This);
243 HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pDestSurface) {
244 ICOM_THIS(IDirect3DDevice9Impl,iface);
245 FIXME("(%p) : stub\n", This);
249 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
250 ICOM_THIS(IDirect3DDevice9Impl,iface);
251 FIXME("(%p) : stub\n", This);
255 HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
256 ICOM_THIS(IDirect3DDevice9Impl,iface);
257 FIXME("(%p) : stub\n", This);
261 HRESULT WINAPI IDirect3DDevice9Impl_StretchRects(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) {
262 ICOM_THIS(IDirect3DDevice9Impl,iface);
263 FIXME("(%p) : stub\n", This);
267 HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) {
268 ICOM_THIS(IDirect3DDevice9Impl,iface);
269 FIXME("(%p) : stub\n", This);
273 HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
274 ICOM_THIS(IDirect3DDevice9Impl,iface);
275 FIXME("(%p) : stub\n", This);
279 HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
280 ICOM_THIS(IDirect3DDevice9Impl,iface);
281 FIXME("(%p) : stub\n", This);
285 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) {
286 ICOM_THIS(IDirect3DDevice9Impl,iface);
287 FIXME("(%p) : stub\n", This);
291 HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pZStencilSurface) {
292 ICOM_THIS(IDirect3DDevice9Impl,iface);
293 FIXME("(%p) : stub\n", This);
297 HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9** ppZStencilSurface) {
298 ICOM_THIS(IDirect3DDevice9Impl,iface);
299 FIXME("(%p) : stub\n", This);
303 HRESULT WINAPI IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface) {
304 ICOM_THIS(IDirect3DDevice9Impl,iface);
305 TRACE("(%p) : stub\n", This);
309 HRESULT WINAPI IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface) {
310 ICOM_THIS(IDirect3DDevice9Impl,iface);
311 FIXME("(%p) : stub\n", This);
315 HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
316 ICOM_THIS(IDirect3DDevice9Impl,iface);
317 FIXME("(%p) : stub\n", This);
321 HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE d3dts, CONST D3DMATRIX* lpmatrix) {
322 ICOM_THIS(IDirect3DDevice9Impl,iface);
323 FIXME("(%p) : stub\n", This);
327 HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
328 ICOM_THIS(IDirect3DDevice9Impl,iface);
329 TRACE("(%p) : for State %d\n", This, State);
330 memcpy(pMatrix, &This->StateBlock->transforms[State], sizeof(D3DMATRIX));
334 HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
335 D3DMATRIX *mat = NULL;
338 /* Note: Using UpdateStateBlock means it would be recorded in a state block change,
339 but works regardless of recording being on.
340 If this is found to be wrong, change to StateBlock. */
341 ICOM_THIS(IDirect3DDevice9Impl,iface);
342 TRACE("(%p) : For state %u\n", This, State);
344 if (State < HIGHEST_TRANSFORMSTATE) {
345 mat = &This->UpdateStateBlock->transforms[State];
347 FIXME("Unhandled transform state!!\n");
350 /* Copied from ddraw code: */
351 temp.u.s._11 = (mat->u.s._11 * pMatrix->u.s._11) + (mat->u.s._21 * pMatrix->u.s._12) + (mat->u.s._31 * pMatrix->u.s._13) + (mat->u.s._41 * pMatrix->u.s._14);
352 temp.u.s._21 = (mat->u.s._11 * pMatrix->u.s._21) + (mat->u.s._21 * pMatrix->u.s._22) + (mat->u.s._31 * pMatrix->u.s._23) + (mat->u.s._41 * pMatrix->u.s._24);
353 temp.u.s._31 = (mat->u.s._11 * pMatrix->u.s._31) + (mat->u.s._21 * pMatrix->u.s._32) + (mat->u.s._31 * pMatrix->u.s._33) + (mat->u.s._41 * pMatrix->u.s._34);
354 temp.u.s._41 = (mat->u.s._11 * pMatrix->u.s._41) + (mat->u.s._21 * pMatrix->u.s._42) + (mat->u.s._31 * pMatrix->u.s._43) + (mat->u.s._41 * pMatrix->u.s._44);
356 temp.u.s._12 = (mat->u.s._12 * pMatrix->u.s._11) + (mat->u.s._22 * pMatrix->u.s._12) + (mat->u.s._32 * pMatrix->u.s._13) + (mat->u.s._42 * pMatrix->u.s._14);
357 temp.u.s._22 = (mat->u.s._12 * pMatrix->u.s._21) + (mat->u.s._22 * pMatrix->u.s._22) + (mat->u.s._32 * pMatrix->u.s._23) + (mat->u.s._42 * pMatrix->u.s._24);
358 temp.u.s._32 = (mat->u.s._12 * pMatrix->u.s._31) + (mat->u.s._22 * pMatrix->u.s._32) + (mat->u.s._32 * pMatrix->u.s._33) + (mat->u.s._42 * pMatrix->u.s._34);
359 temp.u.s._42 = (mat->u.s._12 * pMatrix->u.s._41) + (mat->u.s._22 * pMatrix->u.s._42) + (mat->u.s._32 * pMatrix->u.s._43) + (mat->u.s._42 * pMatrix->u.s._44);
361 temp.u.s._13 = (mat->u.s._13 * pMatrix->u.s._11) + (mat->u.s._23 * pMatrix->u.s._12) + (mat->u.s._33 * pMatrix->u.s._13) + (mat->u.s._43 * pMatrix->u.s._14);
362 temp.u.s._23 = (mat->u.s._13 * pMatrix->u.s._21) + (mat->u.s._23 * pMatrix->u.s._22) + (mat->u.s._33 * pMatrix->u.s._23) + (mat->u.s._43 * pMatrix->u.s._24);
363 temp.u.s._33 = (mat->u.s._13 * pMatrix->u.s._31) + (mat->u.s._23 * pMatrix->u.s._32) + (mat->u.s._33 * pMatrix->u.s._33) + (mat->u.s._43 * pMatrix->u.s._34);
364 temp.u.s._43 = (mat->u.s._13 * pMatrix->u.s._41) + (mat->u.s._23 * pMatrix->u.s._42) + (mat->u.s._33 * pMatrix->u.s._43) + (mat->u.s._43 * pMatrix->u.s._44);
366 temp.u.s._14 = (mat->u.s._14 * pMatrix->u.s._11) + (mat->u.s._24 * pMatrix->u.s._12) + (mat->u.s._34 * pMatrix->u.s._13) + (mat->u.s._44 * pMatrix->u.s._14);
367 temp.u.s._24 = (mat->u.s._14 * pMatrix->u.s._21) + (mat->u.s._24 * pMatrix->u.s._22) + (mat->u.s._34 * pMatrix->u.s._23) + (mat->u.s._44 * pMatrix->u.s._24);
368 temp.u.s._34 = (mat->u.s._14 * pMatrix->u.s._31) + (mat->u.s._24 * pMatrix->u.s._32) + (mat->u.s._34 * pMatrix->u.s._33) + (mat->u.s._44 * pMatrix->u.s._34);
369 temp.u.s._44 = (mat->u.s._14 * pMatrix->u.s._41) + (mat->u.s._24 * pMatrix->u.s._42) + (mat->u.s._34 * pMatrix->u.s._43) + (mat->u.s._44 * pMatrix->u.s._44);
371 /* Apply change via set transform - will reapply to eg. lights this way */
372 IDirect3DDevice9Impl_SetTransform(iface, State, &temp);
376 HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) {
377 ICOM_THIS(IDirect3DDevice9Impl,iface);
378 FIXME("(%p) : stub\n", This);
382 HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface, D3DVIEWPORT9* pViewport) {
383 ICOM_THIS(IDirect3DDevice9Impl,iface);
384 TRACE("(%p)\n", This);
385 memcpy(pViewport, &This->StateBlock->viewport, sizeof(D3DVIEWPORT9));
389 HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) {
390 ICOM_THIS(IDirect3DDevice9Impl,iface);
391 FIXME("(%p) : stub\n", This);
395 HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface, D3DMATERIAL9* pMaterial) {
396 ICOM_THIS(IDirect3DDevice9Impl,iface);
397 memcpy(pMaterial, &This->UpdateStateBlock->material, sizeof (D3DMATERIAL9));
398 TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", This, pMaterial->Diffuse.r, pMaterial->Diffuse.g, pMaterial->Diffuse.b, pMaterial->Diffuse.a);
399 TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", This, pMaterial->Ambient.r, pMaterial->Ambient.g, pMaterial->Ambient.b, pMaterial->Ambient.a);
400 TRACE("(%p) : Specular (%f,%f,%f,%f)\n", This, pMaterial->Specular.r, pMaterial->Specular.g, pMaterial->Specular.b, pMaterial->Specular.a);
401 TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", This, pMaterial->Emissive.r, pMaterial->Emissive.g, pMaterial->Emissive.b, pMaterial->Emissive.a);
402 TRACE("(%p) : Power (%f)\n", This, pMaterial->Power);
406 HRESULT WINAPI IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST D3DLIGHT9* pLight) {
407 ICOM_THIS(IDirect3DDevice9Impl,iface);
408 FIXME("(%p) : stub\n", This);
412 HRESULT WINAPI IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9 iface, DWORD Index,D3DLIGHT9* pLight) {
413 ICOM_THIS(IDirect3DDevice9Impl,iface);
414 FIXME("(%p) : stub\n", This);
418 HRESULT WINAPI IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL Enable) {
419 ICOM_THIS(IDirect3DDevice9Impl,iface);
420 FIXME("(%p) : stub\n", This);
424 HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL* pEnable) {
425 ICOM_THIS(IDirect3DDevice9Impl,iface);
426 FIXME("(%p) : stub\n", This);
430 HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST float* pPlane) {
431 ICOM_THIS(IDirect3DDevice9Impl,iface);
432 FIXME("(%p) : stub\n", This);
436 HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, float* pPlane) {
437 ICOM_THIS(IDirect3DDevice9Impl,iface);
438 FIXME("(%p) : stub\n", This);
442 HRESULT WINAPI IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD Value) {
443 ICOM_THIS(IDirect3DDevice9Impl,iface);
444 FIXME("(%p) : stub\n", This);
448 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD* pValue) {
449 ICOM_THIS(IDirect3DDevice9Impl,iface);
450 TRACE("(%p) for State %d = %ld\n", This, State, This->UpdateStateBlock->renderstate[State]);
451 *pValue = This->StateBlock->renderstate[State];
455 HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface, CONST D3DCLIPSTATUS9* pClipStatus) {
456 ICOM_THIS(IDirect3DDevice9Impl,iface);
457 FIXME("(%p) : stub\n", This);
461 HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9 iface, D3DCLIPSTATUS9* pClipStatus) {
462 ICOM_THIS(IDirect3DDevice9Impl,iface);
463 FIXME("(%p) : stub\n", This);
467 HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9** ppTexture) {
468 ICOM_THIS(IDirect3DDevice9Impl,iface);
469 TRACE("(%p) : returning %p for stage %ld\n", This, This->UpdateStateBlock->textures[Stage], Stage);
470 *ppTexture = (LPDIRECT3DBASETEXTURE9) This->UpdateStateBlock->textures[Stage];
471 IDirect3DBaseTexture9Impl_AddRef(*ppTexture);
475 HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) {
476 ICOM_THIS(IDirect3DDevice9Impl,iface);
477 FIXME("(%p) : stub\n", This);
481 HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
482 ICOM_THIS(IDirect3DDevice9Impl,iface);
483 TRACE("(%p) : requesting Stage %ld, Type %d getting %ld\n", This, Stage, Type, This->UpdateStateBlock->texture_state[Stage][Type]);
484 *pValue = This->UpdateStateBlock->texture_state[Stage][Type];
488 HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
489 ICOM_THIS(IDirect3DDevice9Impl,iface);
490 FIXME("(%p) : stub\n", This);
494 HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) {
495 ICOM_THIS(IDirect3DDevice9Impl,iface);
496 FIXME("(%p) : stub\n", This);
500 HRESULT WINAPI IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) {
501 ICOM_THIS(IDirect3DDevice9Impl,iface);
502 FIXME("(%p) : stub\n", This);
506 HRESULT WINAPI IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9 iface, DWORD* pNumPasses) {
507 ICOM_THIS(IDirect3DDevice9Impl,iface);
508 TRACE("(%p) : stub\n", This);
512 HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
513 ICOM_THIS(IDirect3DDevice9Impl,iface);
514 FIXME("(%p) : setting p[%u] <= RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber, pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
515 memcpy(This->palettes[PaletteNumber], pEntries, 256 * sizeof(PALETTEENTRY));
519 HRESULT WINAPI IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
520 ICOM_THIS(IDirect3DDevice9Impl,iface);
521 memcpy(pEntries, This->palettes[PaletteNumber], 256 * sizeof(PALETTEENTRY));
522 FIXME("(%p) : returning p[%u] => RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber, pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
526 HRESULT WINAPI IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber) {
527 ICOM_THIS(IDirect3DDevice9Impl,iface);
528 TRACE("(%p) : stub\n", This);
532 HRESULT WINAPI IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT* PaletteNumber) {
533 ICOM_THIS(IDirect3DDevice9Impl,iface);
534 *PaletteNumber = This->currentPalette;
535 FIXME("(%p) : Returning (%u)\n", This, *PaletteNumber);
539 HRESULT WINAPI IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9 iface, CONST RECT* pRect) {
540 ICOM_THIS(IDirect3DDevice9Impl,iface);
541 FIXME("(%p) : stub\n", This);
545 HRESULT WINAPI IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9 iface, RECT* pRect) {
546 ICOM_THIS(IDirect3DDevice9Impl,iface);
547 FIXME("(%p) : stub\n", This);
551 HRESULT WINAPI IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface, BOOL bSoftware) {
552 ICOM_THIS(IDirect3DDevice9Impl,iface);
553 FIXME("(%p) : stub\n", This);
557 BOOL WINAPI IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface) {
558 ICOM_THIS(IDirect3DDevice9Impl,iface);
559 FIXME("(%p) : stub\n", This);
563 HRESULT WINAPI IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9 iface, float nSegments) {
564 ICOM_THIS(IDirect3DDevice9Impl,iface);
565 FIXME("(%p) : stub\n", This);
569 float WINAPI IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface) {
570 ICOM_THIS(IDirect3DDevice9Impl,iface);
571 FIXME("(%p) : stub\n", This);
575 HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
576 ICOM_THIS(IDirect3DDevice9Impl,iface);
577 FIXME("(%p) : stub\n", This);
581 HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType,
582 INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
583 ICOM_THIS(IDirect3DDevice9Impl,iface);
584 FIXME("(%p) : stub\n", This);
588 HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
589 ICOM_THIS(IDirect3DDevice9Impl,iface);
590 FIXME("(%p) : stub\n", This);
594 HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex,
595 UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData,
596 D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
597 ICOM_THIS(IDirect3DDevice9Impl,iface);
598 FIXME("(%p) : stub\n", This);
602 HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) {
603 ICOM_THIS(IDirect3DDevice9Impl,iface);
604 FIXME("(%p) : stub\n", This);
608 HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface, DWORD FVF) {
609 ICOM_THIS(IDirect3DDevice9Impl,iface);
610 FIXME("(%p) : stub\n", This);
614 HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface, DWORD* pFVF) {
615 ICOM_THIS(IDirect3DDevice9Impl,iface);
616 FIXME("(%p) : stub\n", This);
620 HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
621 IDirect3DVertexBuffer9 *oldSrc;
622 ICOM_THIS(IDirect3DDevice9Impl,iface);
624 oldSrc = This->StateBlock->stream_source[StreamNumber];
625 TRACE("(%p) : StreamNo: %d, OldStream (%p), NewStream (%p), NewStride %d\n", This, StreamNumber, oldSrc, pStreamData, Stride);
627 This->UpdateStateBlock->Changed.stream_source[StreamNumber] = TRUE;
628 This->UpdateStateBlock->Set.stream_source[StreamNumber] = TRUE;
629 This->UpdateStateBlock->stream_stride[StreamNumber] = Stride;
630 This->UpdateStateBlock->stream_source[StreamNumber] = pStreamData;
632 /* Handle recording of state blocks */
633 if (This->isRecordingState) {
634 TRACE("Recording... not performing anything\n");
638 if (oldSrc != NULL) IDirect3DVertexBuffer9Impl_Release(oldSrc);
639 if (pStreamData != NULL) IDirect3DVertexBuffer9Impl_AddRef(pStreamData);
643 HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9** pStream, UINT* OffsetInBytes, UINT* pStride) {
644 ICOM_THIS(IDirect3DDevice9Impl,iface);
645 TRACE("(%p) : StreamNo: %d, Stream (%p), Stride %d\n", This, StreamNumber, This->StateBlock->stream_source[StreamNumber], This->StateBlock->stream_stride[StreamNumber]);
646 *pStream = This->StateBlock->stream_source[StreamNumber];
647 *pStride = This->StateBlock->stream_stride[StreamNumber];
648 IDirect3DVertexBuffer9Impl_AddRef((LPDIRECT3DVERTEXBUFFER9) *pStream);
652 HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT Divider) {
653 ICOM_THIS(IDirect3DDevice9Impl,iface);
654 FIXME("(%p) : stub\n", This);
658 HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT* Divider) {
659 ICOM_THIS(IDirect3DDevice9Impl,iface);
660 FIXME("(%p) : stub\n", This);
664 HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9* pIndexData) {
665 ICOM_THIS(IDirect3DDevice9Impl,iface);
666 IDirect3DIndexBuffer9 *oldIdxs;
668 TRACE("(%p) : Setting to %p\n", This, pIndexData);
669 oldIdxs = This->StateBlock->pIndexData;
671 This->UpdateStateBlock->Changed.Indices = TRUE;
672 This->UpdateStateBlock->Set.Indices = TRUE;
673 This->UpdateStateBlock->pIndexData = pIndexData;
675 /* Handle recording of state blocks */
676 if (This->isRecordingState) {
677 TRACE("Recording... not performing anything\n");
681 if (oldIdxs) IDirect3DIndexBuffer9Impl_Release(oldIdxs);
682 if (pIndexData) IDirect3DIndexBuffer9Impl_AddRef(This->StateBlock->pIndexData);
686 HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9** ppIndexData) {
687 ICOM_THIS(IDirect3DDevice9Impl,iface);
688 FIXME("(%p) : stub\n", This);
690 *ppIndexData = This->StateBlock->pIndexData;
691 /* up ref count on ppindexdata */
692 if (*ppIndexData) IDirect3DIndexBuffer9Impl_AddRef(*ppIndexData);
697 HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
698 ICOM_THIS(IDirect3DDevice9Impl,iface);
699 FIXME("(%p) : stub\n", This);
703 HRESULT WINAPI IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
704 ICOM_THIS(IDirect3DDevice9Impl,iface);
705 FIXME("(%p) : stub\n", This);
709 HRESULT WINAPI IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9 iface, UINT Handle) {
710 ICOM_THIS(IDirect3DDevice9Impl,iface);
711 FIXME("(%p) : stub\n", This);
716 ICOM_VTABLE(IDirect3DDevice9) Direct3DDevice9_Vtbl =
718 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
719 IDirect3DDevice9Impl_QueryInterface,
720 IDirect3DDevice9Impl_AddRef,
721 IDirect3DDevice9Impl_Release,
722 IDirect3DDevice9Impl_TestCooperativeLevel,
723 IDirect3DDevice9Impl_GetAvailableTextureMem,
724 IDirect3DDevice9Impl_EvictManagedRessources,
725 IDirect3DDevice9Impl_GetDirect3D,
726 IDirect3DDevice9Impl_GetDeviceCaps,
727 IDirect3DDevice9Impl_GetDisplayMode,
728 IDirect3DDevice9Impl_GetCreationParameters,
729 IDirect3DDevice9Impl_SetCursorProperties,
730 IDirect3DDevice9Impl_SetCursorPosition,
731 IDirect3DDevice9Impl_ShowCursor,
732 IDirect3DDevice9Impl_CreateAdditionalSwapChain,
733 IDirect3DDevice9Impl_GetSwapChain,
734 IDirect3DDevice9Impl_GetNumberOfSwapChains,
735 IDirect3DDevice9Impl_Reset,
736 IDirect3DDevice9Impl_Present,
737 IDirect3DDevice9Impl_GetBackBuffer,
738 IDirect3DDevice9Impl_GetRasterStatus,
739 IDirect3DDevice9Impl_SetDialogBoxMode,
740 IDirect3DDevice9Impl_SetGammaRamp,
741 IDirect3DDevice9Impl_GetGammaRamp,
742 IDirect3DDevice9Impl_CreateTexture,
743 IDirect3DDevice9Impl_CreateVolumeTexture,
744 IDirect3DDevice9Impl_CreateCubeTexture,
745 IDirect3DDevice9Impl_CreateVertexBuffer,
746 IDirect3DDevice9Impl_CreateIndexBuffer,
747 IDirect3DDevice9Impl_CreateRenderTarget,
748 IDirect3DDevice9Impl_CreateDepthStencilSurface,
749 IDirect3DDevice9Impl_UpdateSurface,
750 IDirect3DDevice9Impl_UpdateTexture,
751 IDirect3DDevice9Impl_GetRenderTargetData,
752 IDirect3DDevice9Impl_GetFrontBufferData,
753 IDirect3DDevice9Impl_StretchRects,
754 IDirect3DDevice9Impl_ColorFill,
755 IDirect3DDevice9Impl_CreateOffscreenPlainSurface,
756 IDirect3DDevice9Impl_SetRenderTarget,
757 IDirect3DDevice9Impl_GetRenderTarget,
758 IDirect3DDevice9Impl_SetDepthStencilSurface,
759 IDirect3DDevice9Impl_GetDepthStencilSurface,
760 IDirect3DDevice9Impl_BeginScene,
761 IDirect3DDevice9Impl_EndScene,
762 IDirect3DDevice9Impl_Clear,
763 IDirect3DDevice9Impl_SetTransform,
764 IDirect3DDevice9Impl_GetTransform,
765 IDirect3DDevice9Impl_MultiplyTransform,
766 IDirect3DDevice9Impl_SetViewport,
767 IDirect3DDevice9Impl_GetViewport,
768 IDirect3DDevice9Impl_SetMaterial,
769 IDirect3DDevice9Impl_GetMaterial,
770 IDirect3DDevice9Impl_SetLight,
771 IDirect3DDevice9Impl_GetLight,
772 IDirect3DDevice9Impl_LightEnable,
773 IDirect3DDevice9Impl_GetLightEnable,
774 IDirect3DDevice9Impl_SetClipPlane,
775 IDirect3DDevice9Impl_GetClipPlane,
776 IDirect3DDevice9Impl_SetRenderState,
777 IDirect3DDevice9Impl_GetRenderState,
778 IDirect3DDevice9Impl_CreateStateBlock,
779 IDirect3DDevice9Impl_BeginStateBlock,
780 IDirect3DDevice9Impl_EndStateBlock,
781 IDirect3DDevice9Impl_SetClipStatus,
782 IDirect3DDevice9Impl_GetClipStatus,
783 IDirect3DDevice9Impl_GetTexture,
784 IDirect3DDevice9Impl_SetTexture,
785 IDirect3DDevice9Impl_GetTextureStageState,
786 IDirect3DDevice9Impl_SetTextureStageState,
787 IDirect3DDevice9Impl_GetSamplerState,
788 IDirect3DDevice9Impl_SetSamplerState,
789 IDirect3DDevice9Impl_ValidateDevice,
790 IDirect3DDevice9Impl_SetPaletteEntries,
791 IDirect3DDevice9Impl_GetPaletteEntries,
792 IDirect3DDevice9Impl_SetCurrentTexturePalette,
793 IDirect3DDevice9Impl_GetCurrentTexturePalette,
794 IDirect3DDevice9Impl_SetScissorRect,
795 IDirect3DDevice9Impl_GetScissorRect,
796 IDirect3DDevice9Impl_SetSoftwareVertexProcessing,
797 IDirect3DDevice9Impl_GetSoftwareVertexProcessing,
798 IDirect3DDevice9Impl_SetNPatchMode,
799 IDirect3DDevice9Impl_GetNPatchMode,
800 IDirect3DDevice9Impl_DrawPrimitive,
801 IDirect3DDevice9Impl_DrawIndexedPrimitive,
802 IDirect3DDevice9Impl_DrawPrimitiveUP,
803 IDirect3DDevice9Impl_DrawIndexedPrimitiveUP,
804 IDirect3DDevice9Impl_ProcessVertices,
805 IDirect3DDevice9Impl_CreateVertexDeclaration,
806 IDirect3DDevice9Impl_SetVertexDeclaration,
807 IDirect3DDevice9Impl_GetVertexDeclaration,
808 IDirect3DDevice9Impl_SetFVF,
809 IDirect3DDevice9Impl_GetFVF,
810 IDirect3DDevice9Impl_CreateVertexShader,
811 IDirect3DDevice9Impl_SetVertexShader,
812 IDirect3DDevice9Impl_GetVertexShader,
813 IDirect3DDevice9Impl_SetVertexShaderConstantF,
814 IDirect3DDevice9Impl_GetVertexShaderConstantF,
815 IDirect3DDevice9Impl_SetVertexShaderConstantI,
816 IDirect3DDevice9Impl_GetVertexShaderConstantI,
817 IDirect3DDevice9Impl_SetVertexShaderConstantB,
818 IDirect3DDevice9Impl_GetVertexShaderConstantB,
819 IDirect3DDevice9Impl_SetStreamSource,
820 IDirect3DDevice9Impl_GetStreamSource,
821 IDirect3DDevice9Impl_SetStreamSourceFreq,
822 IDirect3DDevice9Impl_GetStreamSourceFreq,
823 IDirect3DDevice9Impl_SetIndices,
824 IDirect3DDevice9Impl_GetIndices,
825 IDirect3DDevice9Impl_CreatePixelShader,
826 IDirect3DDevice9Impl_SetPixelShader,
827 IDirect3DDevice9Impl_GetPixelShader,
828 IDirect3DDevice9Impl_SetPixelShaderConstantF,
829 IDirect3DDevice9Impl_GetPixelShaderConstantF,
830 IDirect3DDevice9Impl_SetPixelShaderConstantI,
831 IDirect3DDevice9Impl_GetPixelShaderConstantI,
832 IDirect3DDevice9Impl_SetPixelShaderConstantB,
833 IDirect3DDevice9Impl_GetPixelShaderConstantB,
834 IDirect3DDevice9Impl_DrawRectPatch,
835 IDirect3DDevice9Impl_DrawTriPatch,
836 IDirect3DDevice9Impl_DeletePatch,
837 IDirect3DDevice9Impl_CreateQuery