2 * IDirect3DDevice9 implementation
4 * Copyright 2002-2005 Jason Edmeades
5 * Copyright 2002-2005 Raphael Junqueira
6 * Copyright 2005 Oliver Stieber
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "d3d9_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d9
);
29 /* IDirect3D IUnknown parts follow: */
30 static HRESULT WINAPI
IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9 iface
, REFIID riid
, LPVOID
* ppobj
) {
31 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
33 if (IsEqualGUID(riid
, &IID_IUnknown
)
34 || IsEqualGUID(riid
, &IID_IDirect3DDevice9
)) {
35 IUnknown_AddRef(iface
);
40 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
45 static ULONG WINAPI
IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9 iface
) {
46 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
47 ULONG ref
= InterlockedIncrement(&This
->ref
);
49 TRACE("(%p) : AddRef from %d\n", This
, ref
- 1);
54 static ULONG WINAPI
IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface
) {
55 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
58 if (This
->inDestruction
) return 0;
59 ref
= InterlockedDecrement(&This
->ref
);
61 TRACE("(%p) : ReleaseRef to %d\n", This
, ref
);
65 This
->inDestruction
= TRUE
;
67 for(i
= 0; i
< This
->numConvertedDecls
; i
++) {
68 /* Unless Wine is buggy or the app has a bug the refcount will be 0, because decls hold a reference to the
71 IDirect3DVertexDeclaration9Impl_Destroy(This
->convertedDecls
[i
]);
73 HeapFree(GetProcessHeap(), 0, This
->convertedDecls
);
75 IWineD3DDevice_Uninit3D(This
->WineD3DDevice
, D3D9CB_DestroyDepthStencilSurface
, D3D9CB_DestroySwapChain
);
76 IWineD3DDevice_Release(This
->WineD3DDevice
);
77 HeapFree(GetProcessHeap(), 0, This
);
82 /* IDirect3DDevice Interface follow: */
83 static HRESULT WINAPI
IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface
) {
84 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
86 TRACE("(%p) : Relay\n", This
);
87 return IWineD3DDevice_TestCooperativeLevel(This
->WineD3DDevice
);
90 static UINT WINAPI
IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface
) {
91 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
93 TRACE("(%p) Relay\n", This
);
94 return IWineD3DDevice_GetAvailableTextureMem(This
->WineD3DDevice
);
97 static HRESULT WINAPI
IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVICE9 iface
) {
98 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
100 TRACE("(%p) : Relay\n", This
);
101 return IWineD3DDevice_EvictManagedResources(This
->WineD3DDevice
);
104 HRESULT WINAPI
IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface
, IDirect3D9
** ppD3D9
) {
105 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
109 TRACE("(%p) Relay\n", This
);
111 if (NULL
== ppD3D9
) {
112 return D3DERR_INVALIDCALL
;
114 hr
= IWineD3DDevice_GetDirect3D(This
->WineD3DDevice
, &pWineD3D
);
115 if (hr
== D3D_OK
&& pWineD3D
!= NULL
)
117 IWineD3D_GetParent(pWineD3D
,(IUnknown
**)ppD3D9
);
118 IWineD3D_Release(pWineD3D
);
120 FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
123 TRACE("(%p) returning %p\n", This
, *ppD3D9
);
127 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface
, D3DCAPS9
* pCaps
) {
128 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
129 HRESULT hrc
= D3D_OK
;
130 WINED3DCAPS
*pWineCaps
;
132 TRACE("(%p) : Relay pCaps %p\n", This
, pCaps
);
134 return D3DERR_INVALIDCALL
;
136 pWineCaps
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINED3DCAPS
));
137 if(pWineCaps
== NULL
){
138 return D3DERR_INVALIDCALL
; /* well this is what MSDN says to return */
141 D3D9CAPSTOWINECAPS(pCaps
, pWineCaps
)
142 hrc
= IWineD3DDevice_GetDeviceCaps(This
->WineD3DDevice
, pWineCaps
);
143 HeapFree(GetProcessHeap(), 0, pWineCaps
);
144 TRACE("Returning %p %p\n", This
, pCaps
);
148 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DDISPLAYMODE
* pMode
) {
149 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
150 TRACE("(%p) Relay\n", This
);
151 return IWineD3DDevice_GetDisplayMode(This
->WineD3DDevice
, iSwapChain
, (WINED3DDISPLAYMODE
*) pMode
);
154 static HRESULT WINAPI
IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 iface
, D3DDEVICE_CREATION_PARAMETERS
*pParameters
) {
155 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
156 TRACE("(%p) Relay\n", This
);
157 return IWineD3DDevice_GetCreationParameters(This
->WineD3DDevice
, (WINED3DDEVICE_CREATION_PARAMETERS
*) pParameters
);
160 static HRESULT WINAPI
IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface
, UINT XHotSpot
, UINT YHotSpot
, IDirect3DSurface9
* pCursorBitmap
) {
161 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
162 IDirect3DSurface9Impl
*pSurface
= (IDirect3DSurface9Impl
*)pCursorBitmap
;
163 TRACE("(%p) Relay\n", This
);
165 WARN("No cursor bitmap, returning WINED3DERR_INVALIDCALL\n");
166 return WINED3DERR_INVALIDCALL
;
168 return IWineD3DDevice_SetCursorProperties(This
->WineD3DDevice
,XHotSpot
,YHotSpot
,(IWineD3DSurface
*)pSurface
->wineD3DSurface
);
171 static void WINAPI
IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9 iface
, int XScreenSpace
, int YScreenSpace
, DWORD Flags
) {
172 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
173 TRACE("(%p) Relay\n", This
);
174 IWineD3DDevice_SetCursorPosition(This
->WineD3DDevice
, XScreenSpace
, YScreenSpace
, Flags
);
177 static BOOL WINAPI
IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface
, BOOL bShow
) {
178 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
179 TRACE("(%p) Relay\n", This
);
181 return IWineD3DDevice_ShowCursor(This
->WineD3DDevice
, bShow
);
184 static HRESULT WINAPI
IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface
, D3DPRESENT_PARAMETERS
* pPresentationParameters
) {
185 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
186 WINED3DPRESENT_PARAMETERS localParameters
;
189 TRACE("(%p) Relay pPresentationParameters(%p)\n", This
, pPresentationParameters
);
191 localParameters
.BackBufferWidth
= pPresentationParameters
->BackBufferWidth
;
192 localParameters
.BackBufferHeight
= pPresentationParameters
->BackBufferHeight
;
193 localParameters
.BackBufferFormat
= pPresentationParameters
->BackBufferFormat
;
194 localParameters
.BackBufferCount
= pPresentationParameters
->BackBufferCount
;
195 localParameters
.MultiSampleType
= pPresentationParameters
->MultiSampleType
;
196 localParameters
.MultiSampleQuality
= pPresentationParameters
->MultiSampleQuality
;
197 localParameters
.SwapEffect
= pPresentationParameters
->SwapEffect
;
198 localParameters
.hDeviceWindow
= pPresentationParameters
->hDeviceWindow
;
199 localParameters
.Windowed
= pPresentationParameters
->Windowed
;
200 localParameters
.EnableAutoDepthStencil
= pPresentationParameters
->EnableAutoDepthStencil
;
201 localParameters
.AutoDepthStencilFormat
= pPresentationParameters
->AutoDepthStencilFormat
;
202 localParameters
.Flags
= pPresentationParameters
->Flags
;
203 localParameters
.FullScreen_RefreshRateInHz
= pPresentationParameters
->FullScreen_RefreshRateInHz
;
204 localParameters
.PresentationInterval
= pPresentationParameters
->PresentationInterval
;
206 hr
= IWineD3DDevice_Reset(This
->WineD3DDevice
, &localParameters
);
208 pPresentationParameters
->BackBufferWidth
= localParameters
.BackBufferWidth
;
209 pPresentationParameters
->BackBufferHeight
= localParameters
.BackBufferHeight
;
210 pPresentationParameters
->BackBufferFormat
= localParameters
.BackBufferFormat
;
211 pPresentationParameters
->BackBufferCount
= localParameters
.BackBufferCount
;
212 pPresentationParameters
->MultiSampleType
= localParameters
.MultiSampleType
;
213 pPresentationParameters
->MultiSampleQuality
= localParameters
.MultiSampleQuality
;
214 pPresentationParameters
->SwapEffect
= localParameters
.SwapEffect
;
215 pPresentationParameters
->hDeviceWindow
= localParameters
.hDeviceWindow
;
216 pPresentationParameters
->Windowed
= localParameters
.Windowed
;
217 pPresentationParameters
->EnableAutoDepthStencil
= localParameters
.EnableAutoDepthStencil
;
218 pPresentationParameters
->AutoDepthStencilFormat
= localParameters
.AutoDepthStencilFormat
;
219 pPresentationParameters
->Flags
= localParameters
.Flags
;
220 pPresentationParameters
->FullScreen_RefreshRateInHz
= localParameters
.FullScreen_RefreshRateInHz
;
221 pPresentationParameters
->PresentationInterval
= localParameters
.PresentationInterval
;
226 static HRESULT WINAPI
IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface
, CONST RECT
* pSourceRect
,CONST RECT
* pDestRect
,HWND hDestWindowOverride
,CONST RGNDATA
*
228 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
229 TRACE("(%p) Relay\n", This
);
230 return IWineD3DDevice_Present(This
->WineD3DDevice
, pSourceRect
, pDestRect
, hDestWindowOverride
, pDirtyRegion
);
233 static HRESULT WINAPI
IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, UINT BackBuffer
, D3DBACKBUFFER_TYPE Type
, IDirect3DSurface9
** ppBackBuffer
) {
234 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
235 IWineD3DSurface
*retSurface
= NULL
;
238 TRACE("(%p) Relay\n", This
);
240 rc
= IWineD3DDevice_GetBackBuffer(This
->WineD3DDevice
, iSwapChain
, BackBuffer
, (WINED3DBACKBUFFER_TYPE
) Type
, (IWineD3DSurface
**)&retSurface
);
241 if (rc
== D3D_OK
&& NULL
!= retSurface
&& NULL
!= ppBackBuffer
) {
242 IWineD3DSurface_GetParent(retSurface
, (IUnknown
**)ppBackBuffer
);
243 IWineD3DSurface_Release(retSurface
);
247 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DRASTER_STATUS
* pRasterStatus
) {
248 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
249 TRACE("(%p) Relay\n", This
);
251 return IWineD3DDevice_GetRasterStatus(This
->WineD3DDevice
, iSwapChain
, (WINED3DRASTER_STATUS
*) pRasterStatus
);
254 static HRESULT WINAPI
IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface
, BOOL bEnableDialogs
) {
255 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
256 TRACE("(%p) Relay\n", This
);
258 return IWineD3DDevice_SetDialogBoxMode(This
->WineD3DDevice
, bEnableDialogs
);
261 static void WINAPI
IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, DWORD Flags
, CONST D3DGAMMARAMP
* pRamp
) {
263 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
264 TRACE("(%p) Relay\n", This
);
266 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
267 IWineD3DDevice_SetGammaRamp(This
->WineD3DDevice
, iSwapChain
, Flags
, (CONST WINED3DGAMMARAMP
*)pRamp
);
270 static void WINAPI
IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DGAMMARAMP
* pRamp
) {
271 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
272 TRACE("(%p) Relay\n", This
);
274 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
275 IWineD3DDevice_GetGammaRamp(This
->WineD3DDevice
, iSwapChain
, (WINED3DGAMMARAMP
*) pRamp
);
279 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
, D3DFORMAT Format
, BOOL Lockable
, BOOL Discard
, UINT Level
, IDirect3DSurface9
**ppSurface
,D3DRESOURCETYPE Type
, UINT Usage
, D3DPOOL Pool
, D3DMULTISAMPLE_TYPE MultiSample
, DWORD MultisampleQuality
,HANDLE
* pSharedHandle
) {
281 IDirect3DSurface9Impl
*object
;
282 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
283 TRACE("(%p) Relay\n", This
);
284 if(MultisampleQuality
< 0) {
285 FIXME("MultisampleQuality out of range %d, substituting 0\n", MultisampleQuality
);
286 /*FIXME: Find out what windows does with a MultisampleQuality < 0 */
287 MultisampleQuality
=0;
290 if(MultisampleQuality
> 0){
291 FIXME("MultisampleQuality set to %d, bstituting 0\n", MultisampleQuality
);
294 [in] Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. The MultisampleQuality values of paired render targets, depth stencil surfaces, and the MultiSample type must all match.
297 MultisampleQuality
=0;
299 /*FIXME: Check MAX bounds of MultisampleQuality*/
301 /* Allocate the storage for the device */
302 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirect3DSurface9Impl
));
303 if (NULL
== object
) {
304 FIXME("Allocation of memory failed\n");
305 return D3DERR_OUTOFVIDEOMEMORY
;
308 object
->lpVtbl
= &Direct3DSurface9_Vtbl
;
311 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This
, Width
, Height
, Format
, *ppSurface
);
313 hrc
= IWineD3DDevice_CreateSurface(This
->WineD3DDevice
, Width
, Height
, Format
, Lockable
, Discard
, Level
, &object
->wineD3DSurface
, Type
, Usage
& WINED3DUSAGE_MASK
, (WINED3DPOOL
) Pool
,MultiSample
,MultisampleQuality
,pSharedHandle
,SURFACE_OPENGL
,(IUnknown
*)object
);
315 if (hrc
!= D3D_OK
|| NULL
== object
->wineD3DSurface
) {
318 FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This
);
319 HeapFree(GetProcessHeap(), 0, object
);
321 IUnknown_AddRef(iface
);
322 object
->parentDevice
= iface
;
323 TRACE("(%p) : Created surface %p\n", This
, object
);
324 *ppSurface
= (LPDIRECT3DSURFACE9
) object
;
331 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
,
332 D3DFORMAT Format
, D3DMULTISAMPLE_TYPE MultiSample
,
333 DWORD MultisampleQuality
, BOOL Lockable
,
334 IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
336 /* Is this correct? */
337 return IDirect3DDevice9Impl_CreateSurface(iface
,Width
,Height
,Format
,Lockable
,FALSE
/*Discard*/, 0/*Level*/, ppSurface
,D3DRTYPE_SURFACE
,D3DUSAGE_RENDERTARGET
,D3DPOOL_DEFAULT
,MultiSample
,MultisampleQuality
,pSharedHandle
);
342 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
,
343 D3DFORMAT Format
, D3DMULTISAMPLE_TYPE MultiSample
,
344 DWORD MultisampleQuality
, BOOL Discard
,
345 IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
347 return IDirect3DDevice9Impl_CreateSurface(iface
,Width
,Height
,Format
,TRUE
/* Lockable */,Discard
, 0/* Level */
348 ,ppSurface
,D3DRTYPE_SURFACE
,D3DUSAGE_DEPTHSTENCIL
,
349 D3DPOOL_DEFAULT
,MultiSample
,MultisampleQuality
,pSharedHandle
);
353 static HRESULT WINAPI
IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSourceSurface
, CONST RECT
* pSourceRect
, IDirect3DSurface9
* pDestinationSurface
, CONST POINT
* pDestPoint
) {
354 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
355 TRACE("(%p) Relay\n" , This
);
356 return IWineD3DDevice_UpdateSurface(This
->WineD3DDevice
, ((IDirect3DSurface9Impl
*)pSourceSurface
)->wineD3DSurface
, pSourceRect
, ((IDirect3DSurface9Impl
*)pDestinationSurface
)->wineD3DSurface
, pDestPoint
);
359 static HRESULT WINAPI
IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9 iface
, IDirect3DBaseTexture9
* pSourceTexture
, IDirect3DBaseTexture9
* pDestinationTexture
) {
360 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
361 TRACE("(%p) Relay\n" , This
);
362 return IWineD3DDevice_UpdateTexture(This
->WineD3DDevice
, ((IDirect3DBaseTexture9Impl
*)pSourceTexture
)->wineD3DBaseTexture
, ((IDirect3DBaseTexture9Impl
*)pDestinationTexture
)->wineD3DBaseTexture
);
365 /* This isn't in MSDN!
366 static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pDestSurface) {
367 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
368 FIXME("(%p) : stub\n", This);
373 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pRenderTarget
, IDirect3DSurface9
* pDestSurface
) {
374 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
375 IDirect3DSurface9Impl
*renderTarget
= (IDirect3DSurface9Impl
*)pRenderTarget
;
376 IDirect3DSurface9Impl
*destSurface
= (IDirect3DSurface9Impl
*)pDestSurface
;
377 TRACE("(%p)->(%p,%p)\n" , This
, renderTarget
, destSurface
);
378 return IWineD3DSurface_BltFast(destSurface
->wineD3DSurface
, 0, 0, renderTarget
->wineD3DSurface
, NULL
, WINEDDBLTFAST_NOCOLORKEY
);
381 static HRESULT WINAPI
IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, IDirect3DSurface9
* pDestSurface
) {
382 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
383 IDirect3DSurface9Impl
*destSurface
= (IDirect3DSurface9Impl
*)pDestSurface
;
384 TRACE("(%p) Relay\n" , This
);
385 return IWineD3DDevice_GetFrontBufferData(This
->WineD3DDevice
, iSwapChain
, destSurface
->wineD3DSurface
);
388 static HRESULT WINAPI
IDirect3DDevice9Impl_StretchRect(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSourceSurface
, CONST RECT
* pSourceRect
, IDirect3DSurface9
* pDestSurface
, CONST RECT
* pDestRect
, D3DTEXTUREFILTERTYPE Filter
) {
389 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
390 IDirect3DSurface9Impl
*src
= (IDirect3DSurface9Impl
*) pSourceSurface
;
391 IDirect3DSurface9Impl
*dst
= (IDirect3DSurface9Impl
*) pDestSurface
;
393 TRACE("(%p)->(%p,%p,%p,%p,%d)\n" , This
, src
, pSourceRect
, dst
, pDestRect
, Filter
);
394 return IWineD3DSurface_Blt(dst
->wineD3DSurface
, (RECT
*) pDestRect
, src
->wineD3DSurface
, (RECT
*) pSourceRect
, 0, NULL
, Filter
);
397 static HRESULT WINAPI
IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSurface
, CONST RECT
* pRect
, D3DCOLOR color
) {
398 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
399 IDirect3DSurface9Impl
*surface
= (IDirect3DSurface9Impl
*)pSurface
;
400 TRACE("(%p) Relay\n" , This
);
402 /* Note: D3DRECT is compatible with WINED3DRECT */
403 return IWineD3DDevice_ColorFill(This
->WineD3DDevice
, surface
->wineD3DSurface
, (CONST WINED3DRECT
*)pRect
, color
);
406 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
, D3DFORMAT Format
, D3DPOOL Pool
, IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
408 if(Pool
== D3DPOOL_MANAGED
){
409 FIXME("Attempting to create a managed offscreen plain surface\n");
410 return D3DERR_INVALIDCALL
;
412 /*MSDN: D3DPOOL_SCRATCH will return a surface that has identical characteristics to a surface created by the Microsoft DirectX 8.x method CreateImageSurface.
414 'Off-screen plain surfaces are always lockable, regardless of their pool types.'
416 D3DPOOL_DEFAULT is the appropriate pool for use with the IDirect3DDevice9::StretchRect and IDirect3DDevice9::ColorFill.
417 Why, their always lockable?
418 should I change the usage to dynamic?
420 return IDirect3DDevice9Impl_CreateSurface(iface
,Width
,Height
,Format
,TRUE
/*Loackable*/,FALSE
/*Discard*/,0/*Level*/ , ppSurface
,D3DRTYPE_SURFACE
, 0/*Usage (undefined/none)*/,(WINED3DPOOL
) Pool
,D3DMULTISAMPLE_NONE
,0/*MultisampleQuality*/,pSharedHandle
);
423 /* TODO: move to wineD3D */
424 static HRESULT WINAPI
IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9 iface
, DWORD RenderTargetIndex
, IDirect3DSurface9
* pRenderTarget
) {
425 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
426 IDirect3DSurface9Impl
*pSurface
= (IDirect3DSurface9Impl
*)pRenderTarget
;
427 TRACE("(%p) Relay\n" , This
);
428 return IWineD3DDevice_SetRenderTarget(This
->WineD3DDevice
, RenderTargetIndex
, pSurface
? (IWineD3DSurface
*)pSurface
->wineD3DSurface
: NULL
);
431 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface
, DWORD RenderTargetIndex
, IDirect3DSurface9
**ppRenderTarget
) {
432 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
434 IWineD3DSurface
*pRenderTarget
;
436 TRACE("(%p) Relay\n" , This
);
438 if (ppRenderTarget
== NULL
) {
439 return D3DERR_INVALIDCALL
;
441 hr
=IWineD3DDevice_GetRenderTarget(This
->WineD3DDevice
,RenderTargetIndex
,&pRenderTarget
);
443 if (hr
== D3D_OK
&& pRenderTarget
!= NULL
) {
444 IWineD3DSurface_GetParent(pRenderTarget
,(IUnknown
**)ppRenderTarget
);
445 IWineD3DSurface_Release(pRenderTarget
);
447 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
448 *ppRenderTarget
= NULL
;
453 static HRESULT WINAPI
IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pZStencilSurface
) {
454 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
455 IDirect3DSurface9Impl
*pSurface
;
457 TRACE("(%p) Relay\n" , This
);
459 pSurface
= (IDirect3DSurface9Impl
*)pZStencilSurface
;
460 return IWineD3DDevice_SetDepthStencilSurface(This
->WineD3DDevice
,NULL
==pSurface
?NULL
:(IWineD3DSurface
*)pSurface
->wineD3DSurface
);
463 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
**ppZStencilSurface
) {
464 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
466 IWineD3DSurface
*pZStencilSurface
;
468 TRACE("(%p) Relay\n" , This
);
469 if(ppZStencilSurface
== NULL
){
470 return D3DERR_INVALIDCALL
;
473 hr
=IWineD3DDevice_GetDepthStencilSurface(This
->WineD3DDevice
,&pZStencilSurface
);
474 if(hr
== D3D_OK
&& pZStencilSurface
!= NULL
){
475 IWineD3DSurface_GetParent(pZStencilSurface
,(IUnknown
**)ppZStencilSurface
);
476 IWineD3DSurface_Release(pZStencilSurface
);
478 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
479 *ppZStencilSurface
= NULL
;
484 static HRESULT WINAPI
IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface
) {
485 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
486 TRACE("(%p) Relay\n" , This
);
487 return IWineD3DDevice_BeginScene(This
->WineD3DDevice
);
490 static HRESULT WINAPI
IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface
) {
491 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
492 TRACE("(%p) Relay\n" , This
);
493 return IWineD3DDevice_EndScene(This
->WineD3DDevice
);
497 static HRESULT WINAPI
IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface
, DWORD Count
, CONST D3DRECT
* pRects
, DWORD Flags
, D3DCOLOR Color
, float Z
, DWORD Stencil
) {
498 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
499 TRACE("(%p) Relay\n" , This
);
501 /* Note: D3DRECT is compatible with WINED3DRECT */
502 return IWineD3DDevice_Clear(This
->WineD3DDevice
, Count
, (CONST WINED3DRECT
*) pRects
, Flags
, Color
, Z
, Stencil
);
505 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, CONST D3DMATRIX
* lpMatrix
) {
506 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
507 TRACE("(%p) Relay\n" , This
);
509 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
510 return IWineD3DDevice_SetTransform(This
->WineD3DDevice
, State
, (CONST WINED3DMATRIX
*) lpMatrix
);
513 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, D3DMATRIX
* pMatrix
) {
514 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
515 TRACE("(%p) Relay\n" , This
);
517 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
518 return IWineD3DDevice_GetTransform(This
->WineD3DDevice
, State
, (WINED3DMATRIX
*) pMatrix
);
521 static HRESULT WINAPI
IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, CONST D3DMATRIX
* pMatrix
) {
522 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
523 TRACE("(%p) Relay\n" , This
);
525 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */
526 return IWineD3DDevice_MultiplyTransform(This
->WineD3DDevice
, State
, (CONST WINED3DMATRIX
*) pMatrix
);
529 static HRESULT WINAPI
IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface
, CONST D3DVIEWPORT9
* pViewport
) {
530 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
531 TRACE("(%p) Relay\n" , This
);
533 /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */
534 return IWineD3DDevice_SetViewport(This
->WineD3DDevice
, (const WINED3DVIEWPORT
*)pViewport
);
537 static HRESULT WINAPI
IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface
, D3DVIEWPORT9
* pViewport
) {
538 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
539 TRACE("(%p) Relay\n" , This
);
541 /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */
542 return IWineD3DDevice_GetViewport(This
->WineD3DDevice
, (WINED3DVIEWPORT
*)pViewport
);
545 static HRESULT WINAPI
IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface
, CONST D3DMATERIAL9
* pMaterial
) {
546 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
547 TRACE("(%p) Relay\n" , This
);
549 /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
550 return IWineD3DDevice_SetMaterial(This
->WineD3DDevice
, (const WINED3DMATERIAL
*)pMaterial
);
553 static HRESULT WINAPI
IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface
, D3DMATERIAL9
* pMaterial
) {
554 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
555 TRACE("(%p) Relay\n" , This
);
557 /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */
558 return IWineD3DDevice_GetMaterial(This
->WineD3DDevice
, (WINED3DMATERIAL
*)pMaterial
);
561 static HRESULT WINAPI
IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9 iface
, DWORD Index
, CONST D3DLIGHT9
* pLight
) {
562 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
563 TRACE("(%p) Relay\n" , This
);
565 /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */
566 return IWineD3DDevice_SetLight(This
->WineD3DDevice
, Index
, (const WINED3DLIGHT
*)pLight
);
569 static HRESULT WINAPI
IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9 iface
, DWORD Index
, D3DLIGHT9
* pLight
) {
570 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
571 TRACE("(%p) Relay\n" , This
);
573 /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */
574 return IWineD3DDevice_GetLight(This
->WineD3DDevice
, Index
, (WINED3DLIGHT
*)pLight
);
577 static HRESULT WINAPI
IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9 iface
, DWORD Index
, BOOL Enable
) {
578 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
579 TRACE("(%p) Relay\n" , This
);
580 return IWineD3DDevice_SetLightEnable(This
->WineD3DDevice
, Index
, Enable
);
583 static HRESULT WINAPI
IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9 iface
, DWORD Index
, BOOL
* pEnable
) {
584 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
585 TRACE("(%p) Relay\n" , This
);
586 return IWineD3DDevice_GetLightEnable(This
->WineD3DDevice
, Index
, pEnable
);
589 static HRESULT WINAPI
IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9 iface
, DWORD Index
, CONST
float* pPlane
) {
590 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
591 TRACE("(%p) Relay\n" , This
);
592 return IWineD3DDevice_SetClipPlane(This
->WineD3DDevice
, Index
, pPlane
);
595 static HRESULT WINAPI
IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9 iface
, DWORD Index
, float* pPlane
) {
596 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
597 TRACE("(%p) Relay\n" , This
);
598 return IWineD3DDevice_GetClipPlane(This
->WineD3DDevice
, Index
, pPlane
);
601 static HRESULT WINAPI
IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface
, D3DRENDERSTATETYPE State
, DWORD Value
) {
602 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
603 TRACE("(%p) Relay\n" , This
);
604 return IWineD3DDevice_SetRenderState(This
->WineD3DDevice
, State
, Value
);
607 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface
, D3DRENDERSTATETYPE State
, DWORD
* pValue
) {
608 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
609 TRACE("(%p) Relay\n" , This
);
610 return IWineD3DDevice_GetRenderState(This
->WineD3DDevice
, State
, pValue
);
613 static HRESULT WINAPI
IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface
, CONST D3DCLIPSTATUS9
* pClipStatus
) {
614 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
615 TRACE("(%p) Relay\n" , This
);
616 return IWineD3DDevice_SetClipStatus(This
->WineD3DDevice
, (const WINED3DCLIPSTATUS
*)pClipStatus
);
619 static HRESULT WINAPI
IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9 iface
, D3DCLIPSTATUS9
* pClipStatus
) {
620 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
621 TRACE("(%p) Relay\n" , This
);
622 return IWineD3DDevice_GetClipStatus(This
->WineD3DDevice
, (WINED3DCLIPSTATUS
*)pClipStatus
);
625 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, IDirect3DBaseTexture9
**ppTexture
) {
626 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
627 IWineD3DBaseTexture
*retTexture
= NULL
;
630 TRACE("(%p) Relay\n" , This
);
632 if(ppTexture
== NULL
){
633 return D3DERR_INVALIDCALL
;
636 rc
= IWineD3DDevice_GetTexture(This
->WineD3DDevice
, Stage
, (IWineD3DBaseTexture
**)&retTexture
);
637 if (rc
== D3D_OK
&& NULL
!= retTexture
) {
638 IWineD3DBaseTexture_GetParent(retTexture
, (IUnknown
**)ppTexture
);
639 IWineD3DBaseTexture_Release(retTexture
);
641 FIXME("Call to get texture (%d) failed (%p)\n", Stage
, retTexture
);
647 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, IDirect3DBaseTexture9
* pTexture
) {
648 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
649 TRACE("(%p) Relay %d %p\n" , This
, Stage
, pTexture
);
650 return IWineD3DDevice_SetTexture(This
->WineD3DDevice
, Stage
,
651 pTexture
==NULL
? NULL
:((IDirect3DBaseTexture9Impl
*)pTexture
)->wineD3DBaseTexture
);
654 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, D3DTEXTURESTAGESTATETYPE Type
, DWORD
* pValue
) {
655 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
656 TRACE("(%p) Relay\n" , This
);
657 return IWineD3DDevice_GetTextureStageState(This
->WineD3DDevice
, Stage
, Type
, pValue
);
660 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, D3DTEXTURESTAGESTATETYPE Type
, DWORD Value
) {
661 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
662 TRACE("(%p) Relay\n" , This
);
663 return IWineD3DDevice_SetTextureStageState(This
->WineD3DDevice
, Stage
, Type
, Value
);
666 static HRESULT WINAPI
IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface
, DWORD Sampler
, D3DSAMPLERSTATETYPE Type
, DWORD
* pValue
) {
667 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
668 TRACE("(%p) Relay\n" , This
);
669 return IWineD3DDevice_GetSamplerState(This
->WineD3DDevice
, Sampler
, Type
, pValue
);
672 static HRESULT WINAPI
IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9 iface
, DWORD Sampler
, D3DSAMPLERSTATETYPE Type
, DWORD Value
) {
673 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
674 TRACE("(%p) Relay\n" , This
);
675 return IWineD3DDevice_SetSamplerState(This
->WineD3DDevice
, Sampler
, Type
, Value
);
678 static HRESULT WINAPI
IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9 iface
, DWORD
* pNumPasses
) {
679 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
680 TRACE("(%p) Relay\n" , This
);
681 return IWineD3DDevice_ValidateDevice(This
->WineD3DDevice
, pNumPasses
);
684 static HRESULT WINAPI
IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
, CONST PALETTEENTRY
* pEntries
) {
685 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
686 TRACE("(%p) Relay\n" , This
);
687 return IWineD3DDevice_SetPaletteEntries(This
->WineD3DDevice
, PaletteNumber
, pEntries
);
690 static HRESULT WINAPI
IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
, PALETTEENTRY
* pEntries
) {
691 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
692 TRACE("(%p) Relay\n" , This
);
693 return IWineD3DDevice_GetPaletteEntries(This
->WineD3DDevice
, PaletteNumber
, pEntries
);
696 static HRESULT WINAPI
IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
) {
697 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
698 TRACE("(%p) Relay\n" , This
);
699 return IWineD3DDevice_SetCurrentTexturePalette(This
->WineD3DDevice
, PaletteNumber
);
702 static HRESULT WINAPI
IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface
, UINT
* PaletteNumber
) {
703 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
704 TRACE("(%p) Relay\n" , This
);
705 return IWineD3DDevice_GetCurrentTexturePalette(This
->WineD3DDevice
, PaletteNumber
);
708 static HRESULT WINAPI
IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9 iface
, CONST RECT
* pRect
) {
709 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
710 TRACE("(%p) Relay\n" , This
);
711 return IWineD3DDevice_SetScissorRect(This
->WineD3DDevice
, pRect
);
714 static HRESULT WINAPI
IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9 iface
, RECT
* pRect
) {
715 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
716 TRACE("(%p) Relay\n" , This
);
717 return IWineD3DDevice_GetScissorRect(This
->WineD3DDevice
, pRect
);
720 static HRESULT WINAPI
IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface
, BOOL bSoftware
) {
721 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
722 TRACE("(%p) Relay\n" , This
);
723 return IWineD3DDevice_SetSoftwareVertexProcessing(This
->WineD3DDevice
, bSoftware
);
726 static BOOL WINAPI
IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface
) {
727 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
728 TRACE("(%p) Relay\n" , This
);
729 return IWineD3DDevice_GetSoftwareVertexProcessing(This
->WineD3DDevice
);
732 static HRESULT WINAPI
IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9 iface
, float nSegments
) {
733 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
734 TRACE("(%p) Relay\n" , This
);
735 return IWineD3DDevice_SetNPatchMode(This
->WineD3DDevice
, nSegments
);
738 static float WINAPI
IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface
) {
739 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
740 TRACE("(%p) Relay\n" , This
);
741 return IWineD3DDevice_GetNPatchMode(This
->WineD3DDevice
);
744 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT StartVertex
, UINT PrimitiveCount
) {
745 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
746 TRACE("(%p) Relay\n" , This
);
747 return IWineD3DDevice_DrawPrimitive(This
->WineD3DDevice
, PrimitiveType
, StartVertex
, PrimitiveCount
);
750 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
,
751 INT BaseVertexIndex
, UINT MinVertexIndex
, UINT NumVertices
, UINT startIndex
, UINT primCount
) {
752 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
753 TRACE("(%p) Relay\n" , This
);
755 /* D3D8 passes the baseVertexIndex in SetIndices, and due to the stateblock functions wined3d has to work that way */
756 IWineD3DDevice_SetBaseVertexIndex(This
->WineD3DDevice
, BaseVertexIndex
);
757 return IWineD3DDevice_DrawIndexedPrimitive(This
->WineD3DDevice
, PrimitiveType
, MinVertexIndex
, NumVertices
, startIndex
, primCount
);
760 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT PrimitiveCount
, CONST
void* pVertexStreamZeroData
, UINT VertexStreamZeroStride
) {
761 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
762 TRACE("(%p) Relay\n" , This
);
763 return IWineD3DDevice_DrawPrimitiveUP(This
->WineD3DDevice
, PrimitiveType
, PrimitiveCount
, pVertexStreamZeroData
, VertexStreamZeroStride
);
766 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT MinVertexIndex
,
767 UINT NumVertexIndices
, UINT PrimitiveCount
, CONST
void* pIndexData
,
768 D3DFORMAT IndexDataFormat
, CONST
void* pVertexStreamZeroData
, UINT VertexStreamZeroStride
) {
769 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
770 TRACE("(%p) Relay\n" , This
);
771 return IWineD3DDevice_DrawIndexedPrimitiveUP(This
->WineD3DDevice
, PrimitiveType
, MinVertexIndex
, NumVertexIndices
, PrimitiveCount
,
772 pIndexData
, IndexDataFormat
, pVertexStreamZeroData
, VertexStreamZeroStride
);
775 static HRESULT WINAPI
IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface
, UINT SrcStartIndex
, UINT DestIndex
, UINT VertexCount
, IDirect3DVertexBuffer9
* pDestBuffer
, IDirect3DVertexDeclaration9
* pVertexDecl
, DWORD Flags
) {
776 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
777 IDirect3DVertexDeclaration9Impl
*Decl
= (IDirect3DVertexDeclaration9Impl
*) pVertexDecl
;
778 TRACE("(%p) Relay\n" , This
);
779 return IWineD3DDevice_ProcessVertices(This
->WineD3DDevice
,SrcStartIndex
, DestIndex
, VertexCount
, ((IDirect3DVertexBuffer9Impl
*)pDestBuffer
)->wineD3DVertexBuffer
, Decl
? Decl
->wineD3DVertexDeclaration
: NULL
, Flags
);
782 IDirect3DVertexDeclaration9
*getConvertedDecl(IDirect3DDevice9Impl
*This
, DWORD fvf
) {
784 D3DVERTEXELEMENT9
* elements
= NULL
;
785 IDirect3DVertexDeclaration9
* pDecl
= NULL
;
786 int p
, low
, high
; /* deliberately signed */
787 IDirect3DVertexDeclaration9
**convertedDecls
= This
->convertedDecls
;
789 TRACE("Searching for declaration for fvf %08x... ", fvf
);
792 high
= This
->numConvertedDecls
- 1;
794 p
= (low
+ high
) >> 1;
796 if(((IDirect3DVertexDeclaration9Impl
*) convertedDecls
[p
])->convFVF
== fvf
) {
797 TRACE("found %p\n", convertedDecls
[p
]);
798 return convertedDecls
[p
];
799 } else if(((IDirect3DVertexDeclaration9Impl
*) convertedDecls
[p
])->convFVF
< fvf
) {
805 TRACE("not found. Creating and inserting at position %d.\n", low
);
807 hr
= vdecl_convert_fvf(fvf
, &elements
);
808 if (hr
!= S_OK
) return NULL
;
810 hr
= IDirect3DDevice9Impl_CreateVertexDeclaration((IDirect3DDevice9
*) This
, elements
, &pDecl
);
811 if (hr
!= S_OK
) return NULL
;
813 if(This
->declArraySize
== This
->numConvertedDecls
) {
814 int grow
= max(This
->declArraySize
/ 2, 8);
815 convertedDecls
= HeapReAlloc(GetProcessHeap(), 0, convertedDecls
,
816 sizeof(convertedDecls
[0]) * (This
->numConvertedDecls
+ grow
));
817 if(!convertedDecls
) {
818 /* This will destroy it */
819 IDirect3DVertexDeclaration9_Release(pDecl
);
822 This
->convertedDecls
= convertedDecls
;
823 This
->declArraySize
+= grow
;
826 memmove(convertedDecls
+ low
+ 1, convertedDecls
+ low
, sizeof(IDirect3DVertexDeclaration9Impl
*) * (This
->numConvertedDecls
- low
));
827 convertedDecls
[low
] = pDecl
;
828 This
->numConvertedDecls
++;
830 /* Will prevent the decl from being destroyed */
831 ((IDirect3DVertexDeclaration9Impl
*) pDecl
)->convFVF
= fvf
;
832 IDirect3DVertexDeclaration9_Release(pDecl
); /* Does not destroy now */
834 TRACE("Returning %p. %d decls in array\n", pDecl
, This
->numConvertedDecls
);
838 HRESULT WINAPI
IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface
, DWORD FVF
) {
839 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
840 TRACE("(%p) Relay\n" , This
);
844 IDirect3DVertexDeclaration9
* pDecl
= getConvertedDecl(This
, FVF
);
847 /* Any situation when this should happen, except out of memory? */
848 ERR("Failed to create a converted vertex declaration\n");
849 return D3DERR_DRIVERINTERNALERROR
;
852 hr
= IDirect3DDevice9Impl_SetVertexDeclaration(iface
, pDecl
);
853 if (hr
!= S_OK
) return hr
;
856 return IWineD3DDevice_SetFVF(This
->WineD3DDevice
, FVF
);
859 HRESULT WINAPI
IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface
, DWORD
* pFVF
) {
860 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
861 TRACE("(%p) Relay\n" , This
);
862 return IWineD3DDevice_GetFVF(This
->WineD3DDevice
, pFVF
);
865 HRESULT WINAPI
IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, IDirect3DVertexBuffer9
* pStreamData
, UINT OffsetInBytes
, UINT Stride
) {
866 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
867 TRACE("(%p) Relay\n" , This
);
868 return IWineD3DDevice_SetStreamSource(This
->WineD3DDevice
, StreamNumber
,
869 pStreamData
==NULL
? NULL
:((IDirect3DVertexBuffer9Impl
*)pStreamData
)->wineD3DVertexBuffer
,
870 OffsetInBytes
, Stride
);
873 HRESULT WINAPI
IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, IDirect3DVertexBuffer9
**pStream
, UINT
* OffsetInBytes
, UINT
* pStride
) {
874 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
875 IWineD3DVertexBuffer
*retStream
= NULL
;
878 TRACE("(%p) Relay\n" , This
);
881 return D3DERR_INVALIDCALL
;
884 rc
= IWineD3DDevice_GetStreamSource(This
->WineD3DDevice
, StreamNumber
, (IWineD3DVertexBuffer
**)&retStream
, OffsetInBytes
, pStride
);
885 if (rc
== D3D_OK
&& NULL
!= retStream
) {
886 IWineD3DVertexBuffer_GetParent(retStream
, (IUnknown
**)pStream
);
887 IWineD3DVertexBuffer_Release(retStream
);
890 FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes
, pStride
);
897 static HRESULT WINAPI
IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, UINT Divider
) {
898 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
899 TRACE("(%p) Relay\n" , This
);
900 IWineD3DDevice_SetStreamSourceFreq(This
->WineD3DDevice
, StreamNumber
, Divider
);
904 static HRESULT WINAPI
IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, UINT
* Divider
) {
905 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
906 TRACE("(%p) Relay\n" , This
);
907 return IWineD3DDevice_GetStreamSourceFreq(This
->WineD3DDevice
, StreamNumber
, Divider
);
910 static HRESULT WINAPI
IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface
, IDirect3DIndexBuffer9
* pIndexData
) {
911 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
912 TRACE("(%p) Relay\n", This
);
913 return IWineD3DDevice_SetIndices(This
->WineD3DDevice
,
914 pIndexData
? ((IDirect3DIndexBuffer9Impl
*)pIndexData
)->wineD3DIndexBuffer
: NULL
);
917 static HRESULT WINAPI
IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface
, IDirect3DIndexBuffer9
**ppIndexData
) {
918 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
919 IWineD3DIndexBuffer
*retIndexData
= NULL
;
922 TRACE("(%p) Relay\n", This
);
924 if(ppIndexData
== NULL
){
925 return D3DERR_INVALIDCALL
;
928 rc
= IWineD3DDevice_GetIndices(This
->WineD3DDevice
, &retIndexData
);
929 if (SUCCEEDED(rc
) && retIndexData
) {
930 IWineD3DIndexBuffer_GetParent(retIndexData
, (IUnknown
**)ppIndexData
);
931 IWineD3DIndexBuffer_Release(retIndexData
);
933 if (FAILED(rc
)) FIXME("Call to GetIndices failed\n");
939 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
, CONST
float* pNumSegs
, CONST D3DRECTPATCH_INFO
* pRectPatchInfo
) {
940 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
941 TRACE("(%p) Relay\n", This
);
942 return IWineD3DDevice_DrawRectPatch(This
->WineD3DDevice
, Handle
, pNumSegs
, (CONST WINED3DRECTPATCH_INFO
*)pRectPatchInfo
);
944 /*http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawTriPatch.asp*/
945 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
, CONST
float* pNumSegs
, CONST D3DTRIPATCH_INFO
* pTriPatchInfo
) {
946 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
947 TRACE("(%p) Relay\n", This
);
948 return IWineD3DDevice_DrawTriPatch(This
->WineD3DDevice
, Handle
, pNumSegs
, (CONST WINED3DTRIPATCH_INFO
*)pTriPatchInfo
);
951 static HRESULT WINAPI
IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
) {
952 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
953 TRACE("(%p) Relay\n", This
);
954 return IWineD3DDevice_DeletePatch(This
->WineD3DDevice
, Handle
);
957 const IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl
=
960 IDirect3DDevice9Impl_QueryInterface
,
961 IDirect3DDevice9Impl_AddRef
,
962 IDirect3DDevice9Impl_Release
,
963 /* IDirect3DDevice9 */
964 IDirect3DDevice9Impl_TestCooperativeLevel
,
965 IDirect3DDevice9Impl_GetAvailableTextureMem
,
966 IDirect3DDevice9Impl_EvictManagedResources
,
967 IDirect3DDevice9Impl_GetDirect3D
,
968 IDirect3DDevice9Impl_GetDeviceCaps
,
969 IDirect3DDevice9Impl_GetDisplayMode
,
970 IDirect3DDevice9Impl_GetCreationParameters
,
971 IDirect3DDevice9Impl_SetCursorProperties
,
972 IDirect3DDevice9Impl_SetCursorPosition
,
973 IDirect3DDevice9Impl_ShowCursor
,
974 IDirect3DDevice9Impl_CreateAdditionalSwapChain
,
975 IDirect3DDevice9Impl_GetSwapChain
,
976 IDirect3DDevice9Impl_GetNumberOfSwapChains
,
977 IDirect3DDevice9Impl_Reset
,
978 IDirect3DDevice9Impl_Present
,
979 IDirect3DDevice9Impl_GetBackBuffer
,
980 IDirect3DDevice9Impl_GetRasterStatus
,
981 IDirect3DDevice9Impl_SetDialogBoxMode
,
982 IDirect3DDevice9Impl_SetGammaRamp
,
983 IDirect3DDevice9Impl_GetGammaRamp
,
984 IDirect3DDevice9Impl_CreateTexture
,
985 IDirect3DDevice9Impl_CreateVolumeTexture
,
986 IDirect3DDevice9Impl_CreateCubeTexture
,
987 IDirect3DDevice9Impl_CreateVertexBuffer
,
988 IDirect3DDevice9Impl_CreateIndexBuffer
,
989 IDirect3DDevice9Impl_CreateRenderTarget
,
990 IDirect3DDevice9Impl_CreateDepthStencilSurface
,
991 IDirect3DDevice9Impl_UpdateSurface
,
992 IDirect3DDevice9Impl_UpdateTexture
,
993 IDirect3DDevice9Impl_GetRenderTargetData
,
994 IDirect3DDevice9Impl_GetFrontBufferData
,
995 IDirect3DDevice9Impl_StretchRect
,
996 IDirect3DDevice9Impl_ColorFill
,
997 IDirect3DDevice9Impl_CreateOffscreenPlainSurface
,
998 IDirect3DDevice9Impl_SetRenderTarget
,
999 IDirect3DDevice9Impl_GetRenderTarget
,
1000 IDirect3DDevice9Impl_SetDepthStencilSurface
,
1001 IDirect3DDevice9Impl_GetDepthStencilSurface
,
1002 IDirect3DDevice9Impl_BeginScene
,
1003 IDirect3DDevice9Impl_EndScene
,
1004 IDirect3DDevice9Impl_Clear
,
1005 IDirect3DDevice9Impl_SetTransform
,
1006 IDirect3DDevice9Impl_GetTransform
,
1007 IDirect3DDevice9Impl_MultiplyTransform
,
1008 IDirect3DDevice9Impl_SetViewport
,
1009 IDirect3DDevice9Impl_GetViewport
,
1010 IDirect3DDevice9Impl_SetMaterial
,
1011 IDirect3DDevice9Impl_GetMaterial
,
1012 IDirect3DDevice9Impl_SetLight
,
1013 IDirect3DDevice9Impl_GetLight
,
1014 IDirect3DDevice9Impl_LightEnable
,
1015 IDirect3DDevice9Impl_GetLightEnable
,
1016 IDirect3DDevice9Impl_SetClipPlane
,
1017 IDirect3DDevice9Impl_GetClipPlane
,
1018 IDirect3DDevice9Impl_SetRenderState
,
1019 IDirect3DDevice9Impl_GetRenderState
,
1020 IDirect3DDevice9Impl_CreateStateBlock
,
1021 IDirect3DDevice9Impl_BeginStateBlock
,
1022 IDirect3DDevice9Impl_EndStateBlock
,
1023 IDirect3DDevice9Impl_SetClipStatus
,
1024 IDirect3DDevice9Impl_GetClipStatus
,
1025 IDirect3DDevice9Impl_GetTexture
,
1026 IDirect3DDevice9Impl_SetTexture
,
1027 IDirect3DDevice9Impl_GetTextureStageState
,
1028 IDirect3DDevice9Impl_SetTextureStageState
,
1029 IDirect3DDevice9Impl_GetSamplerState
,
1030 IDirect3DDevice9Impl_SetSamplerState
,
1031 IDirect3DDevice9Impl_ValidateDevice
,
1032 IDirect3DDevice9Impl_SetPaletteEntries
,
1033 IDirect3DDevice9Impl_GetPaletteEntries
,
1034 IDirect3DDevice9Impl_SetCurrentTexturePalette
,
1035 IDirect3DDevice9Impl_GetCurrentTexturePalette
,
1036 IDirect3DDevice9Impl_SetScissorRect
,
1037 IDirect3DDevice9Impl_GetScissorRect
,
1038 IDirect3DDevice9Impl_SetSoftwareVertexProcessing
,
1039 IDirect3DDevice9Impl_GetSoftwareVertexProcessing
,
1040 IDirect3DDevice9Impl_SetNPatchMode
,
1041 IDirect3DDevice9Impl_GetNPatchMode
,
1042 IDirect3DDevice9Impl_DrawPrimitive
,
1043 IDirect3DDevice9Impl_DrawIndexedPrimitive
,
1044 IDirect3DDevice9Impl_DrawPrimitiveUP
,
1045 IDirect3DDevice9Impl_DrawIndexedPrimitiveUP
,
1046 IDirect3DDevice9Impl_ProcessVertices
,
1047 IDirect3DDevice9Impl_CreateVertexDeclaration
,
1048 IDirect3DDevice9Impl_SetVertexDeclaration
,
1049 IDirect3DDevice9Impl_GetVertexDeclaration
,
1050 IDirect3DDevice9Impl_SetFVF
,
1051 IDirect3DDevice9Impl_GetFVF
,
1052 IDirect3DDevice9Impl_CreateVertexShader
,
1053 IDirect3DDevice9Impl_SetVertexShader
,
1054 IDirect3DDevice9Impl_GetVertexShader
,
1055 IDirect3DDevice9Impl_SetVertexShaderConstantF
,
1056 IDirect3DDevice9Impl_GetVertexShaderConstantF
,
1057 IDirect3DDevice9Impl_SetVertexShaderConstantI
,
1058 IDirect3DDevice9Impl_GetVertexShaderConstantI
,
1059 IDirect3DDevice9Impl_SetVertexShaderConstantB
,
1060 IDirect3DDevice9Impl_GetVertexShaderConstantB
,
1061 IDirect3DDevice9Impl_SetStreamSource
,
1062 IDirect3DDevice9Impl_GetStreamSource
,
1063 IDirect3DDevice9Impl_SetStreamSourceFreq
,
1064 IDirect3DDevice9Impl_GetStreamSourceFreq
,
1065 IDirect3DDevice9Impl_SetIndices
,
1066 IDirect3DDevice9Impl_GetIndices
,
1067 IDirect3DDevice9Impl_CreatePixelShader
,
1068 IDirect3DDevice9Impl_SetPixelShader
,
1069 IDirect3DDevice9Impl_GetPixelShader
,
1070 IDirect3DDevice9Impl_SetPixelShaderConstantF
,
1071 IDirect3DDevice9Impl_GetPixelShaderConstantF
,
1072 IDirect3DDevice9Impl_SetPixelShaderConstantI
,
1073 IDirect3DDevice9Impl_GetPixelShaderConstantI
,
1074 IDirect3DDevice9Impl_SetPixelShaderConstantB
,
1075 IDirect3DDevice9Impl_GetPixelShaderConstantB
,
1076 IDirect3DDevice9Impl_DrawRectPatch
,
1077 IDirect3DDevice9Impl_DrawTriPatch
,
1078 IDirect3DDevice9Impl_DeletePatch
,
1079 IDirect3DDevice9Impl_CreateQuery
1083 /* Internal function called back during the CreateDevice to create a render target */
1084 HRESULT WINAPI
D3D9CB_CreateSurface(IUnknown
*device
, IUnknown
*pSuperior
, UINT Width
, UINT Height
,
1085 WINED3DFORMAT Format
, DWORD Usage
, WINED3DPOOL Pool
, UINT Level
,
1086 WINED3DCUBEMAP_FACES Face
,IWineD3DSurface
** ppSurface
,
1087 HANDLE
* pSharedHandle
) {
1089 HRESULT res
= D3D_OK
;
1090 IDirect3DSurface9Impl
*d3dSurface
= NULL
;
1091 BOOL Lockable
= TRUE
;
1093 if((Pool
== D3DPOOL_DEFAULT
&& Usage
!= D3DUSAGE_DYNAMIC
))
1097 res
= IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9
*)device
, Width
, Height
, (D3DFORMAT
)Format
,
1098 Lockable
, FALSE
/*Discard*/, Level
, (IDirect3DSurface9
**)&d3dSurface
, D3DRTYPE_SURFACE
,
1099 Usage
, (D3DPOOL
) Pool
, D3DMULTISAMPLE_NONE
, 0 /* MultisampleQuality */, pSharedHandle
);
1101 if (SUCCEEDED(res
)) {
1102 *ppSurface
= d3dSurface
->wineD3DSurface
;
1103 d3dSurface
->container
= pSuperior
;
1104 IUnknown_Release(d3dSurface
->parentDevice
);
1105 d3dSurface
->parentDevice
= NULL
;
1106 d3dSurface
->forwardReference
= pSuperior
;
1108 FIXME("(%p) IDirect3DDevice9_CreateSurface failed\n", device
);
1113 ULONG WINAPI
D3D9CB_DestroySurface(IWineD3DSurface
*pSurface
) {
1114 IDirect3DSurface9Impl
* surfaceParent
;
1115 TRACE("(%p) call back\n", pSurface
);
1117 IWineD3DSurface_GetParent(pSurface
, (IUnknown
**) &surfaceParent
);
1118 /* GetParent's AddRef was forwarded to an object in destruction.
1119 * Releasing it here again would cause an endless recursion. */
1120 surfaceParent
->forwardReference
= NULL
;
1121 return IDirect3DSurface9_Release((IDirect3DSurface9
*) surfaceParent
);