From 694efd7c6fd557a9c761b805122dc9d5fad1c69d Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Mon, 6 Feb 2006 20:57:42 +0100 Subject: [PATCH] wined3d: Texture fixes. Set video memory capabilities, add some checks to SetTexture and update some comments. --- dlls/wined3d/device.c | 11 +++++++++++ dlls/wined3d/directx.c | 4 +++- dlls/wined3d/surface.c | 10 ++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d98933c3493..635dd5b0de8 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4436,6 +4436,17 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage, return D3DERR_INVALIDCALL; } + if(pTexture != NULL) { + /* SetTexture isn't allowed on textures in D3DPOOL_SCRATCH; The same is + * the case for D3DPOOL_SYSTEMMEM textures unless D3DDEVCAPS_TEXTURESYSTEMMORY is set. + * We don't check the caps as GetDeviceCaps is inefficient and we don't set the cap anyway. + */ + if(((IWineD3DTextureImpl*)pTexture)->resource.pool == D3DPOOL_SCRATCH || ((IWineD3DTextureImpl*)pTexture)->resource.pool == D3DPOOL_SYSTEMMEM) { + WARN("(%p) Attempt to set scratch texture rejected\n", pTexture); + return D3DERR_INVALIDCALL; + } + } + oldTexture = This->updateStateBlock->textures[Stage]; TRACE("GL_LIMITS %d\n",GL_LIMITS(textures)); TRACE("(%p) : oldtexture(%p)\n", This,oldTexture); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 01b4103706f..f117f6f88bf 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1456,8 +1456,10 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT *pCaps->DevCaps = D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_HWTRANSFORMANDLIGHT | + D3DDEVCAPS_EXECUTEVIDEOMEMORY | D3DDEVCAPS_PUREDEVICE | - D3DDEVCAPS_HWRASTERIZATION; + D3DDEVCAPS_HWRASTERIZATION | + D3DDEVCAPS_TEXTUREVIDEOMEMORY; *pCaps->PrimitiveMiscCaps = D3DPMISCCAPS_CULLCCW | diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 06d5a895b46..0c928a53038 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -912,8 +912,14 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) { This->Dirty = FALSE; - /* Resources are placed in system RAM and do not need to be recreated when a device is lost. These resources are not bound by device size or format restrictions. Because of this, these resources cannot be accessed by the Direct3D device nor set as textures or render targets. However, these resources can always be created, locked, and copied. */ - if (This->resource.pool == D3DPOOL_SCRATCH || This->resource.pool == D3DPOOL_SYSTEMMEM) /*never store scratch or system mem textures in the video ram*/ + /* Resources are placed in system RAM and do not need to be recreated when a device is lost. + * These resources are not bound by device size or format restrictions. Because of this, + * these resources cannot be accessed by the Direct3D device nor set as textures or render targets. + * However, these resources can always be created, locked, and copied. + * In general never store scratch or system mem textures in the video ram. However it is allowed + * for system memory textures when D3DDEVCAPS_TEXTURESYSTEMMEMORY is set but it isn't right now. + */ + if (This->resource.pool == D3DPOOL_SCRATCH || This->resource.pool == D3DPOOL_SYSTEMMEM) { FIXME("(%p) Operation not supported for scratch or SYSTEMMEM textures\n",This); return D3DERR_INVALIDCALL; -- 2.11.4.GIT