render/vulkan: use correct source offset in read_pixels

This commit is contained in:
llyyr 2023-01-18 06:12:43 +05:30
parent 9c7db7124e
commit 10e16db738

View file

@ -1541,11 +1541,6 @@ static bool vulkan_read_pixels(struct wlr_renderer *wlr_renderer,
VK_ACCESS_TRANSFER_READ_BIT);
if (blit_supported) {
VkOffset3D blit_size = {
.x = width,
.y = height,
.z = 1
};
VkImageBlit image_blit_region = {
.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.srcSubresource.layerCount = 1,
@ -1553,10 +1548,17 @@ static bool vulkan_read_pixels(struct wlr_renderer *wlr_renderer,
.x = src_x,
.y = src_y,
},
.srcOffsets[1] = blit_size,
.srcOffsets[1] = {
.x = src_x + width,
.y = src_y + height,
},
.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.dstSubresource.layerCount = 1,
.dstOffsets[1] = blit_size
.dstOffsets[1] = {
.x = width,
.y = height,
.z = 1,
}
};
vkCmdBlitImage(cb, src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
dst_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,