Roderick Colenbrander : wined3d: Texture fixes.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 6 15:01:01 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 694efd7c6fd557a9c761b805122dc9d5fad1c69d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=694efd7c6fd557a9c761b805122dc9d5fad1c69d

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Mon Feb  6 20:57:42 2006 +0100

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 d98933c..635dd5b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4436,6 +4436,17 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTex
         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 01b4103..f117f6f 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1456,8 +1456,10 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCap
 
     *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 06d5a89..0c928a5 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -912,8 +912,14 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadT
 
     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;




More information about the wine-cvs mailing list