[PATCH 3/3] d3d11: Add support for returning multiple scissor rectangles.

Nikolay Sivov nsivov at codeweavers.com
Tue Apr 24 01:26:59 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d3d10core/tests/device.c | 13 ++++++------
 dlls/d3d11/device.c           | 40 +++++++++++++++++++----------------
 dlls/d3d11/tests/d3d11.c      |  6 +++---
 dlls/d3dx10_43/tests/d3dx10.c | 15 ++++++-------
 4 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index ba0a914e7e..b2aaa0dc22 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -4924,7 +4924,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
     ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
 
     ID3D10Device_RSGetScissorRects(device, &count, NULL);
-    todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
+    ok(!count, "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
     ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
@@ -5316,7 +5316,7 @@ float4 main(float4 color : COLOR) : SV_TARGET
     ID3D10DepthStencilView_Release(tmp_dsv);
 
     ID3D10Device_RSGetScissorRects(device, &count, NULL);
-    todo_wine ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
+    ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
             "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
@@ -5455,16 +5455,15 @@ float4 main(float4 color : COLOR) : SV_TARGET
     ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
 
     ID3D10Device_RSGetScissorRects(device, &count, NULL);
-    todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
+    ok(!count, "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
     ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
     for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i)
     {
-        todo_wine_if(!i)
-            ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom,
-                    "Got unexpected scissor rect %s in slot %u.\n",
-                    wine_dbgstr_rect(&tmp_rect[i]), i);
+        ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom,
+                "Got unexpected scissor rect %s in slot %u.\n",
+                wine_dbgstr_rect(&tmp_rect[i]), i);
     }
     ID3D10Device_RSGetViewports(device, &count, NULL);
     ok(!count, "Got unexpected viewport count %u.\n", count);
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index d49f08b57a..538f4af88c 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2127,23 +2127,25 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSGetScissorRects(ID3D11De
         UINT *rect_count, D3D11_RECT *rects)
 {
     struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
+    unsigned int actual_count;
 
     TRACE("iface %p, rect_count %p, rects %p.\n", iface, rect_count, rects);
 
+    if (!rect_count)
+        return;
+
+    wined3d_mutex_lock();
+    wined3d_device_get_scissor_rects(device->wined3d_device, &actual_count, rects);
+    wined3d_mutex_unlock();
+
     if (!rects)
     {
-        *rect_count = 1;
+        *rect_count = actual_count;
         return;
     }
 
-    if (!*rect_count)
-        return;
-
-    wined3d_mutex_lock();
-    wined3d_device_get_scissor_rects(device->wined3d_device, NULL, rects);
-    wined3d_mutex_unlock();
-    if (*rect_count > 1)
-        memset(&rects[1], 0, (*rect_count - 1) * sizeof(*rects));
+    if (*rect_count > actual_count)
+        memset(&rects[actual_count], 0, (*rect_count - actual_count) * sizeof(*rects));
 }
 
 static void STDMETHODCALLTYPE d3d11_immediate_context_HSGetShaderResources(ID3D11DeviceContext *iface,
@@ -4930,23 +4932,25 @@ static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device1 *iface,
 static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device1 *iface, UINT *rect_count, D3D10_RECT *rects)
 {
     struct d3d_device *device = impl_from_ID3D10Device(iface);
+    unsigned int actual_count;
 
     TRACE("iface %p, rect_count %p, rects %p.\n", iface, rect_count, rects);
 
+    if (!rect_count)
+        return;
+
+    wined3d_mutex_lock();
+    wined3d_device_get_scissor_rects(device->wined3d_device, &actual_count, rects);
+    wined3d_mutex_unlock();
+
     if (!rects)
     {
-        *rect_count = 1;
+        *rect_count = actual_count;
         return;
     }
 
-    if (!*rect_count)
-        return;
-
-    wined3d_mutex_lock();
-    wined3d_device_get_scissor_rects(device->wined3d_device, NULL, rects);
-    wined3d_mutex_unlock();
-    if (*rect_count > 1)
-        memset(&rects[1], 0, (*rect_count - 1) * sizeof(*rects));
+    if (*rect_count > actual_count)
+        memset(&rects[actual_count], 0, (*rect_count - actual_count) * sizeof(*rects));
 }
 
 static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device1 *iface)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 2f4ce25638..ba40ae5984 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9811,7 +9811,7 @@ static void test_clear_state(void)
     }
 
     ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
-    todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
+    ok(!count, "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     count = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
     ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);
@@ -10340,7 +10340,7 @@ static void test_clear_state(void)
     ID3D11UnorderedAccessView_Release(tmp_uav[i]);
 
     ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
-    todo_wine ok(count == D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
+    ok(count == D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
             "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);
@@ -10560,7 +10560,7 @@ static void test_clear_state(void)
     }
 
     ID3D11DeviceContext_RSGetScissorRects(context, &count, NULL);
-    todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count);
+    ok(!count, "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     count = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
     ID3D11DeviceContext_RSGetScissorRects(context, &count, tmp_rect);
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 0baba6550c..9c84a76e79 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -510,20 +510,19 @@ float4 main(float4 color : COLOR) : SV_TARGET
     ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv);
 
     ID3D10Device_RSGetScissorRects(device, &count, NULL);
-    todo_wine ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
+    ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
             "Got unexpected scissor rect count %u.\n", count);
     memset(tmp_rect, 0x55, sizeof(tmp_rect));
     count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
     ID3D10Device_RSGetScissorRects(device, &count, tmp_rect);
     for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i)
     {
-        todo_wine_if(i)
-            ok(tmp_rect[i].left == i
-                    && tmp_rect[i].top == i * 2
-                    && tmp_rect[i].right == i + 1
-                    && tmp_rect[i].bottom == (i + 1) * 2,
-                    "Got unexpected scissor rect %s in slot %u.\n",
-                    wine_dbgstr_rect(&tmp_rect[i]), i);
+        ok(tmp_rect[i].left == i
+                && tmp_rect[i].top == i * 2
+                && tmp_rect[i].right == i + 1
+                && tmp_rect[i].bottom == (i + 1) * 2,
+                "Got unexpected scissor rect %s in slot %u.\n",
+                wine_dbgstr_rect(&tmp_rect[i]), i);
     }
     ID3D10Device_RSGetViewports(device, &count, NULL);
     ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE,
-- 
2.17.0




More information about the wine-devel mailing list