mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Clamp buffer image copy size to subresource dimensions.
This fixes a vulkan validation error. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1eb7eca411
commit
832f47edd3
@ -3091,17 +3091,24 @@ static void vk_buffer_image_copy_from_d3d12(VkBufferImageCopy *copy,
|
|||||||
copy->imageOffset.x = dst_x;
|
copy->imageOffset.x = dst_x;
|
||||||
copy->imageOffset.y = dst_y;
|
copy->imageOffset.y = dst_y;
|
||||||
copy->imageOffset.z = dst_z;
|
copy->imageOffset.z = dst_z;
|
||||||
|
|
||||||
|
vk_extent_3d_from_d3d12_miplevel(©->imageExtent, image_desc,
|
||||||
|
copy->imageSubresource.mipLevel);
|
||||||
|
copy->imageExtent.width -= copy->imageOffset.x;
|
||||||
|
copy->imageExtent.height -= copy->imageOffset.y;
|
||||||
|
copy->imageExtent.depth -= copy->imageOffset.z;
|
||||||
|
|
||||||
if (src_box)
|
if (src_box)
|
||||||
{
|
{
|
||||||
copy->imageExtent.width = src_box->right - src_box->left;
|
copy->imageExtent.width = min(copy->imageExtent.width, src_box->right - src_box->left);
|
||||||
copy->imageExtent.height = src_box->bottom - src_box->top;
|
copy->imageExtent.height = min(copy->imageExtent.height, src_box->bottom - src_box->top);
|
||||||
copy->imageExtent.depth = src_box->back - src_box->front;
|
copy->imageExtent.depth = min(copy->imageExtent.depth, src_box->back - src_box->front);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy->imageExtent.width = footprint->Footprint.Width;
|
copy->imageExtent.width = min(copy->imageExtent.width, footprint->Footprint.Width);
|
||||||
copy->imageExtent.height = footprint->Footprint.Height;
|
copy->imageExtent.height = min(copy->imageExtent.height, footprint->Footprint.Height);
|
||||||
copy->imageExtent.depth = footprint->Footprint.Depth;
|
copy->imageExtent.depth = min(copy->imageExtent.depth, footprint->Footprint.Depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user