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 %ld\n", This
, ref
- 1);
54 static ULONG WINAPI
IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface
) {
55 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
56 ULONG ref
= InterlockedDecrement(&This
->ref
);
58 TRACE("(%p) : ReleaseRef to %ld\n", This
, ref
);
61 IWineD3DDevice_Uninit3D(This
->WineD3DDevice
);
62 IWineD3DDevice_Release(This
->WineD3DDevice
);
63 HeapFree(GetProcessHeap(), 0, This
);
68 /* IDirect3DDevice Interface follow: */
69 static HRESULT WINAPI
IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface
) {
70 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
72 TRACE("(%p) : Relay\n", This
);
73 return IWineD3DDevice_TestCooperativeLevel(This
->WineD3DDevice
);
76 static UINT WINAPI
IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface
) {
77 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
79 TRACE("(%p) Relay\n", This
);
80 return IWineD3DDevice_GetAvailableTextureMem(This
->WineD3DDevice
);
83 static HRESULT WINAPI
IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVICE9 iface
) {
84 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
86 TRACE("(%p) : Relay\n", This
);
87 return IWineD3DDevice_EvictManagedResources(This
->WineD3DDevice
);
90 HRESULT WINAPI
IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface
, IDirect3D9
** ppD3D9
) {
91 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
95 TRACE("(%p) Relay\n", This
);
98 return D3DERR_INVALIDCALL
;
100 hr
= IWineD3DDevice_GetDirect3D(This
->WineD3DDevice
, &pWineD3D
);
101 if (hr
== D3D_OK
&& pWineD3D
!= NULL
)
103 IWineD3DResource_GetParent((IWineD3DResource
*)pWineD3D
,(IUnknown
**)ppD3D9
);
104 IWineD3DResource_Release((IWineD3DResource
*)pWineD3D
);
106 FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
109 TRACE("(%p) returning %p\n", This
, *ppD3D9
);
113 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface
, D3DCAPS9
* pCaps
) {
114 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
115 HRESULT hrc
= D3D_OK
;
116 WINED3DCAPS
*pWineCaps
;
118 TRACE("(%p) : Relay pCaps %p\n", This
, pCaps
);
120 return D3DERR_INVALIDCALL
;
122 pWineCaps
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINED3DCAPS
));
123 if(pWineCaps
== NULL
){
124 return D3DERR_INVALIDCALL
; /* well this is what MSDN says to return */
127 D3D9CAPSTOWINECAPS(pCaps
, pWineCaps
)
128 hrc
= IWineD3DDevice_GetDeviceCaps(This
->WineD3DDevice
, pWineCaps
);
129 HeapFree(GetProcessHeap(), 0, pWineCaps
);
130 TRACE("Returning %p %p\n", This
, pCaps
);
134 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DDISPLAYMODE
* pMode
) {
135 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
136 TRACE("(%p) Relay\n", This
);
137 return IWineD3DDevice_GetDisplayMode(This
->WineD3DDevice
, iSwapChain
, (WINED3DDISPLAYMODE
*) pMode
);
140 static HRESULT WINAPI
IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 iface
, D3DDEVICE_CREATION_PARAMETERS
*pParameters
) {
141 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
142 TRACE("(%p) Relay\n", This
);
143 return IWineD3DDevice_GetCreationParameters(This
->WineD3DDevice
, (WINED3DDEVICE_CREATION_PARAMETERS
*) pParameters
);
146 static HRESULT WINAPI
IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface
, UINT XHotSpot
, UINT YHotSpot
, IDirect3DSurface9
* pCursorBitmap
) {
147 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
148 IDirect3DSurface9Impl
*pSurface
= (IDirect3DSurface9Impl
*)pCursorBitmap
;
149 TRACE("(%p) Relay\n", This
);
150 return IWineD3DDevice_SetCursorProperties(This
->WineD3DDevice
,XHotSpot
,YHotSpot
,(IWineD3DSurface
*)pSurface
->wineD3DSurface
);
153 static void WINAPI
IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9 iface
, int XScreenSpace
, int YScreenSpace
, DWORD Flags
) {
154 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
155 TRACE("(%p) Relay\n", This
);
156 return IWineD3DDevice_SetCursorPosition(This
->WineD3DDevice
, XScreenSpace
, YScreenSpace
, Flags
);
159 static BOOL WINAPI
IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface
, BOOL bShow
) {
160 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
161 TRACE("(%p) Relay\n", This
);
163 return IWineD3DDevice_ShowCursor(This
->WineD3DDevice
, bShow
);
166 static HRESULT WINAPI
IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface
, D3DPRESENT_PARAMETERS
* pPresentationParameters
) {
167 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
168 WINED3DPRESENT_PARAMETERS localParameters
;
169 TRACE("(%p) Relay pPresentationParameters(%p)\n", This
, pPresentationParameters
);
171 localParameters
.BackBufferWidth
= &pPresentationParameters
->BackBufferWidth
;
172 localParameters
.BackBufferHeight
= &pPresentationParameters
->BackBufferHeight
;
173 localParameters
.BackBufferFormat
= (WINED3DFORMAT
*)&pPresentationParameters
->BackBufferFormat
;
174 localParameters
.BackBufferCount
= &pPresentationParameters
->BackBufferCount
;
175 localParameters
.MultiSampleType
= (WINED3DMULTISAMPLE_TYPE
*) &pPresentationParameters
->MultiSampleType
;
176 localParameters
.MultiSampleQuality
= &pPresentationParameters
->MultiSampleQuality
;
177 localParameters
.SwapEffect
= (WINED3DSWAPEFFECT
*) &pPresentationParameters
->SwapEffect
;
178 localParameters
.hDeviceWindow
= &pPresentationParameters
->hDeviceWindow
;
179 localParameters
.Windowed
= &pPresentationParameters
->Windowed
;
180 localParameters
.EnableAutoDepthStencil
= &pPresentationParameters
->EnableAutoDepthStencil
;
181 localParameters
.AutoDepthStencilFormat
= (WINED3DFORMAT
*)&pPresentationParameters
->AutoDepthStencilFormat
;
182 localParameters
.Flags
= &pPresentationParameters
->Flags
;
183 localParameters
.FullScreen_RefreshRateInHz
= &pPresentationParameters
->FullScreen_RefreshRateInHz
;
184 localParameters
.PresentationInterval
= &pPresentationParameters
->PresentationInterval
;
185 return IWineD3DDevice_Reset(This
->WineD3DDevice
, &localParameters
);
188 static HRESULT WINAPI
IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface
, CONST RECT
* pSourceRect
,CONST RECT
* pDestRect
,HWND hDestWindowOverride
,CONST RGNDATA
*
190 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
191 TRACE("(%p) Relay\n", This
);
192 return IWineD3DDevice_Present(This
->WineD3DDevice
, pSourceRect
, pDestRect
, hDestWindowOverride
, pDirtyRegion
);
195 static HRESULT WINAPI
IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, UINT BackBuffer
, D3DBACKBUFFER_TYPE Type
, IDirect3DSurface9
** ppBackBuffer
) {
196 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
197 IWineD3DSurface
*retSurface
= NULL
;
200 TRACE("(%p) Relay\n", This
);
202 rc
= IWineD3DDevice_GetBackBuffer(This
->WineD3DDevice
, iSwapChain
, BackBuffer
, (WINED3DBACKBUFFER_TYPE
) Type
, (IWineD3DSurface
**)&retSurface
);
203 if (rc
== D3D_OK
&& NULL
!= retSurface
&& NULL
!= ppBackBuffer
) {
204 IWineD3DSurface_GetParent(retSurface
, (IUnknown
**)ppBackBuffer
);
205 IWineD3DSurface_Release(retSurface
);
209 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DRASTER_STATUS
* pRasterStatus
) {
210 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
211 TRACE("(%p) Relay\n", This
);
213 return IWineD3DDevice_GetRasterStatus(This
->WineD3DDevice
, iSwapChain
, (WINED3DRASTER_STATUS
*) pRasterStatus
);
216 static HRESULT WINAPI
IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface
, BOOL bEnableDialogs
) {
217 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
218 TRACE("(%p) Relay\n", This
);
220 return IWineD3DDevice_SetDialogBoxMode(This
->WineD3DDevice
, bEnableDialogs
);
223 static void WINAPI
IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, DWORD Flags
, CONST D3DGAMMARAMP
* pRamp
) {
225 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
226 TRACE("(%p) Relay\n", This
);
228 return IWineD3DDevice_SetGammaRamp(This
->WineD3DDevice
, iSwapChain
, Flags
, (WINED3DGAMMARAMP
*) pRamp
);
231 static void WINAPI
IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, D3DGAMMARAMP
* pRamp
) {
232 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
233 TRACE("(%p) Relay\n", This
);
235 return IWineD3DDevice_GetGammaRamp(This
->WineD3DDevice
, iSwapChain
, (WINED3DGAMMARAMP
*) pRamp
);
239 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
) {
241 IDirect3DSurface9Impl
*object
;
242 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
243 TRACE("(%p) Relay\n", This
);
244 if(MultisampleQuality
< 0) {
245 FIXME("MultisampleQuality out of range %ld, substituting 0\n", MultisampleQuality
);
246 /*FIXME: Find out what windows does with a MultisampleQuality < 0 */
247 MultisampleQuality
=0;
250 if(MultisampleQuality
> 0){
251 FIXME("MultisampleQuality set to %ld, bstituting 0\n", MultisampleQuality
);
254 [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.
257 MultisampleQuality
=0;
259 /*FIXME: Check MAX bounds of MultisampleQuality*/
261 /* Allocate the storage for the device */
262 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirect3DSurface9Impl
));
263 if (NULL
== object
) {
264 FIXME("Allocation of memory failed\n");
265 return D3DERR_OUTOFVIDEOMEMORY
;
268 object
->lpVtbl
= &Direct3DSurface9_Vtbl
;
271 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This
, Width
, Height
, Format
, *ppSurface
);
273 hrc
= IWineD3DDevice_CreateSurface(This
->WineD3DDevice
, Width
, Height
, Format
, Lockable
, Discard
, Level
, &object
->wineD3DSurface
, Type
, Usage
, (WINED3DPOOL
) Pool
,MultiSample
,MultisampleQuality
,pSharedHandle
,SURFACE_OPENGL
,(IUnknown
*)object
);
275 if (hrc
!= D3D_OK
|| NULL
== object
->wineD3DSurface
) {
278 FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This
);
279 HeapFree(GetProcessHeap(), 0, object
);
281 IUnknown_AddRef(iface
);
282 object
->parentDevice
= iface
;
283 TRACE("(%p) : Created surface %p\n", This
, object
);
284 *ppSurface
= (LPDIRECT3DSURFACE9
) object
;
291 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
,
292 D3DFORMAT Format
, D3DMULTISAMPLE_TYPE MultiSample
,
293 DWORD MultisampleQuality
, BOOL Lockable
,
294 IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
296 /* Is this correct? */
297 return IDirect3DDevice9Impl_CreateSurface(iface
,Width
,Height
,Format
,Lockable
,FALSE
/*Discard*/, 0/*Level*/, ppSurface
,D3DRTYPE_SURFACE
,D3DUSAGE_RENDERTARGET
,D3DPOOL_DEFAULT
,MultiSample
,MultisampleQuality
,pSharedHandle
);
302 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
,
303 D3DFORMAT Format
, D3DMULTISAMPLE_TYPE MultiSample
,
304 DWORD MultisampleQuality
, BOOL Discard
,
305 IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
307 return IDirect3DDevice9Impl_CreateSurface(iface
,Width
,Height
,Format
,TRUE
/* Lockable */,Discard
, 0/* Level */
308 ,ppSurface
,D3DRTYPE_SURFACE
,D3DUSAGE_DEPTHSTENCIL
,
309 D3DPOOL_DEFAULT
,MultiSample
,MultisampleQuality
,pSharedHandle
);
313 static HRESULT WINAPI
IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSourceSurface
, CONST RECT
* pSourceRect
, IDirect3DSurface9
* pDestinationSurface
, CONST POINT
* pDestPoint
) {
314 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
315 TRACE("(%p) Relay\n" , This
);
316 return IWineD3DDevice_UpdateSurface(This
->WineD3DDevice
, ((IDirect3DSurface9Impl
*)pSourceSurface
)->wineD3DSurface
, pSourceRect
, ((IDirect3DSurface9Impl
*)pDestinationSurface
)->wineD3DSurface
, pDestPoint
);
319 static HRESULT WINAPI
IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9 iface
, IDirect3DBaseTexture9
* pSourceTexture
, IDirect3DBaseTexture9
* pDestinationTexture
) {
320 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
321 TRACE("(%p) Relay\n" , This
);
322 return IWineD3DDevice_UpdateTexture(This
->WineD3DDevice
, ((IDirect3DBaseTexture9Impl
*)pSourceTexture
)->wineD3DBaseTexture
, ((IDirect3DBaseTexture9Impl
*)pDestinationTexture
)->wineD3DBaseTexture
);
325 /* This isn't in MSDN!
326 static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pDestSurface) {
327 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
328 FIXME("(%p) : stub\n", This);
333 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pRenderTarget
, IDirect3DSurface9
* pDestSurface
) {
334 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
335 IDirect3DSurface9Impl
*renderTarget
= (IDirect3DSurface9Impl
*)pRenderTarget
;
336 IDirect3DSurface9Impl
*destSurface
= (IDirect3DSurface9Impl
*)pDestSurface
;
337 TRACE("(%p) Relay\n" , This
);
338 return IWineD3DDevice_GetRenderTargetData(This
->WineD3DDevice
, renderTarget
->wineD3DSurface
, destSurface
->wineD3DSurface
);
341 static HRESULT WINAPI
IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface
, UINT iSwapChain
, IDirect3DSurface9
* pDestSurface
) {
342 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
343 IDirect3DSurface9Impl
*destSurface
= (IDirect3DSurface9Impl
*)pDestSurface
;
344 TRACE("(%p) Relay\n" , This
);
345 return IWineD3DDevice_GetFrontBufferData(This
->WineD3DDevice
, iSwapChain
, destSurface
->wineD3DSurface
);
348 static HRESULT WINAPI
IDirect3DDevice9Impl_StretchRect(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSourceSurface
, CONST RECT
* pSourceRect
, IDirect3DSurface9
* pDestSurface
, CONST RECT
* pDestRect
, D3DTEXTUREFILTERTYPE Filter
) {
349 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
350 TRACE("(%p) Relay\n" , This
);
351 return IWineD3DDevice_StretchRect(This
->WineD3DDevice
, ((IDirect3DSurface9Impl
*)pSourceSurface
)->wineD3DSurface
, pSourceRect
, ((IDirect3DSurface9Impl
*)pDestSurface
)->wineD3DSurface
, pDestRect
, (WINED3DTEXTUREFILTERTYPE
) Filter
);
354 static HRESULT WINAPI
IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pSurface
, CONST RECT
* pRect
, D3DCOLOR color
) {
355 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
356 IDirect3DSurface9Impl
*surface
= (IDirect3DSurface9Impl
*)pSurface
;
357 TRACE("(%p) Relay\n" , This
);
358 return IWineD3DDevice_ColorFill(This
->WineD3DDevice
, surface
->wineD3DSurface
, (CONST D3DRECT
*)pRect
, color
);
361 static HRESULT WINAPI
IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface
, UINT Width
, UINT Height
, D3DFORMAT Format
, D3DPOOL Pool
, IDirect3DSurface9
**ppSurface
, HANDLE
* pSharedHandle
) {
363 if(Pool
== D3DPOOL_MANAGED
){
364 FIXME("Attempting to create a managed offscreen plain surface\n");
365 return D3DERR_INVALIDCALL
;
367 /*MSDN: D3DPOOL_SCRATCH will return a surface that has identical characteristics to a surface created by the Microsoft DirectX 8.x method CreateImageSurface.
369 'Off-screen plain surfaces are always lockable, regardless of their pool types.'
371 D3DPOOL_DEFAULT is the appropriate pool for use with the IDirect3DDevice9::StretchRect and IDirect3DDevice9::ColorFill.
372 Why, their always lockable?
373 should I change the usage to dynamic?
375 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
);
378 /* TODO: move to wineD3D */
379 static HRESULT WINAPI
IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9 iface
, DWORD RenderTargetIndex
, IDirect3DSurface9
* pRenderTarget
) {
380 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
381 IDirect3DSurface9Impl
*pSurface
= (IDirect3DSurface9Impl
*)pRenderTarget
;
382 TRACE("(%p) Relay\n" , This
);
383 return IWineD3DDevice_SetRenderTarget(This
->WineD3DDevice
,RenderTargetIndex
,(IWineD3DSurface
*)pSurface
->wineD3DSurface
);
386 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface
, DWORD RenderTargetIndex
, IDirect3DSurface9
**ppRenderTarget
) {
387 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
389 IWineD3DSurface
*pRenderTarget
;
391 TRACE("(%p) Relay\n" , This
);
393 if (ppRenderTarget
== NULL
) {
394 return D3DERR_INVALIDCALL
;
396 hr
=IWineD3DDevice_GetRenderTarget(This
->WineD3DDevice
,RenderTargetIndex
,&pRenderTarget
);
398 if (hr
== D3D_OK
&& pRenderTarget
!= NULL
) {
399 IWineD3DResource_GetParent((IWineD3DResource
*)pRenderTarget
,(IUnknown
**)ppRenderTarget
);
400 IWineD3DResource_Release((IWineD3DResource
*)pRenderTarget
);
402 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
403 *ppRenderTarget
= NULL
;
408 static HRESULT WINAPI
IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
* pZStencilSurface
) {
409 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
410 IDirect3DSurface9Impl
*pSurface
;
412 TRACE("(%p) Relay\n" , This
);
414 pSurface
= (IDirect3DSurface9Impl
*)pZStencilSurface
;
415 return IWineD3DDevice_SetDepthStencilSurface(This
->WineD3DDevice
,NULL
==pSurface
?NULL
:(IWineD3DSurface
*)pSurface
->wineD3DSurface
);
418 static HRESULT WINAPI
IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9 iface
, IDirect3DSurface9
**ppZStencilSurface
) {
419 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
421 IWineD3DSurface
*pZStencilSurface
;
423 TRACE("(%p) Relay\n" , This
);
424 if(ppZStencilSurface
== NULL
){
425 return D3DERR_INVALIDCALL
;
428 hr
=IWineD3DDevice_GetDepthStencilSurface(This
->WineD3DDevice
,&pZStencilSurface
);
429 if(hr
== D3D_OK
&& pZStencilSurface
!= NULL
){
430 IWineD3DResource_GetParent((IWineD3DResource
*)pZStencilSurface
,(IUnknown
**)ppZStencilSurface
);
431 IWineD3DResource_Release((IWineD3DResource
*)pZStencilSurface
);
433 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
434 *ppZStencilSurface
= NULL
;
439 static HRESULT WINAPI
IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface
) {
440 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
441 TRACE("(%p) Relay\n" , This
);
442 return IWineD3DDevice_BeginScene(This
->WineD3DDevice
);
445 static HRESULT WINAPI
IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface
) {
446 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
447 TRACE("(%p) Relay\n" , This
);
448 return IWineD3DDevice_EndScene(This
->WineD3DDevice
);
452 static HRESULT WINAPI
IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface
, DWORD Count
, CONST D3DRECT
* pRects
, DWORD Flags
, D3DCOLOR Color
, float Z
, DWORD Stencil
) {
453 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
454 TRACE("(%p) Relay\n" , This
);
455 return IWineD3DDevice_Clear(This
->WineD3DDevice
, Count
, pRects
, Flags
, Color
, Z
, Stencil
);
458 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, CONST D3DMATRIX
* lpMatrix
) {
459 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
460 TRACE("(%p) Relay\n" , This
);
461 return IWineD3DDevice_SetTransform(This
->WineD3DDevice
, State
, lpMatrix
);
464 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, D3DMATRIX
* pMatrix
) {
465 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
466 TRACE("(%p) Relay\n" , This
);
467 return IWineD3DDevice_GetTransform(This
->WineD3DDevice
, State
, pMatrix
);
470 static HRESULT WINAPI
IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface
, D3DTRANSFORMSTATETYPE State
, CONST D3DMATRIX
* pMatrix
) {
471 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
472 TRACE("(%p) Relay\n" , This
);
473 return IWineD3DDevice_MultiplyTransform(This
->WineD3DDevice
, State
, pMatrix
);
476 static HRESULT WINAPI
IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface
, CONST D3DVIEWPORT9
* pViewport
) {
477 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
478 TRACE("(%p) Relay\n" , This
);
479 return IWineD3DDevice_SetViewport(This
->WineD3DDevice
, (const WINED3DVIEWPORT
*)pViewport
);
482 static HRESULT WINAPI
IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface
, D3DVIEWPORT9
* pViewport
) {
483 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
484 TRACE("(%p) Relay\n" , This
);
485 return IWineD3DDevice_GetViewport(This
->WineD3DDevice
, (WINED3DVIEWPORT
*)pViewport
);
488 static HRESULT WINAPI
IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface
, CONST D3DMATERIAL9
* pMaterial
) {
489 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
490 TRACE("(%p) Relay\n" , This
);
491 return IWineD3DDevice_SetMaterial(This
->WineD3DDevice
, (const WINED3DMATERIAL
*)pMaterial
);
494 static HRESULT WINAPI
IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface
, D3DMATERIAL9
* pMaterial
) {
495 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
496 TRACE("(%p) Relay\n" , This
);
497 return IWineD3DDevice_GetMaterial(This
->WineD3DDevice
, (WINED3DMATERIAL
*)pMaterial
);
500 static HRESULT WINAPI
IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9 iface
, DWORD Index
, CONST D3DLIGHT9
* pLight
) {
501 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
502 TRACE("(%p) Relay\n" , This
);
503 return IWineD3DDevice_SetLight(This
->WineD3DDevice
, Index
, (const WINED3DLIGHT
*)pLight
);
506 static HRESULT WINAPI
IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9 iface
, DWORD Index
, D3DLIGHT9
* pLight
) {
507 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
508 TRACE("(%p) Relay\n" , This
);
509 return IWineD3DDevice_GetLight(This
->WineD3DDevice
, Index
, (WINED3DLIGHT
*)pLight
);
512 static HRESULT WINAPI
IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9 iface
, DWORD Index
, BOOL Enable
) {
513 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
514 TRACE("(%p) Relay\n" , This
);
515 return IWineD3DDevice_SetLightEnable(This
->WineD3DDevice
, Index
, Enable
);
518 static HRESULT WINAPI
IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9 iface
, DWORD Index
, BOOL
* pEnable
) {
519 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
520 TRACE("(%p) Relay\n" , This
);
521 return IWineD3DDevice_GetLightEnable(This
->WineD3DDevice
, Index
, pEnable
);
524 static HRESULT WINAPI
IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9 iface
, DWORD Index
, CONST
float* pPlane
) {
525 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
526 TRACE("(%p) Relay\n" , This
);
527 return IWineD3DDevice_SetClipPlane(This
->WineD3DDevice
, Index
, pPlane
);
530 static HRESULT WINAPI
IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9 iface
, DWORD Index
, float* pPlane
) {
531 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
532 TRACE("(%p) Relay\n" , This
);
533 return IWineD3DDevice_GetClipPlane(This
->WineD3DDevice
, Index
, pPlane
);
536 static HRESULT WINAPI
IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface
, D3DRENDERSTATETYPE State
, DWORD Value
) {
537 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
538 TRACE("(%p) Relay\n" , This
);
539 return IWineD3DDevice_SetRenderState(This
->WineD3DDevice
, State
, Value
);
542 static HRESULT WINAPI
IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface
, D3DRENDERSTATETYPE State
, DWORD
* pValue
) {
543 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
544 TRACE("(%p) Relay\n" , This
);
545 return IWineD3DDevice_GetRenderState(This
->WineD3DDevice
, State
, pValue
);
548 static HRESULT WINAPI
IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface
, CONST D3DCLIPSTATUS9
* pClipStatus
) {
549 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
550 TRACE("(%p) Relay\n" , This
);
551 return IWineD3DDevice_SetClipStatus(This
->WineD3DDevice
, (const WINED3DCLIPSTATUS
*)pClipStatus
);
554 static HRESULT WINAPI
IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9 iface
, D3DCLIPSTATUS9
* pClipStatus
) {
555 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
556 TRACE("(%p) Relay\n" , This
);
557 return IWineD3DDevice_GetClipStatus(This
->WineD3DDevice
, (WINED3DCLIPSTATUS
*)pClipStatus
);
560 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, IDirect3DBaseTexture9
**ppTexture
) {
561 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
562 IWineD3DBaseTexture
*retTexture
= NULL
;
565 TRACE("(%p) Relay\n" , This
);
567 if(ppTexture
== NULL
){
568 return D3DERR_INVALIDCALL
;
571 rc
= IWineD3DDevice_GetTexture(This
->WineD3DDevice
, Stage
, (IWineD3DBaseTexture
**)&retTexture
);
572 if (rc
== D3D_OK
&& NULL
!= retTexture
) {
573 IWineD3DBaseTexture_GetParent(retTexture
, (IUnknown
**)ppTexture
);
574 IWineD3DBaseTexture_Release(retTexture
);
576 FIXME("Call to get texture (%ld) failed (%p)\n", Stage
, retTexture
);
582 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, IDirect3DBaseTexture9
* pTexture
) {
583 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
584 TRACE("(%p) Relay %ld %p\n" , This
, Stage
, pTexture
);
585 return IWineD3DDevice_SetTexture(This
->WineD3DDevice
, Stage
,
586 pTexture
==NULL
? NULL
:((IDirect3DBaseTexture9Impl
*)pTexture
)->wineD3DBaseTexture
);
589 static HRESULT WINAPI
IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, D3DTEXTURESTAGESTATETYPE Type
, DWORD
* pValue
) {
590 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
591 TRACE("(%p) Relay\n" , This
);
592 return IWineD3DDevice_GetTextureStageState(This
->WineD3DDevice
, Stage
, Type
, pValue
);
595 static HRESULT WINAPI
IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface
, DWORD Stage
, D3DTEXTURESTAGESTATETYPE Type
, DWORD Value
) {
596 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
597 TRACE("(%p) Relay\n" , This
);
598 return IWineD3DDevice_SetTextureStageState(This
->WineD3DDevice
, Stage
, Type
, Value
);
601 static HRESULT WINAPI
IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface
, DWORD Sampler
, D3DSAMPLERSTATETYPE Type
, DWORD
* pValue
) {
602 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
603 TRACE("(%p) Relay\n" , This
);
604 return IWineD3DDevice_GetSamplerState(This
->WineD3DDevice
, Sampler
, Type
, pValue
);
607 static HRESULT WINAPI
IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9 iface
, DWORD Sampler
, D3DSAMPLERSTATETYPE Type
, DWORD Value
) {
608 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
609 TRACE("(%p) Relay\n" , This
);
610 return IWineD3DDevice_SetSamplerState(This
->WineD3DDevice
, Sampler
, Type
, Value
);
613 static HRESULT WINAPI
IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9 iface
, DWORD
* pNumPasses
) {
614 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
615 TRACE("(%p) Relay\n" , This
);
616 return IWineD3DDevice_ValidateDevice(This
->WineD3DDevice
, pNumPasses
);
619 static HRESULT WINAPI
IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
, CONST PALETTEENTRY
* pEntries
) {
620 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
621 TRACE("(%p) Relay\n" , This
);
622 return IWineD3DDevice_SetPaletteEntries(This
->WineD3DDevice
, PaletteNumber
, pEntries
);
625 static HRESULT WINAPI
IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
, PALETTEENTRY
* pEntries
) {
626 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
627 TRACE("(%p) Relay\n" , This
);
628 return IWineD3DDevice_GetPaletteEntries(This
->WineD3DDevice
, PaletteNumber
, pEntries
);
631 static HRESULT WINAPI
IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface
, UINT PaletteNumber
) {
632 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
633 TRACE("(%p) Relay\n" , This
);
634 return IWineD3DDevice_SetCurrentTexturePalette(This
->WineD3DDevice
, PaletteNumber
);
637 static HRESULT WINAPI
IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface
, UINT
* PaletteNumber
) {
638 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
639 TRACE("(%p) Relay\n" , This
);
640 return IWineD3DDevice_GetCurrentTexturePalette(This
->WineD3DDevice
, PaletteNumber
);
643 static HRESULT WINAPI
IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9 iface
, CONST RECT
* pRect
) {
644 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
645 TRACE("(%p) Relay\n" , This
);
646 return IWineD3DDevice_SetScissorRect(This
->WineD3DDevice
, pRect
);
649 static HRESULT WINAPI
IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9 iface
, RECT
* pRect
) {
650 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
651 TRACE("(%p) Relay\n" , This
);
652 return IWineD3DDevice_GetScissorRect(This
->WineD3DDevice
, pRect
);
655 static HRESULT WINAPI
IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface
, BOOL bSoftware
) {
656 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
657 TRACE("(%p) Relay\n" , This
);
658 return IWineD3DDevice_SetSoftwareVertexProcessing(This
->WineD3DDevice
, bSoftware
);
661 static BOOL WINAPI
IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface
) {
662 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
663 TRACE("(%p) Relay\n" , This
);
664 return IWineD3DDevice_GetSoftwareVertexProcessing(This
->WineD3DDevice
);
667 static HRESULT WINAPI
IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9 iface
, float nSegments
) {
668 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
669 TRACE("(%p) Relay\n" , This
);
670 return IWineD3DDevice_SetNPatchMode(This
->WineD3DDevice
, nSegments
);
673 static float WINAPI
IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface
) {
674 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
675 TRACE("(%p) Relay\n" , This
);
676 return IWineD3DDevice_GetNPatchMode(This
->WineD3DDevice
);
679 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT StartVertex
, UINT PrimitiveCount
) {
680 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
681 TRACE("(%p) Relay\n" , This
);
682 return IWineD3DDevice_DrawPrimitive(This
->WineD3DDevice
, PrimitiveType
, StartVertex
, PrimitiveCount
);
685 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
,
686 INT BaseVertexIndex
, UINT MinVertexIndex
, UINT NumVertices
, UINT startIndex
, UINT primCount
) {
687 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
688 TRACE("(%p) Relay\n" , This
);
689 return IWineD3DDevice_DrawIndexedPrimitive(This
->WineD3DDevice
, PrimitiveType
, BaseVertexIndex
, MinVertexIndex
, NumVertices
, startIndex
, primCount
);
692 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT PrimitiveCount
, CONST
void* pVertexStreamZeroData
, UINT VertexStreamZeroStride
) {
693 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
694 TRACE("(%p) Relay\n" , This
);
695 return IWineD3DDevice_DrawPrimitiveUP(This
->WineD3DDevice
, PrimitiveType
, PrimitiveCount
, pVertexStreamZeroData
, VertexStreamZeroStride
);
698 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface
, D3DPRIMITIVETYPE PrimitiveType
, UINT MinVertexIndex
,
699 UINT NumVertexIndices
, UINT PrimitiveCount
, CONST
void* pIndexData
,
700 D3DFORMAT IndexDataFormat
, CONST
void* pVertexStreamZeroData
, UINT VertexStreamZeroStride
) {
701 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
702 TRACE("(%p) Relay\n" , This
);
703 return IWineD3DDevice_DrawIndexedPrimitiveUP(This
->WineD3DDevice
, PrimitiveType
, MinVertexIndex
, NumVertexIndices
, PrimitiveCount
,
704 pIndexData
, IndexDataFormat
, pVertexStreamZeroData
, VertexStreamZeroStride
);
707 static HRESULT WINAPI
IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface
, UINT SrcStartIndex
, UINT DestIndex
, UINT VertexCount
, IDirect3DVertexBuffer9
* pDestBuffer
, IDirect3DVertexDeclaration9
* pVertexDecl
, DWORD Flags
) {
708 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
709 TRACE("(%p) Relay\n" , This
);
710 return IWineD3DDevice_ProcessVertices(This
->WineD3DDevice
,SrcStartIndex
, DestIndex
, VertexCount
, ((IDirect3DVertexBuffer9Impl
*)pDestBuffer
)->wineD3DVertexBuffer
, ((IDirect3DVertexBuffer9Impl
*)pVertexDecl
)->wineD3DVertexBuffer
, Flags
);
713 HRESULT WINAPI
IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface
, DWORD FVF
) {
714 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
715 TRACE("(%p) Relay\n" , This
);
719 D3DVERTEXELEMENT9
* elements
= NULL
;
720 IDirect3DVertexDeclaration9
* pDecl
= NULL
;
722 hr
= vdecl_convert_fvf(FVF
, &elements
);
723 if (hr
!= S_OK
) goto exit
;
725 hr
= IDirect3DDevice9Impl_CreateVertexDeclaration(iface
, elements
, &pDecl
);
726 if (hr
!= S_OK
) goto exit
;
728 hr
= IDirect3DDevice9Impl_SetVertexDeclaration(iface
, pDecl
);
729 if (hr
!= S_OK
) goto exit
;
733 HeapFree(GetProcessHeap(), 0, elements
);
734 if (pDecl
) IUnknown_Release(pDecl
);
735 if (hr
!= S_OK
) return hr
;
738 return IWineD3DDevice_SetFVF(This
->WineD3DDevice
, FVF
);
741 HRESULT WINAPI
IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface
, DWORD
* pFVF
) {
742 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
743 TRACE("(%p) Relay\n" , This
);
744 return IWineD3DDevice_GetFVF(This
->WineD3DDevice
, pFVF
);
747 HRESULT WINAPI
IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, IDirect3DVertexBuffer9
* pStreamData
, UINT OffsetInBytes
, UINT Stride
) {
748 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
749 TRACE("(%p) Relay\n" , This
);
750 return IWineD3DDevice_SetStreamSource(This
->WineD3DDevice
, StreamNumber
,
751 pStreamData
==NULL
? NULL
:((IDirect3DVertexBuffer9Impl
*)pStreamData
)->wineD3DVertexBuffer
,
752 OffsetInBytes
, Stride
);
755 HRESULT WINAPI
IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, IDirect3DVertexBuffer9
**pStream
, UINT
* OffsetInBytes
, UINT
* pStride
) {
756 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
757 IWineD3DVertexBuffer
*retStream
= NULL
;
760 TRACE("(%p) Relay\n" , This
);
763 return D3DERR_INVALIDCALL
;
766 rc
= IWineD3DDevice_GetStreamSource(This
->WineD3DDevice
, StreamNumber
, (IWineD3DVertexBuffer
**)&retStream
, OffsetInBytes
, pStride
);
767 if (rc
== D3D_OK
&& NULL
!= retStream
) {
768 IWineD3DVertexBuffer_GetParent(retStream
, (IUnknown
**)pStream
);
769 IWineD3DVertexBuffer_Release(retStream
);
771 FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes
, pStride
);
777 static HRESULT WINAPI
IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, UINT Divider
) {
778 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
779 TRACE("(%p) Relay\n" , This
);
780 IWineD3DDevice_SetStreamSourceFreq(This
->WineD3DDevice
, StreamNumber
, Divider
);
784 static HRESULT WINAPI
IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 iface
, UINT StreamNumber
, UINT
* Divider
) {
785 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
786 TRACE("(%p) Relay\n" , This
);
787 return IWineD3DDevice_GetStreamSourceFreq(This
->WineD3DDevice
, StreamNumber
, Divider
);
791 static HRESULT WINAPI
IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface
, IDirect3DIndexBuffer9
* pIndexData
) {
792 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
793 TRACE("(%p) Relay\n", This
);
794 return IWineD3DDevice_SetIndices(This
->WineD3DDevice
,
795 pIndexData
==NULL
? NULL
:((IDirect3DIndexBuffer9Impl
*)pIndexData
)->wineD3DIndexBuffer
,
799 static HRESULT WINAPI
IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface
, IDirect3DIndexBuffer9
**ppIndexData
) {
800 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
801 IWineD3DIndexBuffer
*retIndexData
= NULL
;
805 TRACE("(%p) Relay\n", This
);
807 if(ppIndexData
== NULL
){
808 return D3DERR_INVALIDCALL
;
811 rc
= IWineD3DDevice_GetIndices(This
->WineD3DDevice
, &retIndexData
, &tmp
);
812 if (rc
== D3D_OK
&& NULL
!= retIndexData
) {
813 IWineD3DVertexBuffer_GetParent(retIndexData
, (IUnknown
**)ppIndexData
);
814 IWineD3DVertexBuffer_Release(retIndexData
);
816 if(rc
!= D3D_OK
) FIXME("Call to GetIndices failed\n");
822 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
, CONST
float* pNumSegs
, CONST D3DRECTPATCH_INFO
* pRectPatchInfo
) {
823 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
824 TRACE("(%p) Relay\n", This
);
825 return IWineD3DDevice_DrawRectPatch(This
->WineD3DDevice
, Handle
, pNumSegs
, (WINED3DRECTPATCH_INFO
*)pRectPatchInfo
);
827 /*http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawTriPatch.asp*/
828 static HRESULT WINAPI
IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
, CONST
float* pNumSegs
, CONST D3DTRIPATCH_INFO
* pTriPatchInfo
) {
829 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
830 TRACE("(%p) Relay\n", This
);
831 return IWineD3DDevice_DrawTriPatch(This
->WineD3DDevice
, Handle
, pNumSegs
, (WINED3DTRIPATCH_INFO
*) pTriPatchInfo
);
834 static HRESULT WINAPI
IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9 iface
, UINT Handle
) {
835 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
836 TRACE("(%p) Relay\n", This
);
837 return IWineD3DDevice_DeletePatch(This
->WineD3DDevice
, Handle
);
840 const IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl
=
843 IDirect3DDevice9Impl_QueryInterface
,
844 IDirect3DDevice9Impl_AddRef
,
845 IDirect3DDevice9Impl_Release
,
846 /* IDirect3DDevice9 */
847 IDirect3DDevice9Impl_TestCooperativeLevel
,
848 IDirect3DDevice9Impl_GetAvailableTextureMem
,
849 IDirect3DDevice9Impl_EvictManagedResources
,
850 IDirect3DDevice9Impl_GetDirect3D
,
851 IDirect3DDevice9Impl_GetDeviceCaps
,
852 IDirect3DDevice9Impl_GetDisplayMode
,
853 IDirect3DDevice9Impl_GetCreationParameters
,
854 IDirect3DDevice9Impl_SetCursorProperties
,
855 IDirect3DDevice9Impl_SetCursorPosition
,
856 IDirect3DDevice9Impl_ShowCursor
,
857 IDirect3DDevice9Impl_CreateAdditionalSwapChain
,
858 IDirect3DDevice9Impl_GetSwapChain
,
859 IDirect3DDevice9Impl_GetNumberOfSwapChains
,
860 IDirect3DDevice9Impl_Reset
,
861 IDirect3DDevice9Impl_Present
,
862 IDirect3DDevice9Impl_GetBackBuffer
,
863 IDirect3DDevice9Impl_GetRasterStatus
,
864 IDirect3DDevice9Impl_SetDialogBoxMode
,
865 IDirect3DDevice9Impl_SetGammaRamp
,
866 IDirect3DDevice9Impl_GetGammaRamp
,
867 IDirect3DDevice9Impl_CreateTexture
,
868 IDirect3DDevice9Impl_CreateVolumeTexture
,
869 IDirect3DDevice9Impl_CreateCubeTexture
,
870 IDirect3DDevice9Impl_CreateVertexBuffer
,
871 IDirect3DDevice9Impl_CreateIndexBuffer
,
872 IDirect3DDevice9Impl_CreateRenderTarget
,
873 IDirect3DDevice9Impl_CreateDepthStencilSurface
,
874 IDirect3DDevice9Impl_UpdateSurface
,
875 IDirect3DDevice9Impl_UpdateTexture
,
876 IDirect3DDevice9Impl_GetRenderTargetData
,
877 IDirect3DDevice9Impl_GetFrontBufferData
,
878 IDirect3DDevice9Impl_StretchRect
,
879 IDirect3DDevice9Impl_ColorFill
,
880 IDirect3DDevice9Impl_CreateOffscreenPlainSurface
,
881 IDirect3DDevice9Impl_SetRenderTarget
,
882 IDirect3DDevice9Impl_GetRenderTarget
,
883 IDirect3DDevice9Impl_SetDepthStencilSurface
,
884 IDirect3DDevice9Impl_GetDepthStencilSurface
,
885 IDirect3DDevice9Impl_BeginScene
,
886 IDirect3DDevice9Impl_EndScene
,
887 IDirect3DDevice9Impl_Clear
,
888 IDirect3DDevice9Impl_SetTransform
,
889 IDirect3DDevice9Impl_GetTransform
,
890 IDirect3DDevice9Impl_MultiplyTransform
,
891 IDirect3DDevice9Impl_SetViewport
,
892 IDirect3DDevice9Impl_GetViewport
,
893 IDirect3DDevice9Impl_SetMaterial
,
894 IDirect3DDevice9Impl_GetMaterial
,
895 IDirect3DDevice9Impl_SetLight
,
896 IDirect3DDevice9Impl_GetLight
,
897 IDirect3DDevice9Impl_LightEnable
,
898 IDirect3DDevice9Impl_GetLightEnable
,
899 IDirect3DDevice9Impl_SetClipPlane
,
900 IDirect3DDevice9Impl_GetClipPlane
,
901 IDirect3DDevice9Impl_SetRenderState
,
902 IDirect3DDevice9Impl_GetRenderState
,
903 IDirect3DDevice9Impl_CreateStateBlock
,
904 IDirect3DDevice9Impl_BeginStateBlock
,
905 IDirect3DDevice9Impl_EndStateBlock
,
906 IDirect3DDevice9Impl_SetClipStatus
,
907 IDirect3DDevice9Impl_GetClipStatus
,
908 IDirect3DDevice9Impl_GetTexture
,
909 IDirect3DDevice9Impl_SetTexture
,
910 IDirect3DDevice9Impl_GetTextureStageState
,
911 IDirect3DDevice9Impl_SetTextureStageState
,
912 IDirect3DDevice9Impl_GetSamplerState
,
913 IDirect3DDevice9Impl_SetSamplerState
,
914 IDirect3DDevice9Impl_ValidateDevice
,
915 IDirect3DDevice9Impl_SetPaletteEntries
,
916 IDirect3DDevice9Impl_GetPaletteEntries
,
917 IDirect3DDevice9Impl_SetCurrentTexturePalette
,
918 IDirect3DDevice9Impl_GetCurrentTexturePalette
,
919 IDirect3DDevice9Impl_SetScissorRect
,
920 IDirect3DDevice9Impl_GetScissorRect
,
921 IDirect3DDevice9Impl_SetSoftwareVertexProcessing
,
922 IDirect3DDevice9Impl_GetSoftwareVertexProcessing
,
923 IDirect3DDevice9Impl_SetNPatchMode
,
924 IDirect3DDevice9Impl_GetNPatchMode
,
925 IDirect3DDevice9Impl_DrawPrimitive
,
926 IDirect3DDevice9Impl_DrawIndexedPrimitive
,
927 IDirect3DDevice9Impl_DrawPrimitiveUP
,
928 IDirect3DDevice9Impl_DrawIndexedPrimitiveUP
,
929 IDirect3DDevice9Impl_ProcessVertices
,
930 IDirect3DDevice9Impl_CreateVertexDeclaration
,
931 IDirect3DDevice9Impl_SetVertexDeclaration
,
932 IDirect3DDevice9Impl_GetVertexDeclaration
,
933 IDirect3DDevice9Impl_SetFVF
,
934 IDirect3DDevice9Impl_GetFVF
,
935 IDirect3DDevice9Impl_CreateVertexShader
,
936 IDirect3DDevice9Impl_SetVertexShader
,
937 IDirect3DDevice9Impl_GetVertexShader
,
938 IDirect3DDevice9Impl_SetVertexShaderConstantF
,
939 IDirect3DDevice9Impl_GetVertexShaderConstantF
,
940 IDirect3DDevice9Impl_SetVertexShaderConstantI
,
941 IDirect3DDevice9Impl_GetVertexShaderConstantI
,
942 IDirect3DDevice9Impl_SetVertexShaderConstantB
,
943 IDirect3DDevice9Impl_GetVertexShaderConstantB
,
944 IDirect3DDevice9Impl_SetStreamSource
,
945 IDirect3DDevice9Impl_GetStreamSource
,
946 IDirect3DDevice9Impl_SetStreamSourceFreq
,
947 IDirect3DDevice9Impl_GetStreamSourceFreq
,
948 IDirect3DDevice9Impl_SetIndices
,
949 IDirect3DDevice9Impl_GetIndices
,
950 IDirect3DDevice9Impl_CreatePixelShader
,
951 IDirect3DDevice9Impl_SetPixelShader
,
952 IDirect3DDevice9Impl_GetPixelShader
,
953 IDirect3DDevice9Impl_SetPixelShaderConstantF
,
954 IDirect3DDevice9Impl_GetPixelShaderConstantF
,
955 IDirect3DDevice9Impl_SetPixelShaderConstantI
,
956 IDirect3DDevice9Impl_GetPixelShaderConstantI
,
957 IDirect3DDevice9Impl_SetPixelShaderConstantB
,
958 IDirect3DDevice9Impl_GetPixelShaderConstantB
,
959 IDirect3DDevice9Impl_DrawRectPatch
,
960 IDirect3DDevice9Impl_DrawTriPatch
,
961 IDirect3DDevice9Impl_DeletePatch
,
962 IDirect3DDevice9Impl_CreateQuery
966 /* Internal function called back during the CreateDevice to create a render target */
967 HRESULT WINAPI
D3D9CB_CreateSurface(IUnknown
*device
, UINT Width
, UINT Height
,
968 WINED3DFORMAT Format
, DWORD Usage
, WINED3DPOOL Pool
, UINT Level
,
969 IWineD3DSurface
** ppSurface
, HANDLE
* pSharedHandle
) {
971 HRESULT res
= D3D_OK
;
972 IDirect3DSurface9Impl
*d3dSurface
= NULL
;
973 BOOL Lockable
= TRUE
;
975 if((Pool
== D3DPOOL_DEFAULT
&& Usage
!= D3DUSAGE_DYNAMIC
))
979 res
= IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9
*)device
, Width
, Height
, (D3DFORMAT
)Format
,
980 Lockable
, FALSE
/*Discard*/, Level
, (IDirect3DSurface9
**)&d3dSurface
, D3DRTYPE_SURFACE
,
981 Usage
, (D3DPOOL
) Pool
, D3DMULTISAMPLE_NONE
, 0 /* MultisampleQuality */, pSharedHandle
);
983 if (SUCCEEDED(res
)) {
984 *ppSurface
= d3dSurface
->wineD3DSurface
;
985 IUnknown_Release(d3dSurface
->parentDevice
);
986 d3dSurface
->parentDevice
= NULL
;
988 FIXME("(%p) IDirect3DDevice9_CreateSurface failed\n", device
);