Nikolay Sivov : d3d11: Add support for returning multiple scissor rectangles.

Alexandre Julliard julliard at winehq.org
Thu Apr 26 16:18:17 CDT 2018


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr 26 10:58:40 2018 +0300

d3d11: Add support for returning multiple scissor rectangles.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 3fdac8c..55b3977 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 d49f08b..538f4af 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 1a0634f..465e2d5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9808,7 +9808,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);
@@ -10337,7 +10337,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);
@@ -10557,7 +10557,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 0baba65..9c84a76 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,




More information about the wine-cvs mailing list