gsk/vulkanimage: Set buffer row length and height
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 23 Mar 2023 02:01:10 +0000 (23:01 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 3 Apr 2023 13:59:45 +0000 (10:59 -0300)
This doesn't make any difference now, but will allow us to copy
subregions more easily. This is not obvious, but here's a quick
explanation:

Leaving 'bufferRowLength' and 'bufferImageHeight' implies that
Vulkan will assume the size passed in the 'imageExtent' field.
Right now, this assumption is correct - the only user of this
function is the glyph cache, and it only copies and uploads
exact rects. Next commits will change that assumption, so we
must pass 'buffer*' fields, and tell Vulkan, "this part of the
buffer represents an image of width x height, and I want the
subregion (x, y, smallerWidth, smallerHeight) of this image".

gsk/vulkan/gskvulkanimage.c

index 102d5281bc2c43b189a51ef5ddb3176d7d5af5f8..075e2501f40c8d3d344821d2d52710f7d98bfa44 100644 (file)
@@ -722,6 +722,8 @@ gsk_vulkan_image_upload_regions (GskVulkanImage    *self,
         }
 
       bufferImageCopy[i].bufferOffset = offset;
+      bufferImageCopy[i].bufferRowLength = regions[i].width;
+      bufferImageCopy[i].bufferImageHeight = regions[i].height;
       bufferImageCopy[i].imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
       bufferImageCopy[i].imageSubresource.mipLevel = 0;
       bufferImageCopy[i].imageSubresource.baseArrayLayer = 0;