]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/transferqueue.cpp
Align staging memory with an alignment suitable for image transfers
[libs/gl.git] / source / backends / vulkan / transferqueue.cpp
index 9fc941401ed90ef954b4a156ae7b1b801baf149f..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;
 }
 
@@ -126,7 +127,7 @@ TransferQueue::StagingBuffer::StagingBuffer(Device &d, size_t s):
 
        MemoryAllocator &allocator = device.get_allocator();
        memory_id = allocator.allocate(buffer, STAGING_MEMORY);
-       mapped_address = allocator.map(memory_id, 0, size);
+       mapped_address = allocator.map(memory_id);
 }
 
 TransferQueue::StagingBuffer::StagingBuffer(StagingBuffer &&other):
@@ -149,7 +150,7 @@ TransferQueue::StagingBuffer::~StagingBuffer()
 
        if(mapped_address)
        {
-               allocator.unmap(mapped_address);
+               allocator.unmap(memory_id);
                allocator.release(memory_id);
        }
        if(buffer)