From fb9ec02e0664c16de9846b15f95093c4cf66afc4 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 10 Feb 2021 00:24:05 +0100 Subject: [PATCH] wined3d: Construct a separate source box in wined3d_device_copy_resource(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/tests/d3d11.c | 6 ++---- dlls/wined3d/device.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 21543cd224c..fddb7bfd218 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -28205,10 +28205,8 @@ static void test_compressed_format_compatibility(const D3D_FEATURE_LEVEL feature expected = texture_data[k]; else expected = initial_data[k]; - todo_wine_if(supported && (dst_format->block_edge != 1 - || k >= src_format->block_size / (sizeof(colour)))) - ok(colour == expected, "%#x -> %#x: Got unexpected colour 0x%08x at %u, expected 0x%08x.\n", - src_format->id, dst_format->id, colour, k, expected); + ok(colour == expected, "%#x -> %#x: Got unexpected colour 0x%08x at %u, expected 0x%08x.\n", + src_format->id, dst_format->id, colour, k, expected); if (colour != expected) break; } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index df0f9721e4a..a400221ee30 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4544,7 +4544,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, unsigned int src_row_block_count, dst_row_block_count; struct wined3d_texture *dst_texture, *src_texture; unsigned int src_row_count, dst_row_count; - struct wined3d_box box; + struct wined3d_box src_box, dst_box; unsigned int i, j; TRACE("device %p, dst_resource %p, src_resource %p.\n", device, dst_resource, src_resource); @@ -4591,9 +4591,9 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, if (dst_resource->type == WINED3D_RTYPE_BUFFER) { - wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1); - wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &box, - src_resource, 0, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT); + wined3d_box_set(&src_box, 0, 0, src_resource->size, 1, 0, 1); + wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &src_box, + src_resource, 0, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT); return; } @@ -4611,13 +4611,14 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, for (i = 0; i < dst_texture->level_count; ++i) { - wined3d_texture_get_level_box(dst_texture, i, &box); + wined3d_texture_get_level_box(src_texture, i, &src_box); + wined3d_texture_get_level_box(dst_texture, i, &dst_box); for (j = 0; j < dst_texture->layer_count; ++j) { unsigned int idx = j * dst_texture->level_count + i; - wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &box, - src_resource, idx, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT); + wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &dst_box, + src_resource, idx, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT); } } }