From: Mikko Rasa Date: Sat, 11 Dec 2021 23:33:10 +0000 (+0200) Subject: Use const void * for the object pointers in TransferQueue X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c633fcc87e295ebc88b5847c44ca0da121652819;p=libs%2Fgl.git Use const void * for the object pointers in TransferQueue --- diff --git a/source/backends/vulkan/transferqueue.cpp b/source/backends/vulkan/transferqueue.cpp index 8040f245..f356510e 100644 --- a/source/backends/vulkan/transferqueue.cpp +++ b/source/backends/vulkan/transferqueue.cpp @@ -12,7 +12,7 @@ TransferQueue::TransferQueue(Device &d): device(d) { } -TransferQueue::PendingTransfer &TransferQueue::prepare_transfer(void *object, bool ordered, size_t size) +TransferQueue::PendingTransfer &TransferQueue::prepare_transfer(const void *object, bool ordered, size_t size) { unsigned &order = next_orders[object]; order += !order; diff --git a/source/backends/vulkan/transferqueue.h b/source/backends/vulkan/transferqueue.h index b11b4503..58b1bc2d 100644 --- a/source/backends/vulkan/transferqueue.h +++ b/source/backends/vulkan/transferqueue.h @@ -42,23 +42,23 @@ private: std::size_t default_buffer_size = 16*1048576; std::vector buffers; std::vector transfers; - std::map next_orders; + std::map next_orders; public: TransferQueue(Device &); template - void *prepare_transfer(void *, bool, std::size_t, S &&, T &&); + void *prepare_transfer(const void *, bool, std::size_t, S &&, T &&); private: - PendingTransfer &prepare_transfer(void *, bool, std::size_t); + PendingTransfer &prepare_transfer(const void *, bool, std::size_t); public: void dispatch_transfers(VkCommandBuffer); }; template -void *TransferQueue::prepare_transfer(void *object, bool ordered, std::size_t size, S &&synchronize, T &&transfer) +void *TransferQueue::prepare_transfer(const void *object, bool ordered, std::size_t size, S &&synchronize, T &&transfer) { PendingTransfer &pt = prepare_transfer(object, ordered, size); pt.synchronize = std::forward(synchronize);