1 template <
size_t subBufferPerChunk,
size_t subBufferSize>
5 VkDeviceSize subBufferSizeAligned = subBufferSize;
7 if (subBufferSizeAligned % alignment) {
8 subBufferSizeAligned += alignment - subBufferSizeAligned % alignment;
16 bufferBuilder.setSize(subBufferSizeAligned * (subBufferPerChunk - 1) + subBufferSize);
17 bufferBuilder.setUsage(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT);
19 VkResult result{VK_SUCCESS};
20 if (!bufferBuilder.build(_buffer, &result)) {
21 LUG_LOG.error(
"BufferPool::Chunk: Can't create buffer: {}", result);
29 deviceMemoryBuilder.
setMemoryFlags(VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
31 if (!deviceMemoryBuilder.addBuffer(_buffer)) {
32 LUG_LOG.error(
"BufferPool::Chunk: Can't add buffer to device memory");
36 VkResult result{VK_SUCCESS};
37 if (!deviceMemoryBuilder.build(_bufferMemory, &result)) {
38 LUG_LOG.error(
"BufferPool::Chunk: Can't create device memory: {}", result);
44 for (uint32_t i = 0; i < subBufferPerChunk; ++i) {
47 static_cast<uint32_t>(subBufferSizeAligned * i),
48 static_cast<uint32_t>(subBufferSize)
55 template <
size_t subBufferPerChunk,
size_t subBufferSize>
57 for (
auto& subBuffer : _subBuffers) {
58 if (subBuffer._referenceCount == 0) {
void setQueueFamilyIndices(std::set< uint32_t > queueFamilyIndices)
const PhysicalDeviceInfo * getPhysicalDeviceInfo() const
void setMemoryFlags(VkMemoryPropertyFlags flags)
API::Device & getDevice()
VkPhysicalDeviceProperties properties