Commit b8a5f809 authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

wined3d: Check slice pitch against its size in wined3d_format_copy_data().

If they don't match and there's more than one slice to copy, we can't use a single memcpy. Fixes blinking objects in Hellblade: Senua's Sacrifice. Signed-off-by: 's avatarJan Sikorski <jsikorski@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4ece7d40
......@@ -5981,17 +5981,19 @@ void wined3d_format_copy_data(const struct wined3d_format *format, const uint8_t
unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
{
unsigned int row_block_count, row_count, row_size, slice, row;
unsigned int slice_count = d;
unsigned int slice_count = d, slice_size;
const uint8_t *src_row;
uint8_t *dst_row;
row_block_count = (w + format->block_width - 1) / format->block_width;
row_count = (h + format->block_height - 1) / format->block_height;
row_size = row_block_count * format->block_byte_count;
slice_size = row_size * row_count;
if (src_row_pitch == row_size && dst_row_pitch == row_size && src_slice_pitch == dst_slice_pitch)
if (src_row_pitch == row_size && dst_row_pitch == row_size
&& ((src_slice_pitch == slice_size && dst_slice_pitch == slice_size) || slice_count == 1))
{
memcpy(dst, src, slice_count * row_count * row_size);
memcpy(dst, src, slice_count * slice_size);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment