2 * IDirect3DDevice8 implementation
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2004 Christian Costa
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
33 #include "wine/debug.h"
35 #include "d3d8_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
39 /* IDirect3D IUnknown parts follow: */
40 HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 iface,REFIID riid,LPVOID *ppobj)
42 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
44 if (IsEqualGUID(riid, &IID_IUnknown)
45 || IsEqualGUID(riid, &IID_IDirect3DDevice8)) {
46 IUnknown_AddRef(iface);
51 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
55 ULONG WINAPI IDirect3DDevice8Impl_AddRef(LPDIRECT3DDEVICE8 iface) {
56 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
57 ULONG ref = InterlockedIncrement(&This->ref);
59 TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
64 ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
65 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
66 ULONG ref = InterlockedDecrement(&This->ref);
68 TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
71 TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
72 IWineD3DDevice_Uninit3D(This->WineD3DDevice);
73 IWineD3DDevice_Release(This->WineD3DDevice);
74 HeapFree(GetProcessHeap(), 0, This);
79 /* IDirect3DDevice Interface follow: */
80 HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(LPDIRECT3DDEVICE8 iface) {
81 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
83 TRACE("(%p) : Relay\n", This);
84 return IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice);
87 UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE8 iface) {
88 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
90 TRACE("(%p) Relay\n", This);
91 return IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice);
94 HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3DDEVICE8 iface, DWORD Bytes) {
95 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
97 TRACE("(%p) : Relay bytes(%ld)\n", This, Bytes);
98 return IWineD3DDevice_EvictManagedResources(This->WineD3DDevice);
101 HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface, IDirect3D8** ppD3D8) {
102 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
106 TRACE("(%p) Relay\n", This);
108 if (NULL == ppD3D8) {
109 return D3DERR_INVALIDCALL;
111 hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
112 if (hr == D3D_OK && pWineD3D != NULL)
114 IWineD3DResource_GetParent((IWineD3DResource *)pWineD3D,(IUnknown **)ppD3D8);
115 IWineD3DResource_Release((IWineD3DResource *)pWineD3D);
117 FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
120 TRACE("(%p) returning %p\b",This , *ppD3D8);
124 HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface, D3DCAPS8* pCaps) {
125 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
126 HRESULT hrc = D3D_OK;
127 WINED3DCAPS *pWineCaps;
129 TRACE("(%p) : Relay pCaps %p\n", This, pCaps);
131 return D3DERR_INVALIDCALL;
133 pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS));
134 if(pWineCaps == NULL){
135 return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
138 D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
139 hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps);
140 HeapFree(GetProcessHeap(), 0, pWineCaps);
141 TRACE("Returning %p %p\n", This, pCaps);
145 HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(LPDIRECT3DDEVICE8 iface, D3DDISPLAYMODE* pMode) {
146 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
147 TRACE("(%p) Relay\n", This);
148 return IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, 0, (WINED3DDISPLAYMODE *) pMode);
151 HRESULT WINAPI IDirect3DDevice8Impl_GetCreationParameters(LPDIRECT3DDEVICE8 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
152 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
153 TRACE("(%p) Relay\n", This);
154 return IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, (WINED3DDEVICE_CREATION_PARAMETERS *) pParameters);
157 HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(LPDIRECT3DDEVICE8 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8* pCursorBitmap) {
158 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
159 IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl*)pCursorBitmap;
160 TRACE("(%p) Relay\n", This);
161 return IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,(IWineD3DSurface*)pSurface->wineD3DSurface);
164 void WINAPI IDirect3DDevice8Impl_SetCursorPosition(LPDIRECT3DDEVICE8 iface, UINT XScreenSpace, UINT YScreenSpace, DWORD Flags) {
165 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
166 TRACE("(%p) Relay\n", This);
167 return IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags);
170 BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL bShow) {
171 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
172 TRACE("(%p) Relay\n", This);
174 return IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow);
177 HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain) {
178 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
179 IDirect3DSwapChain8Impl* object;
180 HRESULT hrc = D3D_OK;
181 WINED3DPRESENT_PARAMETERS localParameters;
183 TRACE("(%p) Relay\n", This);
185 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
186 if (NULL == object) {
187 FIXME("Allocation of memory failed\n");
189 return D3DERR_OUTOFVIDEOMEMORY;
192 object->lpVtbl = &Direct3DSwapChain8_Vtbl;
194 /* Allocate an associated WineD3DDevice object */
195 localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
196 localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
197 localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
198 localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
199 localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
200 localParameters.MultiSampleQuality = NULL; /* d3d9 only */
201 localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
202 localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
203 localParameters.Windowed = &pPresentationParameters->Windowed;
204 localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
205 localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
206 localParameters.Flags = &pPresentationParameters->Flags;
207 localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
208 localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;
211 hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D8CB_CreateRenderTarget, D3D8CB_CreateDepthStencilSurface);
213 FIXME("(%p) call to IWineD3DDevice_CreateAdditionalSwapChain failed\n", This);
214 HeapFree(GetProcessHeap(), 0 , object);
217 *pSwapChain = (IDirect3DSwapChain8 *)object;
219 TRACE("(%p) returning %p\n", This, *pSwapChain);
223 HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
224 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
225 WINED3DPRESENT_PARAMETERS localParameters;
226 TRACE("(%p) Relay pPresentationParameters(%p)\n", This, pPresentationParameters);
228 localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
229 localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
230 localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
231 localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
232 localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
233 localParameters.MultiSampleQuality = NULL; /* D3d9 only */
234 localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
235 localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
236 localParameters.Windowed = &pPresentationParameters->Windowed;
237 localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
238 localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
239 localParameters.Flags = &pPresentationParameters->Flags;
240 localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
241 localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;
242 return IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
245 HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
246 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
247 TRACE("(%p) Relay\n", This);
248 return IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
251 HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(LPDIRECT3DDEVICE8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
252 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
253 IWineD3DSurface *retSurface = NULL;
256 TRACE("(%p) Relay\n", This);
258 rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, (IWineD3DSurface **)&retSurface);
259 if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
260 IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
261 IWineD3DSurface_Release(retSurface);
266 HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus) {
267 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
268 TRACE("(%p) Relay\n", This);
270 return IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, 0, (WINED3DRASTER_STATUS *) pRasterStatus);
273 void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) {
274 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
275 TRACE("(%p) Relay\n", This);
277 return IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, 0, Flags, (WINED3DGAMMARAMP *) pRamp);
280 void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) {
281 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
282 TRACE("(%p) Relay\n", This);
284 return IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, 0, (WINED3DGAMMARAMP *) pRamp);
287 HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
288 D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture8 **ppTexture) {
289 IDirect3DTexture8Impl *object;
290 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
291 HRESULT hrc = D3D_OK;
293 TRACE("(%p) : W(%d) H(%d), Lvl(%d) d(%ld), Fmt(%u), Pool(%d)\n", This, Width, Height, Levels, Usage, Format, Pool);
295 /* Allocate the storage for the device */
296 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture8Impl));
298 if (NULL == object) {
299 FIXME("Allocation of memory failed\n");
300 /* *ppTexture = NULL; */
301 return D3DERR_OUTOFVIDEOMEMORY;
304 object->lpVtbl = &Direct3DTexture8_Vtbl;
306 hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage,
307 (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DTexture, NULL, (IUnknown *)object, D3D8CB_CreateSurface);
311 FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This);
312 HeapFree(GetProcessHeap(), 0, object);
313 /* *ppTexture = NULL; */
315 *ppTexture = (LPDIRECT3DTEXTURE8) object;
318 TRACE("(%p) Created Texture %p, %p\n",This,object,object->wineD3DTexture);
322 HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface,
323 UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage,
324 D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture8** ppVolumeTexture) {
326 IDirect3DVolumeTexture8Impl *object;
327 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
328 HRESULT hrc = D3D_OK;
330 TRACE("(%p) Relay\n", This);
332 /* Allocate the storage for the device */
333 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture8Impl));
334 if (NULL == object) {
335 FIXME("(%p) allocation of memory failed\n", This);
336 *ppVolumeTexture = NULL;
337 return D3DERR_OUTOFVIDEOMEMORY;
340 object->lpVtbl = &Direct3DVolumeTexture8_Vtbl;
342 hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage,
343 (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DVolumeTexture, NULL,
344 (IUnknown *)object, D3D8CB_CreateVolume);
349 FIXME("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This);
350 HeapFree(GetProcessHeap(), 0, object);
351 *ppVolumeTexture = NULL;
353 *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object;
355 TRACE("(%p) returning %p\n", This , *ppVolumeTexture);
359 HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage,
360 D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture) {
362 IDirect3DCubeTexture8Impl *object;
363 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
366 TRACE("(%p) : ELen(%d) Lvl(%d) Usage(%ld) fmt(%u), Pool(%d)\n" , This, EdgeLength, Levels, Usage, Format, Pool);
368 /* Allocate the storage for the device */
369 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
371 if (NULL == object) {
372 FIXME("(%p) allocation of CubeTexture failed\n", This);
373 *ppCubeTexture = NULL;
374 return D3DERR_OUTOFVIDEOMEMORY;
377 object->lpVtbl = &Direct3DCubeTexture8_Vtbl;
379 hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage,
380 (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DCubeTexture, NULL, (IUnknown*)object,
381 D3D8CB_CreateSurface);
386 FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This);
387 HeapFree(GetProcessHeap(), 0, object);
388 *ppCubeTexture = NULL;
390 *ppCubeTexture = (LPDIRECT3DCUBETEXTURE8) object;
393 TRACE("(%p) returning %p\n",This, *ppCubeTexture);
397 HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(LPDIRECT3DDEVICE8 iface, UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer8** ppVertexBuffer) {
398 IDirect3DVertexBuffer8Impl *object;
399 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
400 HRESULT hrc = D3D_OK;
402 TRACE("(%p) Relay\n", This);
403 /* Allocate the storage for the device */
404 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer8Impl));
405 if (NULL == object) {
406 FIXME("Allocation of memory failed\n");
407 *ppVertexBuffer = NULL;
408 return D3DERR_OUTOFVIDEOMEMORY;
411 object->lpVtbl = &Direct3DVertexBuffer8_Vtbl;
413 hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), NULL, (IUnknown *)object);
418 FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This);
419 HeapFree(GetProcessHeap(), 0, object);
420 *ppVertexBuffer = NULL;
422 IUnknown_AddRef(iface);
423 object->parentDevice = iface;
424 *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER8) object;
429 HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(LPDIRECT3DDEVICE8 iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer8** ppIndexBuffer) {
430 IDirect3DIndexBuffer8Impl *object;
431 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
432 HRESULT hrc = D3D_OK;
434 TRACE("(%p) Relay\n", This);
435 /* Allocate the storage for the device */
436 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
437 if (NULL == object) {
438 FIXME("Allocation of memory failed\n");
439 *ppIndexBuffer = NULL;
440 return D3DERR_OUTOFVIDEOMEMORY;
443 object->lpVtbl = &Direct3DIndexBuffer8_Vtbl;
445 TRACE("Calling wined3d create index buffer\n");
446 hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, (WINED3DPOOL) Pool, &object->wineD3DIndexBuffer, NULL, (IUnknown *)object);
451 FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This);
452 HeapFree(GetProcessHeap(), 0, object);
453 *ppIndexBuffer = NULL;
455 *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER8)object;
460 HRESULT WINAPI IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface,D3DRESOURCETYPE Type, UINT Usage,D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) {
462 IDirect3DSurface8Impl *object;
463 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
464 TRACE("(%p) Relay\n", This);
465 if(MultisampleQuality < 0) {
466 FIXME("MultisampleQuality out of range %ld, substituting 0\n", MultisampleQuality);
467 /*FIXME: Find out what windows does with a MultisampleQuality < 0 */
468 MultisampleQuality=0;
471 if(MultisampleQuality > 0){
472 FIXME("MultisampleQuality set to %ld, substituting 0\n" , MultisampleQuality);
475 [in] Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D8::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.
477 MultisampleQuality=0;
479 /*FIXME: Check MAX bounds of MultisampleQuality*/
481 /* Allocate the storage for the device */
482 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl));
483 if (NULL == object) {
484 FIXME("Allocation of memory failed\n");
486 return D3DERR_OUTOFVIDEOMEMORY;
489 object->lpVtbl = &Direct3DSurface8_Vtbl;
492 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
494 hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, Format, Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage, (WINED3DPOOL) Pool,MultiSample,MultisampleQuality, NULL, SURFACE_OPENGL, (IUnknown *)object);
495 if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
497 FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This);
498 HeapFree(GetProcessHeap(), 0, object);
501 *ppSurface = (LPDIRECT3DSURFACE8) object;
506 HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, IDirect3DSurface8** ppSurface) {
509 return IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */, 0 /* Level */ , ppSurface, D3DRTYPE_SURFACE, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, 0);
512 HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, IDirect3DSurface8** ppSurface) {
514 /* TODO: Verify that Discard is false */
515 return IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE, 0 /* Level */
516 ,ppSurface, D3DRTYPE_SURFACE, D3DUSAGE_DEPTHSTENCIL,
517 D3DPOOL_DEFAULT, MultiSample, 0);
520 HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) {
523 return IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Loackable */ , FALSE /*Discard*/ , 0 /* Level */ , ppSurface, D3DRTYPE_SURFACE, 0 /* Usage (undefined/none) */ , D3DPOOL_SCRATCH, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
526 HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8 *pSourceSurface, CONST RECT *pSourceRects, UINT cRects, IDirect3DSurface8 *pDestinationSurface, CONST POINT *pDestPoints) {
527 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
529 TRACE("(%p) Relay\n" , This);
531 return IWineD3DDevice_CopyRects(This->WineD3DDevice, pSourceSurface == NULL ? NULL : ((IDirect3DSurface8Impl *)pSourceSurface)->wineD3DSurface,
532 pSourceRects, cRects, pDestinationSurface == NULL ? NULL : ((IDirect3DSurface8Impl *)pDestinationSurface)->wineD3DSurface, pDestPoints);
535 HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(LPDIRECT3DDEVICE8 iface, IDirect3DBaseTexture8* pSourceTexture, IDirect3DBaseTexture8* pDestinationTexture) {
536 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
537 TRACE("(%p) Relay\n" , This);
539 return IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture8Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture8Impl *)pDestinationTexture)->wineD3DBaseTexture);
542 HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pDestSurface) {
543 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
544 IDirect3DSurface8Impl *destSurface = (IDirect3DSurface8Impl *)pDestSurface;
546 TRACE("(%p) Relay\n" , This);
548 if (pDestSurface == NULL) {
549 WARN("(%p) : Caller passed NULL as pDestSurface returning D3DERR_INVALIDCALL\n", This);
550 return D3DERR_INVALIDCALL;
553 return IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, 0, destSurface->wineD3DSurface);
556 HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pRenderTarget, IDirect3DSurface8* pNewZStencil) {
557 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
558 IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl *)pRenderTarget;
559 IDirect3DSurface8Impl *pZSurface = (IDirect3DSurface8Impl *)pNewZStencil;
560 TRACE("(%p) Relay\n" , This);
562 IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, NULL == pZSurface ? NULL : (IWineD3DSurface *)pZSurface->wineD3DSurface);
564 return IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, (IWineD3DSurface *)pSurface->wineD3DSurface);
567 HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppRenderTarget) {
568 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
570 IWineD3DSurface *pRenderTarget;
572 TRACE("(%p) Relay\n" , This);
574 if (ppRenderTarget == NULL) {
575 return D3DERR_INVALIDCALL;
577 hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget);
579 if (hr == D3D_OK && pRenderTarget != NULL) {
580 IWineD3DResource_GetParent((IWineD3DResource *)pRenderTarget,(IUnknown**)ppRenderTarget);
581 IWineD3DResource_Release((IWineD3DResource *)pRenderTarget);
583 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
584 *ppRenderTarget = NULL;
590 HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppZStencilSurface) {
591 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
593 IWineD3DSurface *pZStencilSurface;
595 TRACE("(%p) Relay\n" , This);
596 if(ppZStencilSurface == NULL){
597 return D3DERR_INVALIDCALL;
600 hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
601 if(hr == D3D_OK && pZStencilSurface != NULL){
602 IWineD3DResource_GetParent((IWineD3DResource *)pZStencilSurface,(IUnknown**)ppZStencilSurface);
603 IWineD3DResource_Release((IWineD3DResource *)pZStencilSurface);
605 FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
606 *ppZStencilSurface = NULL;
612 HRESULT WINAPI IDirect3DDevice8Impl_BeginScene(LPDIRECT3DDEVICE8 iface) {
613 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
614 return IWineD3DDevice_BeginScene(This->WineD3DDevice);
617 HRESULT WINAPI IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) {
618 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
619 TRACE("(%p) Relay\n" , This);
621 return IWineD3DDevice_EndScene(This->WineD3DDevice);
624 HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
625 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
626 TRACE("(%p) Relay\n" , This);
628 return IWineD3DDevice_Clear(This->WineD3DDevice, Count, pRects, Flags, Color, Z, Stencil);
631 HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) {
632 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
633 TRACE("(%p) Relay\n" , This);
635 return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, lpMatrix);
638 HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) {
639 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
640 TRACE("(%p) Relay\n" , This);
642 return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, pMatrix);
645 HRESULT WINAPI IDirect3DDevice8Impl_MultiplyTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
646 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
647 TRACE("(%p) Relay\n" , This);
649 return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, pMatrix);
652 HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(LPDIRECT3DDEVICE8 iface, CONST D3DVIEWPORT8* pViewport) {
653 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
654 TRACE("(%p) Relay\n" , This);
656 return IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
659 HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(LPDIRECT3DDEVICE8 iface, D3DVIEWPORT8* pViewport) {
660 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
661 TRACE("(%p) Relay\n" , This);
663 return IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
666 HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(LPDIRECT3DDEVICE8 iface, CONST D3DMATERIAL8* pMaterial) {
667 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
668 TRACE("(%p) Relay\n" , This);
669 /* FIXME: Verify that D3DMATERIAL8 ~= WINED3DMATERIAL */
670 return IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
673 HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(LPDIRECT3DDEVICE8 iface, D3DMATERIAL8* pMaterial) {
674 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
675 TRACE("(%p) Relay\n" , This);
676 /* FIXME: Verify that D3DMATERIAL8 ~= WINED3DMATERIAL */
677 return IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
680 HRESULT WINAPI IDirect3DDevice8Impl_SetLight(LPDIRECT3DDEVICE8 iface, DWORD Index, CONST D3DLIGHT8* pLight) {
681 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
682 TRACE("(%p) Relay\n" , This);
683 /* FIXME: Verify that D3DLIGHT8 ~= WINED3DLIGHT */
684 return IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
687 HRESULT WINAPI IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index,D3DLIGHT8* pLight) {
688 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
689 TRACE("(%p) Relay\n" , This);
690 /* FIXME: Verify that D3DLIGHT8 ~= WINED3DLIGHT */
691 return IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
694 HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL Enable) {
695 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
696 TRACE("(%p) Relay\n" , This);
698 return IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable);
701 HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL* pEnable) {
702 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
703 TRACE("(%p) Relay\n" , This);
705 return IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable);
708 HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index,CONST float* pPlane) {
709 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
710 TRACE("(%p) Relay\n" , This);
712 return IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane);
715 HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index,float* pPlane) {
716 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
717 TRACE("(%p) Relay\n" , This);
719 return IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane);
722 HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD Value) {
723 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
724 TRACE("(%p) Relay\n" , This);
726 return IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value);
729 HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD* pValue) {
730 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
731 TRACE("(%p) Relay\n" , This);
733 return IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue);
736 HRESULT WINAPI IDirect3DDevice8Impl_BeginStateBlock(LPDIRECT3DDEVICE8 iface) {
737 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
739 TRACE("(%p)\n", This);
741 return IWineD3DDevice_BeginStateBlock(This->WineD3DDevice);
744 HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface, DWORD* pToken) {
745 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
747 IWineD3DStateBlock* wineD3DStateBlock;
748 IDirect3DStateBlock8Impl* object;
750 TRACE("(%p) Relay\n", This);
752 /* Tell wineD3D to endstatablock before anything else (in case we run out
753 * of memory later and cause locking problems)
755 hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice , &wineD3DStateBlock);
757 FIXME("IWineD3DDevice_EndStateBlock returned an error\n");
761 /* allocate a new IDirectD3DStateBlock */
762 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock8Impl));
764 object->lpVtbl = &Direct3DStateBlock8_Vtbl;
766 object->wineD3DStateBlock = wineD3DStateBlock;
768 *pToken = (DWORD)object;
769 TRACE("(%p)Returning %p %p\n", This, object, wineD3DStateBlock);
774 HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) {
775 IDirect3DStateBlock8Impl *pSB = (IDirect3DStateBlock8Impl*) Token;
776 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
778 TRACE("(%p) %p Relay\n", This, pSB);
780 return IWineD3DStateBlock_Apply(pSB->wineD3DStateBlock);
783 HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) {
784 IDirect3DStateBlock8Impl* pSB = (IDirect3DStateBlock8Impl *)Token;
785 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
787 TRACE("(%p) %p Relay\n", This, pSB);
789 return IWineD3DStateBlock_Capture(pSB->wineD3DStateBlock);
792 HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) {
793 IDirect3DStateBlock8Impl* pSB = (IDirect3DStateBlock8Impl *)Token;
794 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
796 TRACE("(%p) Relay\n", This);
798 while(IUnknown_Release((IUnknown *)pSB));
803 HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(LPDIRECT3DDEVICE8 iface, D3DSTATEBLOCKTYPE Type, DWORD* pToken) {
804 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
805 IDirect3DStateBlock8Impl *object;
806 HRESULT hrc = D3D_OK;
808 TRACE("(%p) Relay\n", This);
810 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock8Impl));
811 if (NULL == object) {
812 FIXME("(%p) Failed to allocate %d bytes\n", This, sizeof(IDirect3DStateBlock8Impl));
814 return E_OUTOFMEMORY;
816 object->lpVtbl = &Direct3DStateBlock8_Vtbl;
819 hrc = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type, &object->wineD3DStateBlock, (IUnknown *)object);
821 FIXME("(%p) Call to IWineD3DDevice_CreateStateBlock failed.\n", This);
822 HeapFree(GetProcessHeap(), 0, object);
825 *pToken = (DWORD)object;
827 TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
832 HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(LPDIRECT3DDEVICE8 iface, CONST D3DCLIPSTATUS8* pClipStatus) {
833 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
834 TRACE("(%p) Relay\n" , This);
835 /* FIXME: Verify that D3DCLIPSTATUS8 ~= WINED3DCLIPSTATUS */
836 return IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
839 HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface, D3DCLIPSTATUS8* pClipStatus) {
840 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
841 TRACE("(%p) Relay\n" , This);
843 return IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
846 HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage,IDirect3DBaseTexture8** ppTexture) {
847 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
848 IWineD3DBaseTexture *retTexture = NULL;
851 TRACE("(%p) Relay\n" , This);
853 if(ppTexture == NULL){
854 return D3DERR_INVALIDCALL;
857 rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, (IWineD3DBaseTexture **)&retTexture);
858 if (rc == D3D_OK && NULL != retTexture) {
859 IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
860 IWineD3DBaseTexture_Release(retTexture);
862 FIXME("Call to get texture (%ld) failed (%p)\n", Stage, retTexture);
869 HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage, IDirect3DBaseTexture8* pTexture) {
870 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
871 TRACE("(%p) Relay %ld %p\n" , This, Stage, pTexture);
873 return IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage,
874 pTexture==NULL ? NULL : ((IDirect3DBaseTexture8Impl *)pTexture)->wineD3DBaseTexture);
877 HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) {
878 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
879 TRACE("(%p) Relay\n" , This);
882 case D3DTSS_ADDRESSU:
883 Type = WINED3DSAMP_ADDRESSU;
885 case D3DTSS_ADDRESSV:
886 Type = WINED3DSAMP_ADDRESSV;
888 case D3DTSS_ADDRESSW:
889 Type = WINED3DSAMP_ADDRESSW;
891 case D3DTSS_BORDERCOLOR:
892 Type = WINED3DSAMP_BORDERCOLOR;
894 case D3DTSS_MAGFILTER:
895 Type = WINED3DSAMP_MAGFILTER;
897 case D3DTSS_MAXANISOTROPY:
898 Type = WINED3DSAMP_MAXANISOTROPY;
900 case D3DTSS_MAXMIPLEVEL:
901 Type = WINED3DSAMP_MAXMIPLEVEL;
903 case D3DTSS_MINFILTER:
904 Type = WINED3DSAMP_MINFILTER;
906 case D3DTSS_MIPFILTER:
907 Type = WINED3DSAMP_MIPFILTER;
909 case D3DTSS_MIPMAPLODBIAS:
910 Type = WINED3DSAMP_MIPMAPLODBIAS;
913 return IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, Type, pValue);
916 return IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Stage, Type, pValue);
919 HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
920 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
921 TRACE("(%p) Relay\n" , This);
924 case D3DTSS_ADDRESSU:
925 Type = WINED3DSAMP_ADDRESSU;
927 case D3DTSS_ADDRESSV:
928 Type = WINED3DSAMP_ADDRESSV;
930 case D3DTSS_ADDRESSW:
931 Type = WINED3DSAMP_ADDRESSW;
933 case D3DTSS_BORDERCOLOR:
934 Type = WINED3DSAMP_BORDERCOLOR;
936 case D3DTSS_MAGFILTER:
937 Type = WINED3DSAMP_MAGFILTER;
939 case D3DTSS_MAXANISOTROPY:
940 Type = WINED3DSAMP_MAXANISOTROPY;
942 case D3DTSS_MAXMIPLEVEL:
943 Type = WINED3DSAMP_MAXMIPLEVEL;
945 case D3DTSS_MINFILTER:
946 Type = WINED3DSAMP_MINFILTER;
948 case D3DTSS_MIPFILTER:
949 Type = WINED3DSAMP_MIPFILTER;
951 case D3DTSS_MIPMAPLODBIAS:
952 Type = WINED3DSAMP_MIPMAPLODBIAS;
955 return IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, Type, Value);
958 return IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Stage, Type, Value);
961 HRESULT WINAPI IDirect3DDevice8Impl_ValidateDevice(LPDIRECT3DDEVICE8 iface, DWORD* pNumPasses) {
962 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
963 TRACE("(%p) Relay\n" , This);
965 return IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses);
968 HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(LPDIRECT3DDEVICE8 iface, DWORD DevInfoID, void* pDevInfoStruct, DWORD DevInfoStructSize) {
969 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
970 FIXME("(%p) : stub\n", This);
974 HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
975 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
976 TRACE("(%p) Relay\n" , This);
978 return IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
981 HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
982 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
983 TRACE("(%p) Relay\n" , This);
985 return IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
988 HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber) {
989 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
990 TRACE("(%p) Relay\n" , This);
992 return IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
995 HRESULT WINAPI IDirect3DDevice8Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT *PaletteNumber) {
996 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
997 TRACE("(%p) Relay\n" , This);
999 return IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
1002 HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
1003 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1004 TRACE("(%p) Relay\n" , This);
1006 return IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, PrimitiveCount);
1009 HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType,
1010 UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) {
1011 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1012 TRACE("(%p) Relay\n" , This);
1014 return IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, This->baseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
1017 HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) {
1018 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1019 TRACE("(%p) Relay\n" , This);
1021 return IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
1024 HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,
1025 UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,
1026 D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,
1027 UINT VertexStreamZeroStride) {
1028 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1029 TRACE("(%p) Relay\n" , This);
1031 return IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount,
1032 pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
1035 HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 iface, UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) {
1036 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1037 TRACE("(%p) Relay\n" , This);
1039 return IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, ((IDirect3DVertexBuffer8Impl *)pDestBuffer)->wineD3DVertexBuffer, NULL, Flags);
1042 HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8 iface, CONST DWORD* pDeclaration, CONST DWORD* pFunction, DWORD* ppShader, DWORD Usage) {
1043 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1044 HRESULT hrc = D3D_OK;
1045 IDirect3DVertexShader8Impl *object;
1047 /* Setup a stub object for now */
1048 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1049 TRACE("(%p) : pFunction(%p), ppShader(%p)\n", This, pFunction, ppShader);
1050 if (NULL == object) {
1051 FIXME("Allocation of memory failed\n");
1053 return D3DERR_OUTOFVIDEOMEMORY;
1057 object->lpVtbl = &Direct3DVertexShader8_Vtbl;
1058 /* Usage is missing ..*/
1059 hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pDeclaration, pFunction, &object->wineD3DVertexShader, (IUnknown *)object);
1062 /* free up object */
1063 FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
1064 HeapFree(GetProcessHeap(), 0, object);
1067 /* TODO: Store the VS declarations locally so that they can be derefferenced with a value higher than VS_HIGHESTFIXEDFXF */
1069 while(This->vShaders[i] != NULL && i < MAX_SHADERS) ++i;
1070 if (MAX_SHADERS == i) {
1071 FIXME("(%p) : Number of shaders exceeds the maximum number of possible shaders\n", This);
1072 hrc = E_OUTOFMEMORY;
1074 IUnknown_AddRef(iface);
1075 object->parentDevice = iface;
1076 This->vShaders[i] = object;
1077 *ppShader = i + VS_HIGHESTFIXEDFXF + 1;
1080 TRACE("(%p) : returning %p\n", This, object);
1085 HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
1086 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1087 HRESULT hrc = D3D_OK;
1089 TRACE("(%p) : Relay\n", This);
1090 if (VS_HIGHESTFIXEDFXF >= pShader) {
1091 TRACE("Setting FVF, %d %ld\n", VS_HIGHESTFIXEDFXF, pShader);
1092 IWineD3DDevice_SetFVF(This->WineD3DDevice, pShader);
1094 /* Call SetVertexShader with a NULL shader to set the vertexshader in the stateblock to NULL. */
1095 IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
1097 TRACE("Setting shader\n");
1098 if (MAX_SHADERS <= pShader - (VS_HIGHESTFIXEDFXF + 1)) {
1099 FIXME("(%p) : Number of shaders exceeds the maximum number of possible shaders\n", This);
1100 hrc = D3DERR_INVALIDCALL;
1102 IDirect3DVertexShader8Impl *shader = This->vShaders[pShader - (VS_HIGHESTFIXEDFXF + 1)];
1103 hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, 0 == shader ? NULL : shader->wineD3DVertexShader);
1106 TRACE("(%p) : returning hr(%lu)\n", This, hrc);
1111 HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) {
1112 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1113 IWineD3DVertexShader *pShader;
1114 HRESULT hrc = D3D_OK;
1116 TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice);
1117 hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
1118 if (D3D_OK == hrc) {
1121 hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader);
1122 IWineD3DVertexShader_Release(pShader);
1123 while(This->vShaders[i] != (IDirect3DVertexShader8Impl *)ppShader && i < MAX_SHADERS) ++i;
1124 if (i < MAX_SHADERS) {
1125 *ppShader = i + VS_HIGHESTFIXEDFXF + 1;
1127 WARN("(%p) : Couldn't find math for shader %p in d3d7 shadres list\n", This, (IDirect3DVertexShader8Impl *)ppShader);
1131 WARN("(%p) : The shader has been set to NULL\n", This);
1133 /* TODO: Find out what should be returned, e.g. the FVF */
1135 hrc = D3DERR_INVALIDCALL;
1138 WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %lu (device %p)\n", This, hrc, This->WineD3DDevice);
1140 TRACE("(%p) : returning %p\n", This, (IDirect3DVertexShader8 *)*ppShader);
1145 HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
1146 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1147 HRESULT hrc = D3D_OK;
1148 TRACE("(%p) Relay\n", This);
1149 if (pShader <= VS_HIGHESTFIXEDFXF) {
1150 WARN("(%p) : Caller passed a shader below the value of VS_HIGHESTFIXEDFXF\n", This);
1151 hrc = D3DERR_INVALIDCALL;
1152 } else if (MAX_SHADERS <= pShader - (VS_HIGHESTFIXEDFXF + 1)) {
1153 FIXME("(%p) : Caller passed a shader greater than the maximum number of shaders\n", This);
1154 hrc = D3DERR_INVALIDCALL;
1156 IDirect3DVertexShader8Impl *shader = This->vShaders[pShader - (VS_HIGHESTFIXEDFXF + 1)];
1157 while(IUnknown_Release((IUnknown *)shader));
1158 This->vShaders[pShader - (VS_HIGHESTFIXEDFXF + 1)] = NULL;
1165 HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, CONST void* pConstantData, DWORD ConstantCount) {
1166 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1167 TRACE("(%p) : Relay\n", This);
1169 return IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, (CONST float *)pConstantData, ConstantCount);
1172 HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, void* pConstantData, DWORD ConstantCount) {
1173 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1174 TRACE("(%p) : Relay\n", This);
1176 return IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, (float *)pConstantData, ConstantCount);
1179 HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(LPDIRECT3DDEVICE8 iface, DWORD pVertexShader, void* pData, DWORD* pSizeOfData) {
1180 IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)pVertexShader;
1182 TRACE("(%p) : Relay\n", This);
1183 /* return IWineD3DVertexShader_GetDeclaration(This->wineD3DVertexShader, pData, (UINT *)pSizeOfData); */
1184 return D3DERR_INVALIDCALL;
1186 HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pVertexShader, void* pData, DWORD* pSizeOfData) {
1187 IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)pVertexShader;
1189 TRACE("(%p) : Relay\n", This);
1190 return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, (UINT *)pSizeOfData);
1193 HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8* pIndexData, UINT baseVertexIndex) {
1194 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1195 TRACE("(%p) Relay\n", This);
1196 /* FIXME: store base vertex index properly */
1197 This->baseVertexIndex = baseVertexIndex;
1198 return IWineD3DDevice_SetIndices(This->WineD3DDevice,
1199 NULL == pIndexData ? NULL : ((IDirect3DIndexBuffer8Impl *)pIndexData)->wineD3DIndexBuffer,
1203 HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) {
1204 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1205 IWineD3DIndexBuffer *retIndexData = NULL;
1206 HRESULT rc = D3D_OK;
1209 TRACE("(%p) Relay\n", This);
1211 if(ppIndexData == NULL){
1212 return D3DERR_INVALIDCALL;
1215 rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData, &tmp);
1216 if (D3D_OK == rc && NULL != retIndexData) {
1217 IWineD3DVertexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
1218 IWineD3DVertexBuffer_Release(retIndexData);
1220 if(rc != D3D_OK) FIXME("Call to GetIndices failed\n");
1221 *ppIndexData = NULL;
1223 /* FIXME: store base vertex index properly */
1224 *pBaseVertexIndex = This->baseVertexIndex;
1227 HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(LPDIRECT3DDEVICE8 iface, CONST DWORD* pFunction, DWORD* ppShader) {
1228 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1229 IDirect3DPixelShader8Impl *object;
1230 HRESULT hrc = D3D_OK;
1232 if (NULL == ppShader) {
1233 TRACE("(%p) Invalid call\n", This);
1234 return D3DERR_INVALIDCALL;
1236 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1238 if (NULL == object) {
1239 return E_OUTOFMEMORY;
1243 object->lpVtbl = &Direct3DPixelShader8_Vtbl;
1244 hrc = IWineD3DDevice_CreatePixelShader(This->WineD3DDevice, pFunction, &object->wineD3DPixelShader , (IUnknown *)object);
1245 if (D3D_OK != hrc) {
1246 FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This);
1247 HeapFree(GetProcessHeap(), 0 , object);
1250 *ppShader = (DWORD)object;
1255 TRACE("(%p) : returning %p\n", This, (void *)*ppShader);
1259 HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
1260 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1261 IDirect3DPixelShader8Impl *shader = (IDirect3DPixelShader8Impl *)pShader;
1262 TRACE("(%p) Relay\n", This);
1264 return IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader == NULL ? NULL :shader->wineD3DPixelShader);
1267 HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) {
1268 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1269 IWineD3DPixelShader *object;
1271 HRESULT hrc = D3D_OK;
1272 TRACE("(%p) Relay\n", This);
1273 if (NULL == ppShader) {
1274 TRACE("(%p) Invalid call\n", This);
1275 return D3DERR_INVALIDCALL;
1278 hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
1279 if (D3D_OK == hrc && NULL != object) {
1280 hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader);
1281 IWineD3DPixelShader_Release(object);
1283 *ppShader = (DWORD)NULL;
1286 TRACE("(%p) : returning %p\n", This, (void *)*ppShader);
1290 HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
1291 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1292 IDirect3DPixelShader8Impl *shader = (IDirect3DPixelShader8Impl *)pShader;
1293 TRACE("(%p) Relay\n", This);
1295 if (NULL != shader) {
1296 while(IUnknown_Release((IUnknown *)shader));
1302 HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, CONST void* pConstantData, DWORD ConstantCount) {
1303 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1304 TRACE("(%p) Relay\n", This);
1306 return IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, (CONST float *)pConstantData, ConstantCount);
1309 HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, void* pConstantData, DWORD ConstantCount) {
1310 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1311 TRACE("(%p) Relay\n", This);
1313 return IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, (float *)pConstantData, ConstantCount);
1316 HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pPixelShader, void* pData, DWORD* pSizeOfData) {
1317 IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)pPixelShader;
1319 TRACE("(%p) : Relay\n", This);
1320 return IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, (UINT *)pSizeOfData);
1323 HRESULT WINAPI IDirect3DDevice8Impl_DrawRectPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
1324 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1325 TRACE("(%p) Relay\n", This);
1327 return IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, (WINED3DRECTPATCH_INFO *)pRectPatchInfo);
1330 HRESULT WINAPI IDirect3DDevice8Impl_DrawTriPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
1331 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1332 TRACE("(%p) Relay\n", This);
1334 return IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, (WINED3DTRIPATCH_INFO *)pTriPatchInfo);
1337 HRESULT WINAPI IDirect3DDevice8Impl_DeletePatch(LPDIRECT3DDEVICE8 iface, UINT Handle) {
1338 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1339 TRACE("(%p) Relay\n", This);
1341 return IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle);
1344 HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) {
1345 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1346 TRACE("(%p) Relay\n" , This);
1348 return IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber,
1349 NULL == pStreamData ? NULL : ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer,
1350 0/* Offset in bytes */, Stride);
1353 HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8** pStream,UINT* pStride) {
1354 IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
1355 IWineD3DVertexBuffer *retStream = NULL;
1356 HRESULT rc = D3D_OK;
1358 TRACE("(%p) Relay\n" , This);
1360 if(pStream == NULL){
1361 return D3DERR_INVALIDCALL;
1364 rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, (IWineD3DVertexBuffer **)&retStream, 0 /* Offset in bytes */, pStride);
1365 if (rc == D3D_OK && NULL != retStream) {
1366 IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
1367 IWineD3DVertexBuffer_Release(retStream);
1369 FIXME("Call to GetStreamSource failed %p\n", pStride);
1377 const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
1379 IDirect3DDevice8Impl_QueryInterface,
1380 IDirect3DDevice8Impl_AddRef,
1381 IDirect3DDevice8Impl_Release,
1382 IDirect3DDevice8Impl_TestCooperativeLevel,
1383 IDirect3DDevice8Impl_GetAvailableTextureMem,
1384 IDirect3DDevice8Impl_ResourceManagerDiscardBytes,
1385 IDirect3DDevice8Impl_GetDirect3D,
1386 IDirect3DDevice8Impl_GetDeviceCaps,
1387 IDirect3DDevice8Impl_GetDisplayMode,
1388 IDirect3DDevice8Impl_GetCreationParameters,
1389 IDirect3DDevice8Impl_SetCursorProperties,
1390 IDirect3DDevice8Impl_SetCursorPosition,
1391 IDirect3DDevice8Impl_ShowCursor,
1392 IDirect3DDevice8Impl_CreateAdditionalSwapChain,
1393 IDirect3DDevice8Impl_Reset,
1394 IDirect3DDevice8Impl_Present,
1395 IDirect3DDevice8Impl_GetBackBuffer,
1396 IDirect3DDevice8Impl_GetRasterStatus,
1397 IDirect3DDevice8Impl_SetGammaRamp,
1398 IDirect3DDevice8Impl_GetGammaRamp,
1399 IDirect3DDevice8Impl_CreateTexture,
1400 IDirect3DDevice8Impl_CreateVolumeTexture,
1401 IDirect3DDevice8Impl_CreateCubeTexture,
1402 IDirect3DDevice8Impl_CreateVertexBuffer,
1403 IDirect3DDevice8Impl_CreateIndexBuffer,
1404 IDirect3DDevice8Impl_CreateRenderTarget,
1405 IDirect3DDevice8Impl_CreateDepthStencilSurface,
1406 IDirect3DDevice8Impl_CreateImageSurface,
1407 IDirect3DDevice8Impl_CopyRects,
1408 IDirect3DDevice8Impl_UpdateTexture,
1409 IDirect3DDevice8Impl_GetFrontBuffer,
1410 IDirect3DDevice8Impl_SetRenderTarget,
1411 IDirect3DDevice8Impl_GetRenderTarget,
1412 IDirect3DDevice8Impl_GetDepthStencilSurface,
1413 IDirect3DDevice8Impl_BeginScene,
1414 IDirect3DDevice8Impl_EndScene,
1415 IDirect3DDevice8Impl_Clear,
1416 IDirect3DDevice8Impl_SetTransform,
1417 IDirect3DDevice8Impl_GetTransform,
1418 IDirect3DDevice8Impl_MultiplyTransform,
1419 IDirect3DDevice8Impl_SetViewport,
1420 IDirect3DDevice8Impl_GetViewport,
1421 IDirect3DDevice8Impl_SetMaterial,
1422 IDirect3DDevice8Impl_GetMaterial,
1423 IDirect3DDevice8Impl_SetLight,
1424 IDirect3DDevice8Impl_GetLight,
1425 IDirect3DDevice8Impl_LightEnable,
1426 IDirect3DDevice8Impl_GetLightEnable,
1427 IDirect3DDevice8Impl_SetClipPlane,
1428 IDirect3DDevice8Impl_GetClipPlane,
1429 IDirect3DDevice8Impl_SetRenderState,
1430 IDirect3DDevice8Impl_GetRenderState,
1431 IDirect3DDevice8Impl_BeginStateBlock,
1432 IDirect3DDevice8Impl_EndStateBlock,
1433 IDirect3DDevice8Impl_ApplyStateBlock,
1434 IDirect3DDevice8Impl_CaptureStateBlock,
1435 IDirect3DDevice8Impl_DeleteStateBlock,
1436 IDirect3DDevice8Impl_CreateStateBlock,
1437 IDirect3DDevice8Impl_SetClipStatus,
1438 IDirect3DDevice8Impl_GetClipStatus,
1439 IDirect3DDevice8Impl_GetTexture,
1440 IDirect3DDevice8Impl_SetTexture,
1441 IDirect3DDevice8Impl_GetTextureStageState,
1442 IDirect3DDevice8Impl_SetTextureStageState,
1443 IDirect3DDevice8Impl_ValidateDevice,
1444 IDirect3DDevice8Impl_GetInfo,
1445 IDirect3DDevice8Impl_SetPaletteEntries,
1446 IDirect3DDevice8Impl_GetPaletteEntries,
1447 IDirect3DDevice8Impl_SetCurrentTexturePalette,
1448 IDirect3DDevice8Impl_GetCurrentTexturePalette,
1449 IDirect3DDevice8Impl_DrawPrimitive,
1450 IDirect3DDevice8Impl_DrawIndexedPrimitive,
1451 IDirect3DDevice8Impl_DrawPrimitiveUP,
1452 IDirect3DDevice8Impl_DrawIndexedPrimitiveUP,
1453 IDirect3DDevice8Impl_ProcessVertices,
1454 IDirect3DDevice8Impl_CreateVertexShader,
1455 IDirect3DDevice8Impl_SetVertexShader,
1456 IDirect3DDevice8Impl_GetVertexShader,
1457 IDirect3DDevice8Impl_DeleteVertexShader,
1458 IDirect3DDevice8Impl_SetVertexShaderConstant,
1459 IDirect3DDevice8Impl_GetVertexShaderConstant,
1460 IDirect3DDevice8Impl_GetVertexShaderDeclaration,
1461 IDirect3DDevice8Impl_GetVertexShaderFunction,
1462 IDirect3DDevice8Impl_SetStreamSource,
1463 IDirect3DDevice8Impl_GetStreamSource,
1464 IDirect3DDevice8Impl_SetIndices,
1465 IDirect3DDevice8Impl_GetIndices,
1466 IDirect3DDevice8Impl_CreatePixelShader,
1467 IDirect3DDevice8Impl_SetPixelShader,
1468 IDirect3DDevice8Impl_GetPixelShader,
1469 IDirect3DDevice8Impl_DeletePixelShader,
1470 IDirect3DDevice8Impl_SetPixelShaderConstant,
1471 IDirect3DDevice8Impl_GetPixelShaderConstant,
1472 IDirect3DDevice8Impl_GetPixelShaderFunction,
1473 IDirect3DDevice8Impl_DrawRectPatch,
1474 IDirect3DDevice8Impl_DrawTriPatch,
1475 IDirect3DDevice8Impl_DeletePatch
1478 /* Internal function called back during the CreateDevice to create a render target */
1479 HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, UINT Width, UINT Height,
1480 WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level,
1481 IWineD3DSurface **ppSurface, HANDLE *pSharedHandle) {
1483 HRESULT res = D3D_OK;
1484 IDirect3DSurface8Impl *d3dSurface = NULL;
1485 BOOL Lockable = TRUE;
1487 if((WINED3DPOOL_DEFAULT == Pool && WINED3DUSAGE_DYNAMIC != Usage))
1491 res = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)device, Width, Height, (D3DFORMAT)Format, Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface8 **)&d3dSurface, D3DRTYPE_SURFACE, Usage, Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
1493 if (res == D3D_OK) {
1494 *ppSurface = d3dSurface->wineD3DSurface;
1496 FIXME("(%p) IDirect3DDevice8_CreateSurface failed\n", device);