=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d9: Forbid display mode and back buffer mismatch in IDirect3DDevice9Ex_ResetEx ().

Alexandre Julliard julliard at winehq.org
Wed Aug 24 12:05:17 CDT 2016


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Aug 22 14:53:50 2016 +0200

d3d9: Forbid display mode and back buffer mismatch in IDirect3DDevice9Ex_ResetEx().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/device.c       |  9 +++++++++
 dlls/d3d9/tests/d3d9ex.c | 17 ++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 097b05f..5d1d292 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3455,6 +3455,15 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *
         return D3DERR_INVALIDCALL;
     }
 
+    if (mode && (mode->Width != present_parameters->BackBufferWidth
+            || mode->Height != present_parameters->BackBufferHeight))
+    {
+        WARN("Mode and back buffer mismatch (mode %ux%u, backbuffer %ux%u).\n",
+                mode->Width, mode->Height,
+                present_parameters->BackBufferWidth, present_parameters->BackBufferHeight);
+        return D3DERR_INVALIDCALL;
+    }
+
     return d3d9_device_reset(device, present_parameters, mode);
 }
 
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 63e9a30..05f1580 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -1563,15 +1563,26 @@ static void test_reset_ex(void)
     d3dpp.BackBufferWidth = modes[i].Width - 10;
     d3dpp.BackBufferHeight = modes[i].Height - 10;
     hr = IDirect3DDevice9Ex_ResetEx(device, &d3dpp, &modes[i]);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     d3dpp.BackBufferWidth = modes[i].Width - 1;
     d3dpp.BackBufferHeight = modes[i].Height;
     hr = IDirect3DDevice9Ex_ResetEx(device, &d3dpp, &modes[i]);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     d3dpp.BackBufferWidth = modes[i].Width;
     d3dpp.BackBufferHeight = modes[i].Height - 1;
     hr = IDirect3DDevice9Ex_ResetEx(device, &d3dpp, &modes[i]);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    d3dpp.BackBufferWidth = 0;
+    d3dpp.BackBufferHeight = 0;
+    hr = IDirect3DDevice9Ex_ResetEx(device, &d3dpp, &modes[i]);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    d3dpp.BackBufferWidth = modes[i].Width;
+    d3dpp.BackBufferHeight = modes[i].Height;
+    mode2 = modes[i];
+    mode2.Width = 0;
+    mode2.Height = 0;
+    hr = IDirect3DDevice9Ex_ResetEx(device, &d3dpp, &mode2);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
     hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
     ok(hr == D3D_OK, "Got unexpected cooperative level %#x.\n", hr);
 




More information about the wine-cvs mailing list