wined3d: Allow resource copies between block-compatible formats.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
281f8ed4a5
commit
02385a4042
|
@ -27928,7 +27928,6 @@ static void test_format_compatibility(void)
|
||||||
colour = get_readback_color(&rb, x, y, 0);
|
colour = get_readback_color(&rb, x, y, 0);
|
||||||
expected = test_data[i].success && x >= texel_dwords && y
|
expected = test_data[i].success && x >= texel_dwords && y
|
||||||
? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
|
? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
|
||||||
todo_wine_if(test_data[i].src_format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP && expected)
|
|
||||||
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
|
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
|
||||||
i, colour, x, y, expected);
|
i, colour, x, y, expected);
|
||||||
}
|
}
|
||||||
|
@ -27943,7 +27942,6 @@ static void test_format_compatibility(void)
|
||||||
y = j / 4;
|
y = j / 4;
|
||||||
colour = get_readback_color(&rb, x, y, 0);
|
colour = get_readback_color(&rb, x, y, 0);
|
||||||
expected = test_data[i].success ? bitmap_data[j] : initial_data[j];
|
expected = test_data[i].success ? bitmap_data[j] : initial_data[j];
|
||||||
todo_wine_if(test_data[i].src_format == DXGI_FORMAT_R9G9B9E5_SHAREDEXP && expected)
|
|
||||||
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
|
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
|
||||||
i, colour, x, y, expected);
|
i, colour, x, y, expected);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4520,6 +4520,24 @@ void CDECL wined3d_device_copy_uav_counter(struct wined3d_device *device,
|
||||||
wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav);
|
wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool resources_format_compatible(const struct wined3d_resource *src_resource,
|
||||||
|
const struct wined3d_resource *dst_resource)
|
||||||
|
{
|
||||||
|
if (src_resource->format->id == dst_resource->format->id)
|
||||||
|
return true;
|
||||||
|
if (src_resource->format->typeless_id && src_resource->format->typeless_id == dst_resource->format->typeless_id)
|
||||||
|
return true;
|
||||||
|
if (src_resource->device->feature_level < WINED3D_FEATURE_LEVEL_10_1)
|
||||||
|
return false;
|
||||||
|
if ((src_resource->format_flags & WINED3DFMT_FLAG_BLOCKS)
|
||||||
|
&& (dst_resource->format_flags & WINED3DFMT_FLAG_CAST_TO_BLOCK))
|
||||||
|
return src_resource->format->block_byte_count == dst_resource->format->byte_count;
|
||||||
|
if ((src_resource->format_flags & WINED3DFMT_FLAG_CAST_TO_BLOCK)
|
||||||
|
&& (dst_resource->format_flags & WINED3DFMT_FLAG_BLOCKS))
|
||||||
|
return src_resource->format->byte_count == dst_resource->format->block_byte_count;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
||||||
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource)
|
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource)
|
||||||
{
|
{
|
||||||
|
@ -4553,8 +4571,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_resource->format->typeless_id != dst_resource->format->typeless_id
|
if (!resources_format_compatible(src_resource, dst_resource))
|
||||||
|| (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
|
|
||||||
{
|
{
|
||||||
WARN("Resource formats %s and %s are incompatible.\n",
|
WARN("Resource formats %s and %s are incompatible.\n",
|
||||||
debug_d3dformat(dst_resource->format->id),
|
debug_d3dformat(dst_resource->format->id),
|
||||||
|
@ -4616,8 +4633,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_resource->format->typeless_id != dst_resource->format->typeless_id
|
if (!resources_format_compatible(src_resource, dst_resource))
|
||||||
|| (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
|
|
||||||
{
|
{
|
||||||
WARN("Resource formats %s and %s are incompatible.\n",
|
WARN("Resource formats %s and %s are incompatible.\n",
|
||||||
debug_d3dformat(dst_resource->format->id),
|
debug_d3dformat(dst_resource->format->id),
|
||||||
|
|
|
@ -343,6 +343,24 @@ static const struct wined3d_format_base_flags format_base_flags[] =
|
||||||
{WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION},
|
{WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION},
|
||||||
{WINED3DFMT_ATOC, WINED3DFMT_FLAG_EXTENSION},
|
{WINED3DFMT_ATOC, WINED3DFMT_FLAG_EXTENSION},
|
||||||
{WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION},
|
{WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION},
|
||||||
|
{WINED3DFMT_R32G32B32A32_TYPELESS, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32B32A32_FLOAT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32B32A32_UINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32B32A32_SINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_TYPELESS, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_FLOAT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_UNORM, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_UINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_SNORM, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R16G16B16A16_SINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32_TYPELESS, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32_FLOAT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32_UINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32G32_SINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32_TYPELESS, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32_UINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
|
{WINED3DFMT_R32_SINT, WINED3DFMT_FLAG_CAST_TO_BLOCK},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
|
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
|
||||||
|
@ -599,6 +617,7 @@ static const struct wined3d_format_block_info format_block_info[] =
|
||||||
{WINED3DFMT_ATI2N, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
{WINED3DFMT_ATI2N, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
||||||
{WINED3DFMT_YUY2, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
{WINED3DFMT_YUY2, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
||||||
{WINED3DFMT_UYVY, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
{WINED3DFMT_UYVY, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
|
||||||
|
{WINED3DFMT_R9G9B9E5_SHAREDEXP, 1, 1, 4},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wined3d_format_vertex_info
|
struct wined3d_format_vertex_info
|
||||||
|
|
|
@ -5713,6 +5713,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
|
||||||
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
|
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
|
||||||
#define WINED3DFMT_FLAG_BLIT 0x02000000
|
#define WINED3DFMT_FLAG_BLIT 0x02000000
|
||||||
#define WINED3DFMT_FLAG_MAPPABLE 0x04000000
|
#define WINED3DFMT_FLAG_MAPPABLE 0x04000000
|
||||||
|
#define WINED3DFMT_FLAG_CAST_TO_BLOCK 0x08000000
|
||||||
|
|
||||||
struct wined3d_rational
|
struct wined3d_rational
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue