render/vulkan: use initializer for VkBufferImageCopy

Missed that one it seems.
This commit is contained in:
Simon Ser 2022-11-08 16:05:23 +01:00 committed by Simon Zeni
parent d112c2d922
commit e1ba64c4b7

View file

@ -105,24 +105,25 @@ static bool write_pixels(struct wlr_vk_texture *texture,
} }
} }
VkBufferImageCopy copy;
copy.imageExtent.width = width;
copy.imageExtent.height = height;
copy.imageExtent.depth = 1;
copy.imageOffset.x = dst_x;
copy.imageOffset.y = dst_y;
copy.imageOffset.z = 0;
copy.bufferOffset = buf_off;
copy.bufferRowLength = width;
copy.bufferImageHeight = height;
copy.imageSubresource.mipLevel = 0;
copy.imageSubresource.baseArrayLayer = 0;
copy.imageSubresource.layerCount = 1;
copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
assert((uint32_t)(map - (char *)vmap) == bsize); assert((uint32_t)(map - (char *)vmap) == bsize);
vkUnmapMemory(dev, span.buffer->memory); vkUnmapMemory(dev, span.buffer->memory);
VkBufferImageCopy copy = {
.imageExtent.width = width,
.imageExtent.height = height,
.imageExtent.depth = 1,
.imageOffset.x = dst_x,
.imageOffset.y = dst_y,
.imageOffset.z = 0,
.bufferOffset = buf_off,
.bufferRowLength = width,
.bufferImageHeight = height,
.imageSubresource.mipLevel = 0,
.imageSubresource.baseArrayLayer = 0,
.imageSubresource.layerCount = 1,
.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
};
vkCmdCopyBufferToImage(cb, span.buffer->buffer, texture->image, vkCmdCopyBufferToImage(cb, span.buffer->buffer, texture->image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &copy); VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &copy);
vulkan_change_layout(cb, texture->image, vulkan_change_layout(cb, texture->image,