diff --git a/vulkan/command_buffer.cpp b/vulkan/command_buffer.cpp index eafb52ee..a55f0521 100644 --- a/vulkan/command_buffer.cpp +++ b/vulkan/command_buffer.cpp @@ -2220,19 +2220,19 @@ void *CommandBuffer::update_image(const Image &image, const VkOffset3D &offset, uint32_t height = image.get_height(subresource.mipLevel); uint32_t depth = image.get_depth(subresource.mipLevel); - if (!row_length) - row_length = width; - - if (!image_height) - image_height = height; - if ((subresource.aspectMask & (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT)) != 0) { - format_ycbcr_downsample_dimensions(create_info.format, subresource.aspectMask, row_length, image_height); + format_ycbcr_downsample_dimensions(create_info.format, subresource.aspectMask, width, height); } + if (!row_length) + row_length = width; + + if (!image_height) + image_height = height; + uint32_t blocks_x = row_length; uint32_t blocks_y = image_height; format_num_blocks(create_info.format, blocks_x, blocks_y);