Henri Verbeet : wined3d: Reject blits between depth/stencil and colour resources in the raw blitter.

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


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

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

wined3d: Reject blits between depth/stencil and colour resources in the raw blitter.

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

---

 dlls/d3d10core/tests/d3d10core.c |  7 ++++---
 dlls/d3d11/tests/d3d11.c         |  2 +-
 dlls/wined3d/texture.c           | 11 +++++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c
index def80870fd5..6c381f62840 100644
--- a/dlls/d3d10core/tests/d3d10core.c
+++ b/dlls/d3d10core/tests/d3d10core.c
@@ -16217,8 +16217,9 @@ static void test_format_compatibility(void)
             colour = get_readback_color(&rb, x, y);
             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);
+            todo_wine_if(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);
 
@@ -16231,7 +16232,7 @@ static void test_format_compatibility(void)
             y = j / 4;
             colour = get_readback_color(&rb, x, y);
             expected = test_data[i].success ? bitmap_data[j] : initial_data[j];
-            todo_wine_if(test_data[i].src_ds)
+            todo_wine_if(test_data[i].dst_ds || test_data[i].src_format == DXGI_FORMAT_R16_TYPELESS)
                 ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
                         i, colour, x, y, expected);
         }
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 989347ccac5..6dcc98e0ac4 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -28306,7 +28306,7 @@ 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];
-            todo_wine_if(test_data[i].src_ds || test_data[i].dst_ds)
+            todo_wine_if(!test_data[i].dst_ds && test_data[i].src_format == DXGI_FORMAT_R16_TYPELESS)
                 ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
                         i, colour, x, y, expected);
         }
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 1d1b64ad60d..24ff5874841 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -6082,12 +6082,19 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
     unsigned int src_level, src_layer, dst_level, dst_layer;
     struct wined3d_blitter *next;
     GLuint src_name, dst_name;
+    bool src_ds, dst_ds;
     DWORD location;
 
+    src_ds = src_texture->resource.format->depth_size || src_texture->resource.format->stencil_size;
+    dst_ds = dst_texture->resource.format->depth_size || dst_texture->resource.format->stencil_size;
+
     /* If we would need to copy from a renderbuffer or drawable, we'd probably
      * be better off using the FBO blitter directly, since we'd need to use it
-     * to copy the resource contents to the texture anyway. */
-    if (op != WINED3D_BLIT_OP_RAW_BLIT
+     * to copy the resource contents to the texture anyway.
+     *
+     * We also can't copy between depth/stencil and colour resources, since
+     * the formats are considered incompatible in OpenGL. */
+    if (op != WINED3D_BLIT_OP_RAW_BLIT || (src_ds != dst_ds)
             || (src_texture->resource.format->id == dst_texture->resource.format->id
             && (!(src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
             || !(dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)))))




More information about the wine-cvs mailing list