Stefan Dösinger : d3d8: Disallow z buffers smaller than the color buffer.

Alexandre Julliard julliard at winehq.org
Mon Mar 14 14:29:36 CDT 2011


Module: wine
Branch: master
Commit: 733f81ef7428e7cb9fe76671f8a56278cdaee867
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=733f81ef7428e7cb9fe76671f8a56278cdaee867

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Mar 11 22:21:15 2011 +0100

d3d8: Disallow z buffers smaller than the color buffer.

---

 dlls/d3d8/device.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 0a3c9c8..9383173 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1032,6 +1032,24 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa
 
     wined3d_mutex_lock();
 
+    if (pZSurface)
+    {
+        struct wined3d_resource_desc ds_desc, rt_desc;
+        struct wined3d_resource *wined3d_resource;
+
+        wined3d_resource = IWineD3DSurface_GetResource(pZSurface->wineD3DSurface);
+        wined3d_resource_get_desc(wined3d_resource, &ds_desc);
+        wined3d_resource = IWineD3DSurface_GetResource(pSurface->wineD3DSurface);
+        wined3d_resource_get_desc(wined3d_resource, &rt_desc);
+
+        if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
+        {
+            WARN("Depth stencil is smaller than the render target, returning D3DERR_INVALIDCALL\n");
+            wined3d_mutex_unlock();
+            return D3DERR_INVALIDCALL;
+        }
+    }
+
     hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds);
     if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
     {




More information about the wine-cvs mailing list