]> git.tdb.fi Git - libs/gl.git/commitdiff
Align staging memory with an alignment suitable for image transfers
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Jan 2022 18:14:17 +0000 (20:14 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Jan 2022 18:49:11 +0000 (20:49 +0200)
The source data needs to be aligned at a multiple of the texel size.  48
bytes is divisible by almost all possible pixel sizes.

source/backends/vulkan/transferqueue.cpp

index 4ad50d860f126952ad4024c6d9208cd05149f055..f6f3c6f5079f2c2a01812348616d8b1fb83ef367 100644 (file)
@@ -27,7 +27,8 @@ void TransferQueue::allocate_staging(PendingTransfer &transfer, size_t size)
        transfer.size = size;
        transfer.staging_address = static_cast<char *>(i->mapped_address)+transfer.offset;
 
-       i->used += size;
+       i->used += size+47;
+       i->used -= i->used%48;
        ++i->async_count;
 }