From 4bea653504af02e900908800c3dfaed370d5c1fb Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 24 Feb 2022 11:36:49 +0100 Subject: [PATCH] vkd3d: Fix CopyTiles for suballocated linear resources. Forgot to offset buffer offset. Fun! Found when bumping VA allocation limit to 2 MiB instead of 1 MiB. Signed-off-by: Hans-Kristian Arntzen --- libs/vkd3d/command.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index d65b73c0..fabde7cc 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -6568,7 +6568,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if buffer_image_copy.sType = VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR; buffer_image_copy.pNext = NULL; - buffer_image_copy.bufferOffset = buffer_offset + VKD3D_TILE_SIZE * i; + buffer_image_copy.bufferOffset = buffer_offset + VKD3D_TILE_SIZE * i + linear_res->mem.offset; buffer_image_copy.imageSubresource = vk_subresource_layers_from_subresource(®ion->subresource); buffer_image_copy.imageOffset = region->offset; buffer_image_copy.imageExtent = region->extent; @@ -6624,13 +6624,13 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if if (copy_to_buffer) { - buffer_copy.srcOffset = VKD3D_TILE_SIZE * region_coord->X; - buffer_copy.dstOffset = buffer_offset; + buffer_copy.srcOffset = VKD3D_TILE_SIZE * region_coord->X + tiled_res->mem.offset; + buffer_copy.dstOffset = buffer_offset + linear_res->mem.offset; } else { - buffer_copy.srcOffset = buffer_offset; - buffer_copy.dstOffset = VKD3D_TILE_SIZE * region_coord->X; + buffer_copy.srcOffset = buffer_offset + linear_res->mem.offset; + buffer_copy.dstOffset = VKD3D_TILE_SIZE * region_coord->X + tiled_res->mem.offset; } copy_info.sType = VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR;