vkd3d: Introduce vkd3d_format_get_data_offset().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet
2019-10-18 17:28:56 +03:30
committed by Alexandre Julliard
parent 7ec32ebfc5
commit 769dd2b68c
3 changed files with 17 additions and 15 deletions

View File

@@ -3065,9 +3065,8 @@ static void vk_buffer_image_copy_from_d3d12(VkBufferImageCopy *copy,
if (src_box)
{
VkDeviceSize row_count = footprint->Footprint.Height / format->block_height;
copy->bufferOffset += src_box->left / format->block_width * format->byte_count * format->block_byte_count;
copy->bufferOffset += src_box->top / format->block_height * footprint->Footprint.RowPitch;
copy->bufferOffset += src_box->front * footprint->Footprint.RowPitch * row_count;
copy->bufferOffset += vkd3d_format_get_data_offset(format, footprint->Footprint.RowPitch,
row_count * footprint->Footprint.RowPitch, src_box->left, src_box->top, src_box->front);
}
copy->bufferRowLength = footprint->Footprint.RowPitch /
(format->byte_count * format->block_byte_count) * format->block_width;
@@ -3098,10 +3097,8 @@ static void vk_image_buffer_copy_from_d3d12(VkBufferImageCopy *copy,
{
VkDeviceSize row_count = footprint->Footprint.Height / format->block_height;
copy->bufferOffset = footprint->Offset;
copy->bufferOffset += dst_x / format->block_width * format->byte_count * format->block_byte_count;
copy->bufferOffset += dst_y / format->block_height * footprint->Footprint.RowPitch;
copy->bufferOffset += dst_z * footprint->Footprint.RowPitch * row_count;
copy->bufferOffset = footprint->Offset + vkd3d_format_get_data_offset(format,
footprint->Footprint.RowPitch, row_count * footprint->Footprint.RowPitch, dst_x, dst_y, dst_z);
copy->bufferRowLength = footprint->Footprint.RowPitch /
(format->byte_count * format->block_byte_count) * format->block_width;
copy->bufferImageHeight = footprint->Footprint.Height;