Henri Verbeet : d3d11/tests: Add some tests for copying between depth/stencil and colour formats.

Alexandre Julliard julliard at winehq.org
Thu May 6 14:56:19 CDT 2021


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu May  6 16:59:16 2021 +0200

d3d11/tests: Add some tests for copying between depth/stencil and colour formats.

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

---

 dlls/d3d11/tests/d3d11.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index df13d446de5..989347ccac5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -28184,6 +28184,8 @@ static void test_format_compatibility(void)
         DXGI_FORMAT dst_format;
         size_t texel_size;
         BOOL success;
+        BOOL src_ds;
+        BOOL dst_ds;
     }
     test_data[] =
     {
@@ -28213,6 +28215,10 @@ static void test_format_compatibility(void)
         {DXGI_FORMAT_R32G32_FLOAT,        DXGI_FORMAT_R32G32_UINT,         8, TRUE},
         {DXGI_FORMAT_R32G32_UINT,         DXGI_FORMAT_R32G32_SINT,         8, TRUE},
         {DXGI_FORMAT_R32G32_SINT,         DXGI_FORMAT_R32G32_TYPELESS,     8, TRUE},
+        {DXGI_FORMAT_D16_UNORM,           DXGI_FORMAT_R16_UNORM,           2, TRUE,  TRUE},
+        {DXGI_FORMAT_R16_UNORM,           DXGI_FORMAT_D16_UNORM,           2, TRUE,  FALSE, TRUE},
+        {DXGI_FORMAT_R16_TYPELESS,        DXGI_FORMAT_R16_TYPELESS,        2, TRUE,  TRUE},
+        {DXGI_FORMAT_R16_TYPELESS,        DXGI_FORMAT_R16_TYPELESS,        2, TRUE,  FALSE, TRUE},
     };
     static const DWORD initial_data[16] = {0};
     static const DWORD bitmap_data[] =
@@ -28235,7 +28241,6 @@ static void test_format_compatibility(void)
     texture_desc.ArraySize = 1;
     texture_desc.SampleDesc.Count = 1;
     texture_desc.SampleDesc.Quality = 0;
-    texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
     texture_desc.CPUAccessFlags = 0;
     texture_desc.MiscFlags = 0;
 
@@ -28247,7 +28252,8 @@ static void test_format_compatibility(void)
 
         texture_desc.Width = sizeof(bitmap_data) / (texture_desc.Height * test_data[i].texel_size);
         texture_desc.Format = test_data[i].src_format;
-        texture_desc.Usage = D3D11_USAGE_IMMUTABLE;
+        texture_desc.Usage = test_data[i].src_ds ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
+        texture_desc.BindFlags = test_data[i].src_ds ? D3D11_BIND_DEPTH_STENCIL : D3D11_BIND_SHADER_RESOURCE;
 
         resource_data.pSysMem = bitmap_data;
         resource_data.SysMemPitch = texture_desc.Width * test_data[i].texel_size;
@@ -28258,6 +28264,7 @@ static void test_format_compatibility(void)
 
         texture_desc.Format = test_data[i].dst_format;
         texture_desc.Usage = D3D11_USAGE_DEFAULT;
+        texture_desc.BindFlags = test_data[i].dst_ds ? D3D11_BIND_DEPTH_STENCIL : D3D11_BIND_SHADER_RESOURCE;
 
         resource_data.pSysMem = initial_data;
 
@@ -28282,10 +28289,11 @@ static void test_format_compatibility(void)
             x = j % 4;
             y = j / 4;
             colour = get_readback_color(&rb, x, y, 0);
-            expected = test_data[i].success && x >= texel_dwords && y
-                    ? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
-            ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
-                    i, colour, x, y, expected);
+            expected = test_data[i].success && !test_data[i].src_ds && !test_data[i].dst_ds
+                    && x >= texel_dwords && y ? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
+            todo_wine_if((test_data[i].src_ds || test_data[i].dst_ds) && colour)
+                ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
+                        i, colour, x, y, expected);
         }
         release_resource_readback(&rb);
 
@@ -28298,8 +28306,9 @@ static void test_format_compatibility(void)
             y = j / 4;
             colour = get_readback_color(&rb, x, y, 0);
             expected = test_data[i].success ? bitmap_data[j] : initial_data[j];
-            ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
-                    i, colour, x, y, expected);
+            todo_wine_if(test_data[i].src_ds || test_data[i].dst_ds)
+                ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
+                        i, colour, x, y, expected);
         }
         release_resource_readback(&rb);
 




More information about the wine-cvs mailing list