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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "d3d9_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
29 /* IDirect3D IUnknown parts follow: */
30 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);
44 ULONG WINAPI IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9 iface) {
45 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
46 ULONG ref = InterlockedIncrement(&This->ref);
48 TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
53 ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
54 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
55 ULONG ref = InterlockedDecrement(&This->ref);
57 TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
60 IWineD3DDevice_Release(This->WineD3DDevice);
61 HeapFree(GetProcessHeap(), 0, This);
66 /* IDirect3DDevice Interface follow: */
67 HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface) {
68 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
70 TRACE("(%p) : Relay\n", This);
71 return IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice);
74 UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface) {
75 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
77 TRACE("(%p) Relay\n", This);
78 return IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice);
81 HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVICE9 iface) {
82 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
84 TRACE("(%p) : Relay\n", This);
85 return IWineD3DDevice_EvictManagedResources(This->WineD3DDevice);
88 HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9) {
89 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
93 TRACE("(%p) Relay\n", This);
96 return D3DERR_INVALIDCALL;
98 hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
99 if (hr == D3D_OK && pWineD3D != NULL)
101 IWineD3DResource_GetParent((IWineD3DResource *)pWineD3D,(IUnknown **)ppD3D9);
102 IWineD3DResource_Release((IWineD3DResource *)pWineD3D);
104 FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
107 TRACE("(%p) returning %p\n", This, *ppD3D9);
111 HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface, D3DCAPS9* pCaps) {
112 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
113 HRESULT hrc = D3D_OK;
114 WINED3DCAPS *pWineCaps;
116 TRACE("(%p) : Relay pCaps %p \n", This, pCaps);
118 return D3DERR_INVALIDCALL;
120 pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS));
121 if(pWineCaps == NULL){
122 return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
125 D3D9CAPSTOWINECAPS(pCaps, pWineCaps)
126 hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps);
127 HeapFree(GetProcessHeap(), 0, pWineCaps);
128 TRACE("Returning %p %p\n", This, pCaps);
132 HRESULT WINAPI IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DDISPLAYMODE* pMode) {
133 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
134 TRACE("(%p) Relay\n", This);
135 return IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, iSwapChain, pMode);
138 HRESULT WINAPI IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
139 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
140 TRACE("(%p) Relay\n", This);
141 return IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, pParameters);
144 HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
145 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
146 IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pCursorBitmap;
147 TRACE("(%p) Relay\n", This);
148 return IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,(IWineD3DSurface*)pSurface->wineD3DSurface);
151 void WINAPI IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9 iface, int XScreenSpace, int YScreenSpace, DWORD Flags) {
152 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
153 TRACE("(%p) Relay\n", This);
154 return IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags);
157 BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface, BOOL bShow) {
158 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
159 TRACE("(%p) Relay\n", This);
161 return IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow);
164 HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
165 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
166 WINED3DPRESENT_PARAMETERS localParameters;
167 TRACE("(%p) Relay pPresentationParameters(%p)\n", This, pPresentationParameters);
169 localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
170 localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
171 localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
172 localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
173 localParameters.MultiSampleType = &pPresentationParameters->MultiSampleType;
174 localParameters.MultiSampleQuality = &pPresentationParameters->MultiSampleQuality;
175 localParameters.SwapEffect = &pPresentationParameters->SwapEffect;
176 localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
177 localParameters.Windowed = &pPresentationParameters->Windowed;
178 localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
179 localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
180 localParameters.Flags = &pPresentationParameters->Flags;
181 localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
182 localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
183 return IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
186 HRESULT WINAPI IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA*
188 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
189 TRACE("(%p) Relay\n", This);
190 return IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
193 HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 ** ppBackBuffer) {
194 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
195 IWineD3DSurface *retSurface = NULL;
198 TRACE("(%p) Relay\n", This);
200 rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain, BackBuffer, Type, (IWineD3DSurface **)&retSurface);
201 if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
202 IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
203 IWineD3DSurface_Release(retSurface);
207 HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
208 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
209 TRACE("(%p) Relay\n", This);
211 return IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, iSwapChain, pRasterStatus);
214 HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BOOL bEnableDialogs) {
215 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
216 TRACE("(%p) Relay\n", This);
218 return IWineD3DDevice_SetDialogBoxMode(This->WineD3DDevice, bEnableDialogs);
221 void WINAPI IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
223 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
224 TRACE("(%p) Relay\n", This);
226 return IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, iSwapChain, Flags, pRamp);
229 void WINAPI IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DGAMMARAMP* pRamp) {
230 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
231 TRACE("(%p) Relay\n", This);
233 return IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, iSwapChain, pRamp);
237 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 ) {
239 IDirect3DSurface9Impl *object;
240 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
241 TRACE("(%p) Relay\n", This);
242 if(MultisampleQuality < 0) {
243 FIXME("MultisampleQuality out of range %ld, substituting 0 \n", MultisampleQuality);
244 /*FIXME: Find out what windows does with a MultisampleQuality < 0 */
245 MultisampleQuality=0;
248 if(MultisampleQuality > 0){
249 FIXME("MultisampleQuality set to %ld, bstituting 0 \n" , MultisampleQuality);
252 [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.
255 MultisampleQuality=0;
257 /*FIXME: Check MAX bounds of MultisampleQuality*/
259 /* Allocate the storage for the device */
260 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl));
261 if (NULL == object) {
262 FIXME("Allocation of memory failed\n");
264 return D3DERR_OUTOFVIDEOMEMORY;
267 object->lpVtbl = &Direct3DSurface9_Vtbl;
270 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
272 hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, Format, Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage, Pool,MultiSample,MultisampleQuality,pSharedHandle,(IUnknown *)object);
274 if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
276 FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This);
277 HeapFree(GetProcessHeap(), 0, object);
280 *ppSurface = (LPDIRECT3DSURFACE9) object;
287 HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height,
288 D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
289 DWORD MultisampleQuality, BOOL Lockable,
290 IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) {
292 /* Is this correct? */
293 return IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,Lockable,FALSE/*Discard*/, 0/*Level*/, ppSurface,D3DRTYPE_SURFACE,D3DUSAGE_RENDERTARGET,D3DPOOL_DEFAULT,MultiSample,MultisampleQuality,pSharedHandle);
298 HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height,
299 D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
300 DWORD MultisampleQuality, BOOL Discard,
301 IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) {
303 return IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,TRUE/* Lockable */,Discard, 0/* Level */
304 ,ppSurface,D3DRTYPE_SURFACE,D3DUSAGE_DEPTHSTENCIL,
305 D3DPOOL_DEFAULT,MultiSample,MultisampleQuality,pSharedHandle);
309 HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) {
310 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
311 TRACE("(%p) Relay\n" , This);
312 return IWineD3DDevice_UpdateSurface(This->WineD3DDevice, ((IDirect3DSurface9Impl *)pSourceSurface)->wineD3DSurface, pSourceRect, ((IDirect3DSurface9Impl *)pDestinationSurface)->wineD3DSurface, pDestPoint);
315 HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9 iface, IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) {
316 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
317 TRACE("(%p) Relay\n" , This);
318 return IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture9Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture9Impl *)pDestinationTexture)->wineD3DBaseTexture);
321 /* This isn't in MSDN!
322 HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pDestSurface) {
323 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
324 FIXME("(%p) : stub\n", This);
329 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
330 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
331 IDirect3DSurface9Impl *renderTarget = (IDirect3DSurface9Impl *)pRenderTarget;
332 IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface;
333 TRACE("(%p) Relay\n" , This);
334 return IWineD3DDevice_GetRenderTargetData(This->WineD3DDevice, renderTarget->wineD3DSurface, destSurface->wineD3DSurface);
337 HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
338 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
339 IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface;
340 TRACE("(%p) Relay\n" , This);
341 return IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, iSwapChain, destSurface->wineD3DSurface);
344 HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) {
345 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
346 TRACE("(%p) Relay\n" , This);
347 return IWineD3DDevice_StretchRect(This->WineD3DDevice, ((IDirect3DSurface9Impl *)pSourceSurface)->wineD3DSurface, pSourceRect, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface, pDestRect, Filter);
350 HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) {
351 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
352 IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface;
353 TRACE("(%p) Relay\n" , This);
354 return IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, (CONST D3DRECT*)pRect, color);
357 HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) {
359 if(Pool == D3DPOOL_MANAGED ){
360 FIXME("Attempting to create a managed offscreen plain surface\n");
361 return D3DERR_INVALIDCALL;
363 /*MSDN: D3DPOOL_SCRATCH will return a surface that has identical characteristics to a surface created by the Microsoft DirectX 8.x method CreateImageSurface.
365 'Off-screen plain surfaces are always lockable, regardless of their pool types.'
367 D3DPOOL_DEFAULT is the appropriate pool for use with the IDirect3DDevice9::StretchRect and IDirect3DDevice9::ColorFill.
368 Why, their always lockable?
369 should I change the usage to dynamic?
371 return IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,TRUE/*Loackable*/,FALSE/*Discard*/,0/*Level*/ , ppSurface,D3DRTYPE_SURFACE, 0/*Usage (undefined/none)*/,Pool,D3DMULTISAMPLE_NONE,0/*MultisampleQuality*/,pSharedHandle);
374 /* TODO: move to wineD3D */
375 HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
376 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
377 IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pRenderTarget;
378 TRACE("(%p) Relay\n" , This);
379 return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice,RenderTargetIndex,(IWineD3DSurface*)pSurface->wineD3DSurface);
382 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 iface, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget) {
383 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
385 IWineD3DSurface *pRenderTarget;
387 TRACE("(%p) Relay\n" , This);
389 if (ppRenderTarget == NULL) {
390 return D3DERR_INVALIDCALL;
392 hr=IWineD3DDevice_GetRenderTarget(This->WineD3DDevice,RenderTargetIndex,&pRenderTarget);
394 if (hr == D3D_OK && pRenderTarget != NULL) {
395 IWineD3DResource_GetParent((IWineD3DResource *)pRenderTarget,(IUnknown**)ppRenderTarget);
396 IWineD3DResource_Release((IWineD3DResource *)pRenderTarget);
398 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
399 *ppRenderTarget = NULL;
404 HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pZStencilSurface) {
405 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
406 IDirect3DSurface9Impl *pSurface;
408 TRACE("(%p) Relay\n" , This);
410 pSurface = (IDirect3DSurface9Impl*)pZStencilSurface;
411 return IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice,NULL==pSurface?NULL:(IWineD3DSurface*)pSurface->wineD3DSurface);
414 HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9 **ppZStencilSurface) {
415 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
417 IWineD3DSurface *pZStencilSurface;
419 TRACE("(%p) Relay\n" , This);
420 if(ppZStencilSurface == NULL){
421 return D3DERR_INVALIDCALL;
424 hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
425 if(hr == D3D_OK && pZStencilSurface != NULL){
426 IWineD3DResource_GetParent((IWineD3DResource *)pZStencilSurface,(IUnknown**)ppZStencilSurface);
427 IWineD3DResource_Release((IWineD3DResource *)pZStencilSurface);
429 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
430 *ppZStencilSurface = NULL;
435 HRESULT WINAPI IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface) {
436 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
437 TRACE("(%p) Relay\n" , This);
438 return IWineD3DDevice_BeginScene(This->WineD3DDevice);
441 HRESULT WINAPI IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface) {
442 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
443 TRACE("(%p) Relay\n" , This);
444 return IWineD3DDevice_EndScene(This->WineD3DDevice);
448 HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
449 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
450 TRACE("(%p) Relay\n" , This);
451 return IWineD3DDevice_Clear(This->WineD3DDevice, Count, pRects, Flags, Color, Z, Stencil);
454 HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) {
455 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
456 TRACE("(%p) Relay\n" , This);
457 return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, lpMatrix);
460 HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
461 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
462 TRACE("(%p) Relay\n" , This);
463 return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, pMatrix);
466 HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
467 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
468 TRACE("(%p) Relay\n" , This);
469 return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, pMatrix);
472 HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) {
473 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
474 TRACE("(%p) Relay\n" , This);
475 return IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
478 HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface, D3DVIEWPORT9* pViewport) {
479 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
480 TRACE("(%p) Relay\n" , This);
481 return IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
484 HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) {
485 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
486 TRACE("(%p) Relay\n" , This);
487 return IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
490 HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9 iface, D3DMATERIAL9* pMaterial) {
491 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
492 TRACE("(%p) Relay\n" , This);
493 return IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
496 HRESULT WINAPI IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST D3DLIGHT9* pLight) {
497 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
498 TRACE("(%p) Relay\n" , This);
499 return IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
502 HRESULT WINAPI IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9 iface, DWORD Index, D3DLIGHT9* pLight) {
503 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
504 TRACE("(%p) Relay\n" , This);
505 return IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
508 HRESULT WINAPI IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL Enable) {
509 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
510 TRACE("(%p) Relay\n" , This);
511 return IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable);
514 HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9 iface, DWORD Index, BOOL* pEnable) {
515 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
516 TRACE("(%p) Relay\n" , This);
517 return IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable);
520 HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, CONST float* pPlane) {
521 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
522 TRACE("(%p) Relay\n" , This);
523 return IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane);
526 HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9 iface, DWORD Index, float* pPlane) {
527 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
528 TRACE("(%p) Relay\n" , This);
529 return IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane);
532 HRESULT WINAPI IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD Value) {
533 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
534 TRACE("(%p) Relay\n" , This);
535 return IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value);
538 HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD* pValue) {
539 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
540 TRACE("(%p) Relay\n" , This);
541 return IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue);
544 HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface, CONST D3DCLIPSTATUS9* pClipStatus) {
545 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
546 TRACE("(%p) Relay\n" , This);
547 return IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
550 HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9 iface, D3DCLIPSTATUS9* pClipStatus) {
551 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
552 TRACE("(%p) Relay\n" , This);
553 return IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
556 HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9 **ppTexture) {
557 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
558 IWineD3DBaseTexture *retTexture = NULL;
561 TRACE("(%p) Relay\n" , This);
563 if(ppTexture == NULL){
564 return D3DERR_INVALIDCALL;
567 rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, (IWineD3DBaseTexture **)&retTexture);
568 if (rc == D3D_OK && NULL != retTexture) {
569 IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
570 IWineD3DBaseTexture_Release(retTexture);
572 FIXME("Call to get texture (%ld) failed (%p) \n", Stage, retTexture);
578 HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9 iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) {
579 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
580 TRACE("(%p) Relay %ld %p\n" , This, Stage, pTexture);
581 return IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage,
582 pTexture==NULL ? NULL:((IDirect3DBaseTexture9Impl *)pTexture)->wineD3DBaseTexture);
585 HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
586 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
587 TRACE("(%p) Relay\n" , This);
588 return IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, Type, pValue);
591 HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
592 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
593 TRACE("(%p) Relay\n" , This);
594 return IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, Type, Value);
597 HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) {
598 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
599 TRACE("(%p) Relay\n" , This);
600 return IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Sampler, Type, pValue);
603 HRESULT WINAPI IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) {
604 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
605 TRACE("(%p) Relay\n" , This);
606 return IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Sampler, Type, Value);
609 HRESULT WINAPI IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9 iface, DWORD* pNumPasses) {
610 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
611 TRACE("(%p) Relay\n" , This);
612 return IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses);
615 HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
616 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
617 TRACE("(%p) Relay\n" , This);
618 return IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
621 HRESULT WINAPI IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
622 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
623 TRACE("(%p) Relay\n" , This);
624 return IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
627 HRESULT WINAPI IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT PaletteNumber) {
628 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
629 TRACE("(%p) Relay\n" , This);
630 return IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
633 HRESULT WINAPI IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9 iface, UINT* PaletteNumber) {
634 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
635 TRACE("(%p) Relay\n" , This);
636 return IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
639 HRESULT WINAPI IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9 iface, CONST RECT* pRect) {
640 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
641 TRACE("(%p) Relay\n" , This);
642 return IWineD3DDevice_SetScissorRect(This->WineD3DDevice, pRect);
645 HRESULT WINAPI IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9 iface, RECT* pRect) {
646 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
647 TRACE("(%p) Relay\n" , This);
648 return IWineD3DDevice_GetScissorRect(This->WineD3DDevice, pRect);
651 HRESULT WINAPI IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface, BOOL bSoftware) {
652 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
653 TRACE("(%p) Relay\n" , This);
654 return IWineD3DDevice_SetSoftwareVertexProcessing(This->WineD3DDevice, bSoftware);
657 BOOL WINAPI IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9 iface) {
658 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
659 TRACE("(%p) Relay\n" , This);
660 return IWineD3DDevice_GetSoftwareVertexProcessing(This->WineD3DDevice);
663 HRESULT WINAPI IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9 iface, float nSegments) {
664 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
665 TRACE("(%p) Relay\n" , This);
666 return IWineD3DDevice_SetNPatchMode(This->WineD3DDevice, nSegments);
669 float WINAPI IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface) {
670 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
671 TRACE("(%p) Relay\n" , This);
672 return IWineD3DDevice_GetNPatchMode(This->WineD3DDevice);
675 HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
676 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
677 TRACE("(%p) Relay\n" , This);
678 return IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, PrimitiveCount);
681 HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType,
682 INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
683 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
684 TRACE("(%p) Relay\n" , This);
685 return IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
688 HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
689 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
690 TRACE("(%p) Relay\n" , This);
691 return IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
694 HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex,
695 UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData,
696 D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
697 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
698 TRACE("(%p) Relay\n" , This);
699 return IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount,
700 pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
703 HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) {
704 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
705 TRACE("(%p) Relay\n" , This);
706 return IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, ((IDirect3DVertexBuffer9Impl *)pDestBuffer)->wineD3DVertexBuffer, ((IDirect3DVertexBuffer9Impl *)pVertexDecl)->wineD3DVertexBuffer, Flags);
709 HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface, DWORD FVF) {
710 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
711 TRACE("(%p) Relay\n" , This);
712 return IWineD3DDevice_SetFVF(This->WineD3DDevice, FVF);
715 HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface, DWORD* pFVF) {
716 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
717 TRACE("(%p) Relay\n" , This);
718 return IWineD3DDevice_GetFVF(This->WineD3DDevice, pFVF);
721 HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
722 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
723 TRACE("(%p) Relay\n" , This);
724 return IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber,
725 pStreamData==NULL ? NULL:((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer,
726 OffsetInBytes, Stride);
729 HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) {
730 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
731 IWineD3DVertexBuffer *retStream = NULL;
734 TRACE("(%p) Relay\n" , This);
737 return D3DERR_INVALIDCALL;
740 rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, (IWineD3DVertexBuffer **)&retStream, OffsetInBytes, pStride);
741 if (rc == D3D_OK && NULL != retStream) {
742 IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
743 IWineD3DVertexBuffer_Release(retStream);
745 FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
751 HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT Divider) {
752 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
753 TRACE("(%p) Relay\n" , This);
754 IWineD3DDevice_SetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider);
758 HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, UINT* Divider) {
759 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
760 TRACE("(%p) Relay\n" , This);
761 return IWineD3DDevice_GetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider);
765 HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9* pIndexData) {
766 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
767 TRACE("(%p) Relay\n", This);
768 return IWineD3DDevice_SetIndices(This->WineD3DDevice,
769 pIndexData==NULL ? NULL:((IDirect3DIndexBuffer9Impl *)pIndexData)->wineD3DIndexBuffer,
773 HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9 **ppIndexData) {
774 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
775 IWineD3DIndexBuffer *retIndexData = NULL;
779 TRACE("(%p) Relay\n", This);
781 if(ppIndexData == NULL){
782 return D3DERR_INVALIDCALL;
785 rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData, &tmp);
786 if (rc == D3D_OK && NULL != retIndexData) {
787 IWineD3DVertexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
788 IWineD3DVertexBuffer_Release(retIndexData);
790 if(rc != D3D_OK) FIXME("Call to GetIndices failed\n");
796 HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
797 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
798 TRACE("(%p) Relay\n", This);
799 return IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, pRectPatchInfo);
801 /*http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawTriPatch.asp*/
802 HRESULT WINAPI IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9 iface, UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
803 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
804 TRACE("(%p) Relay\n", This);
805 return IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, pTriPatchInfo);
808 HRESULT WINAPI IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9 iface, UINT Handle) {
809 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
810 TRACE("(%p) Relay\n", This);
811 return IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle);
814 const IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl =
817 IDirect3DDevice9Impl_QueryInterface,
818 IDirect3DDevice9Impl_AddRef,
819 IDirect3DDevice9Impl_Release,
820 /* IDirect3DDevice9 */
821 IDirect3DDevice9Impl_TestCooperativeLevel,
822 IDirect3DDevice9Impl_GetAvailableTextureMem,
823 IDirect3DDevice9Impl_EvictManagedResources,
824 IDirect3DDevice9Impl_GetDirect3D,
825 IDirect3DDevice9Impl_GetDeviceCaps,
826 IDirect3DDevice9Impl_GetDisplayMode,
827 IDirect3DDevice9Impl_GetCreationParameters,
828 IDirect3DDevice9Impl_SetCursorProperties,
829 IDirect3DDevice9Impl_SetCursorPosition,
830 IDirect3DDevice9Impl_ShowCursor,
831 IDirect3DDevice9Impl_CreateAdditionalSwapChain,
832 IDirect3DDevice9Impl_GetSwapChain,
833 IDirect3DDevice9Impl_GetNumberOfSwapChains,
834 IDirect3DDevice9Impl_Reset,
835 IDirect3DDevice9Impl_Present,
836 IDirect3DDevice9Impl_GetBackBuffer,
837 IDirect3DDevice9Impl_GetRasterStatus,
838 IDirect3DDevice9Impl_SetDialogBoxMode,
839 IDirect3DDevice9Impl_SetGammaRamp,
840 IDirect3DDevice9Impl_GetGammaRamp,
841 IDirect3DDevice9Impl_CreateTexture,
842 IDirect3DDevice9Impl_CreateVolumeTexture,
843 IDirect3DDevice9Impl_CreateCubeTexture,
844 IDirect3DDevice9Impl_CreateVertexBuffer,
845 IDirect3DDevice9Impl_CreateIndexBuffer,
846 IDirect3DDevice9Impl_CreateRenderTarget,
847 IDirect3DDevice9Impl_CreateDepthStencilSurface,
848 IDirect3DDevice9Impl_UpdateSurface,
849 IDirect3DDevice9Impl_UpdateTexture,
850 IDirect3DDevice9Impl_GetRenderTargetData,
851 IDirect3DDevice9Impl_GetFrontBufferData,
852 IDirect3DDevice9Impl_StretchRect,
853 IDirect3DDevice9Impl_ColorFill,
854 IDirect3DDevice9Impl_CreateOffscreenPlainSurface,
855 IDirect3DDevice9Impl_SetRenderTarget,
856 IDirect3DDevice9Impl_GetRenderTarget,
857 IDirect3DDevice9Impl_SetDepthStencilSurface,
858 IDirect3DDevice9Impl_GetDepthStencilSurface,
859 IDirect3DDevice9Impl_BeginScene,
860 IDirect3DDevice9Impl_EndScene,
861 IDirect3DDevice9Impl_Clear,
862 IDirect3DDevice9Impl_SetTransform,
863 IDirect3DDevice9Impl_GetTransform,
864 IDirect3DDevice9Impl_MultiplyTransform,
865 IDirect3DDevice9Impl_SetViewport,
866 IDirect3DDevice9Impl_GetViewport,
867 IDirect3DDevice9Impl_SetMaterial,
868 IDirect3DDevice9Impl_GetMaterial,
869 IDirect3DDevice9Impl_SetLight,
870 IDirect3DDevice9Impl_GetLight,
871 IDirect3DDevice9Impl_LightEnable,
872 IDirect3DDevice9Impl_GetLightEnable,
873 IDirect3DDevice9Impl_SetClipPlane,
874 IDirect3DDevice9Impl_GetClipPlane,
875 IDirect3DDevice9Impl_SetRenderState,
876 IDirect3DDevice9Impl_GetRenderState,
877 IDirect3DDevice9Impl_CreateStateBlock,
878 IDirect3DDevice9Impl_BeginStateBlock,
879 IDirect3DDevice9Impl_EndStateBlock,
880 IDirect3DDevice9Impl_SetClipStatus,
881 IDirect3DDevice9Impl_GetClipStatus,
882 IDirect3DDevice9Impl_GetTexture,
883 IDirect3DDevice9Impl_SetTexture,
884 IDirect3DDevice9Impl_GetTextureStageState,
885 IDirect3DDevice9Impl_SetTextureStageState,
886 IDirect3DDevice9Impl_GetSamplerState,
887 IDirect3DDevice9Impl_SetSamplerState,
888 IDirect3DDevice9Impl_ValidateDevice,
889 IDirect3DDevice9Impl_SetPaletteEntries,
890 IDirect3DDevice9Impl_GetPaletteEntries,
891 IDirect3DDevice9Impl_SetCurrentTexturePalette,
892 IDirect3DDevice9Impl_GetCurrentTexturePalette,
893 IDirect3DDevice9Impl_SetScissorRect,
894 IDirect3DDevice9Impl_GetScissorRect,
895 IDirect3DDevice9Impl_SetSoftwareVertexProcessing,
896 IDirect3DDevice9Impl_GetSoftwareVertexProcessing,
897 IDirect3DDevice9Impl_SetNPatchMode,
898 IDirect3DDevice9Impl_GetNPatchMode,
899 IDirect3DDevice9Impl_DrawPrimitive,
900 IDirect3DDevice9Impl_DrawIndexedPrimitive,
901 IDirect3DDevice9Impl_DrawPrimitiveUP,
902 IDirect3DDevice9Impl_DrawIndexedPrimitiveUP,
903 IDirect3DDevice9Impl_ProcessVertices,
904 IDirect3DDevice9Impl_CreateVertexDeclaration,
905 IDirect3DDevice9Impl_SetVertexDeclaration,
906 IDirect3DDevice9Impl_GetVertexDeclaration,
907 IDirect3DDevice9Impl_SetFVF,
908 IDirect3DDevice9Impl_GetFVF,
909 IDirect3DDevice9Impl_CreateVertexShader,
910 IDirect3DDevice9Impl_SetVertexShader,
911 IDirect3DDevice9Impl_GetVertexShader,
912 IDirect3DDevice9Impl_SetVertexShaderConstantF,
913 IDirect3DDevice9Impl_GetVertexShaderConstantF,
914 IDirect3DDevice9Impl_SetVertexShaderConstantI,
915 IDirect3DDevice9Impl_GetVertexShaderConstantI,
916 IDirect3DDevice9Impl_SetVertexShaderConstantB,
917 IDirect3DDevice9Impl_GetVertexShaderConstantB,
918 IDirect3DDevice9Impl_SetStreamSource,
919 IDirect3DDevice9Impl_GetStreamSource,
920 IDirect3DDevice9Impl_SetStreamSourceFreq,
921 IDirect3DDevice9Impl_GetStreamSourceFreq,
922 IDirect3DDevice9Impl_SetIndices,
923 IDirect3DDevice9Impl_GetIndices,
924 IDirect3DDevice9Impl_CreatePixelShader,
925 IDirect3DDevice9Impl_SetPixelShader,
926 IDirect3DDevice9Impl_GetPixelShader,
927 IDirect3DDevice9Impl_SetPixelShaderConstantF,
928 IDirect3DDevice9Impl_GetPixelShaderConstantF,
929 IDirect3DDevice9Impl_SetPixelShaderConstantI,
930 IDirect3DDevice9Impl_GetPixelShaderConstantI,
931 IDirect3DDevice9Impl_SetPixelShaderConstantB,
932 IDirect3DDevice9Impl_GetPixelShaderConstantB,
933 IDirect3DDevice9Impl_DrawRectPatch,
934 IDirect3DDevice9Impl_DrawTriPatch,
935 IDirect3DDevice9Impl_DeletePatch,
936 IDirect3DDevice9Impl_CreateQuery
940 /* Internal function called back during the CreateDevice to create a render target */
941 HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height,
942 WINED3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level,
943 IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
945 HRESULT res = D3D_OK;
946 IDirect3DSurface9Impl *d3dSurface = NULL;
947 BOOL Lockable = TRUE;
949 if((Pool == D3DPOOL_DEFAULT && Usage != D3DUSAGE_DYNAMIC))
953 res = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9 *)device, Width, Height, (D3DFORMAT)Format, Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface9 **)&d3dSurface, D3DRTYPE_SURFACE, Usage, Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, pSharedHandle);
956 *ppSurface = d3dSurface->wineD3DSurface;
958 FIXME("(%p) IDirect3DDevice9_CreateSurface failed\n", device);