diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index b690f94af92..43bdec02c0d 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -28182,9 +28182,8 @@ static void test_compressed_format_compatibility(const D3D_FEATURE_LEVEL feature expected = texture_data[k - ((row_block_count + 1) * dst_format->block_size) / sizeof(colour)]; else expected = initial_data[k]; - todo_wine_if(supported && x == 1 && y == 1) - 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 ac8d5d78b61..25ef0d1c016 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4694,6 +4694,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev struct wined3d_texture *dst_texture = texture_from_resource(dst_resource); struct wined3d_texture *src_texture = texture_from_resource(src_resource); unsigned int src_level = src_sub_resource_idx % src_texture->level_count; + unsigned int src_row_block_count, src_row_count; if (dst_sub_resource_idx >= dst_texture->level_count * dst_texture->layer_count) { @@ -4741,8 +4742,23 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } - wined3d_box_set(&dst_box, dst_x, dst_y, dst_x + (src_box->right - src_box->left), - dst_y + (src_box->bottom - src_box->top), dst_z, dst_z + (src_box->back - src_box->front)); + if (src_resource->format->block_width == dst_resource->format->block_width + && src_resource->format->block_height == dst_resource->format->block_height) + { + wined3d_box_set(&dst_box, dst_x, dst_y, dst_x + (src_box->right - src_box->left), + dst_y + (src_box->bottom - src_box->top), dst_z, dst_z + (src_box->back - src_box->front)); + } + else + { + src_row_block_count = (src_box->right - src_box->left + src_resource->format->block_width - 1) + / src_resource->format->block_width; + src_row_count = (src_box->bottom - src_box->top + src_resource->format->block_height - 1) + / src_resource->format->block_height; + wined3d_box_set(&dst_box, dst_x, dst_y, + dst_x + (src_row_block_count * dst_resource->format->block_width), + dst_y + (src_row_count * dst_resource->format->block_height), + dst_z, dst_z + (src_box->back - src_box->front)); + } if (FAILED(wined3d_texture_check_box_dimensions(dst_texture, dst_sub_resource_idx % dst_texture->level_count, &dst_box))) {