vk: Allocate enough scratch memory for GPU deswizzle

- Forgot to take alignment into account.
This commit is contained in:
kd-11 2021-07-26 19:14:18 +03:00 committed by kd-11
parent 13abe785a9
commit abd8bbd6ef

View file

@ -968,7 +968,9 @@ namespace vk
{
if (!scratch_buf)
{
scratch_buf = vk::get_scratch_buffer(image_linear_size * 2);
// Calculate enough scratch memory. We need 2x the size of layer 0 to fit all the mip levels and an extra 128 bytes per level as alignment overhead.
const auto scratch_buf_size = 128u * ::size32(subresource_layout) + image_linear_size + image_linear_size;
scratch_buf = vk::get_scratch_buffer(scratch_buf_size);
buffer_copies.reserve(subresource_layout.size());
}