wined3d: Compare resource sizes in blocks in wined3d_device_copy_resource().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-02-10 00:24:04 +01:00 committed by Alexandre Julliard
parent 6aa9eec60f
commit 1039bf036f
2 changed files with 22 additions and 11 deletions

View File

@ -28205,7 +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)
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);
if (colour != expected)

View File

@ -4541,7 +4541,9 @@ static bool resources_format_compatible(const struct wined3d_resource *src_resou
void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource)
{
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;
unsigned int i, j;
@ -4561,16 +4563,6 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
return;
}
if (src_resource->width != dst_resource->width
|| src_resource->height != dst_resource->height
|| src_resource->depth != dst_resource->depth)
{
WARN("Resource dimensions (%ux%ux%u / %ux%ux%u) don't match.\n",
dst_resource->width, dst_resource->height, dst_resource->depth,
src_resource->width, src_resource->height, src_resource->depth);
return;
}
if (!resources_format_compatible(src_resource, dst_resource))
{
WARN("Resource formats %s and %s are incompatible.\n",
@ -4579,6 +4571,24 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
return;
}
src_row_block_count = (src_resource->width + (src_resource->format->block_width - 1))
/ src_resource->format->block_width;
dst_row_block_count = (dst_resource->width + (dst_resource->format->block_width - 1))
/ dst_resource->format->block_width;
src_row_count = (src_resource->height + (src_resource->format->block_height - 1))
/ src_resource->format->block_height;
dst_row_count = (dst_resource->height + (dst_resource->format->block_height - 1))
/ dst_resource->format->block_height;
if (src_row_block_count != dst_row_block_count || src_row_count != dst_row_count
|| src_resource->depth != dst_resource->depth)
{
WARN("Resource block dimensions (%ux%ux%u / %ux%ux%u) don't match.\n",
dst_row_block_count, dst_row_count, dst_resource->depth,
src_row_block_count, src_row_count, src_resource->depth);
return;
}
if (dst_resource->type == WINED3D_RTYPE_BUFFER)
{
wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1);