=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d8: Reject FBs with mismatching multisample settings.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 10 10:09:19 CDT 2015


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jun  9 22:48:16 2015 +0200

d3d8: Reject FBs with mismatching multisample settings.

---

 dlls/d3d8/device.c       |  8 ++++++++
 dlls/d3d8/tests/visual.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 10c2103..26cc9ac 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1185,6 +1185,14 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
             wined3d_mutex_unlock();
             return D3DERR_INVALIDCALL;
         }
+        if (ds_desc.multisample_type != rt_desc.multisample_type
+                || ds_desc.multisample_quality != rt_desc.multisample_quality)
+        {
+            WARN("Multisample settings do not match, returing D3DERR_INVALIDCALL\n");
+            wined3d_mutex_unlock();
+            return D3DERR_INVALIDCALL;
+
+        }
     }
 
     original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device);
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 41165a7..c180dfe 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -6855,6 +6855,52 @@ done:
     DestroyWindow(window);
 }
 
+static void test_multisample_mismatch(void)
+{
+    IDirect3DDevice8 *device;
+    IDirect3D8 *d3d;
+    HWND window;
+    HRESULT hr;
+    ULONG refcount;
+    IDirect3DSurface8 *rt_multi, *ds;
+
+    window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+            0, 0, 640, 480, NULL, NULL, NULL, NULL);
+    d3d = Direct3DCreate8(D3D_SDK_VERSION);
+    ok(!!d3d, "Failed to create a D3D object.\n");
+    if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+            D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES)))
+    {
+        skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisample mismatch test.\n");
+        IDirect3D8_Release(d3d);
+        return;
+    }
+
+    if (!(device = create_device(d3d, window, window, TRUE)))
+    {
+        skip("Failed to create a D3D device, skipping tests.\n");
+        goto done;
+    }
+
+    hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
+            D3DMULTISAMPLE_2_SAMPLES, FALSE, &rt_multi);
+    ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
+    hr = IDirect3DDevice8_GetDepthStencilSurface(device, &ds);
+    ok(SUCCEEDED(hr), "Failed to get original depth/stencil, hr %#x.\n", hr);
+
+    hr = IDirect3DDevice8_SetRenderTarget(device, rt_multi, ds);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+
+    IDirect3DSurface8_Release(ds);
+    IDirect3DSurface8_Release(rt_multi);
+
+    refcount = IDirect3DDevice8_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+done:
+    IDirect3D8_Release(d3d);
+    DestroyWindow(window);
+}
+
 START_TEST(visual)
 {
     D3DADAPTER_IDENTIFIER8 identifier;
@@ -6911,4 +6957,5 @@ START_TEST(visual)
     test_table_fog_zw();
     test_signed_formats();
     test_pointsize();
+    test_multisample_mismatch();
 }




More information about the wine-cvs mailing list