From: Mikko Rasa Date: Tue, 25 Jan 2022 18:14:17 +0000 (+0200) Subject: Align staging memory with an alignment suitable for image transfers X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e9d24b3844110f8a545083bb0acbc504737aca88;p=libs%2Fgl.git Align staging memory with an alignment suitable for image transfers The source data needs to be aligned at a multiple of the texel size. 48 bytes is divisible by almost all possible pixel sizes. --- diff --git a/source/backends/vulkan/transferqueue.cpp b/source/backends/vulkan/transferqueue.cpp index 4ad50d86..f6f3c6f5 100644 --- a/source/backends/vulkan/transferqueue.cpp +++ b/source/backends/vulkan/transferqueue.cpp @@ -27,7 +27,8 @@ void TransferQueue::allocate_staging(PendingTransfer &transfer, size_t size) transfer.size = size; transfer.staging_address = static_cast(i->mapped_address)+transfer.offset; - i->used += size; + i->used += size+47; + i->used -= i->used%48; ++i->async_count; }