From 10e16db73879d42cd8f381cc54eb990ace3d9219 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 18 Jan 2023 06:12:43 +0530 Subject: render/vulkan: use correct source offset in read_pixels --- render/vulkan/renderer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'render') diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index dfdc13cd..564da5d1 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -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, -- cgit v1.2.3