Fixing struct initializer order

This commit is contained in:
Dynamitos
2024-01-20 19:14:19 +01:00
parent 4868fb51ac
commit c99451ad10
5 changed files with 11 additions and 9 deletions
+1
View File
@@ -1,4 +1,5 @@
#include "Enums.h" #include "Enums.h"
#include <stdexcept>
using namespace Seele; using namespace Seele;
using namespace Seele::Gfx; using namespace Seele::Gfx;
+3 -3
View File
@@ -35,8 +35,8 @@ Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::Q
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
}; };
VmaAllocationCreateInfo allocInfo = { VmaAllocationCreateInfo allocInfo = {
.usage = VMA_MEMORY_USAGE_AUTO,
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
}; };
for (uint32 i = 0; i < numBuffers; ++i) for (uint32 i = 0; i < numBuffers; ++i)
{ {
@@ -170,8 +170,8 @@ void *Buffer::mapRegion(uint64 regionOffset, uint64 regionSize, bool writeOnly)
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
.size = regionSize, .size = regionSize,
.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
}; };
VmaAllocationCreateInfo allocInfo = { VmaAllocationCreateInfo allocInfo = {
@@ -198,7 +198,6 @@ void Buffer::unmap()
if (found != pendingBuffers.end()) if (found != pendingBuffers.end())
{ {
PendingBuffer &pending = found->value; PendingBuffer &pending = found->value;
vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0, VK_WHOLE_SIZE);
if (pending.writeOnly) if (pending.writeOnly)
{ {
if (buffers[currentBuffer].properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) if (buffers[currentBuffer].properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
@@ -207,6 +206,7 @@ void Buffer::unmap()
} }
else else
{ {
vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0, VK_WHOLE_SIZE);
vmaUnmapMemory(graphics->getAllocator(), pending.allocation); vmaUnmapMemory(graphics->getAllocator(), pending.allocation);
PCommand command = graphics->getQueueCommands(owner)->getCommands(); PCommand command = graphics->getQueueCommands(owner)->getCommands();
VkCommandBuffer cmdHandle = command->getHandle(); VkCommandBuffer cmdHandle = command->getHandle();
+4 -4
View File
@@ -58,16 +58,16 @@ void Graphics::init(GraphicsInitializer initInfo)
pickPhysicalDevice(); pickPhysicalDevice();
createDevice(initInfo); createDevice(initInfo);
VmaAllocatorCreateInfo createInfo = { VmaAllocatorCreateInfo createInfo = {
.physicalDevice = physicalDevice,
.device = handle, .device = handle,
.instance = instance, .preferredLargeHeapBlockSize = 0,
.pAllocationCallbacks = nullptr, .pAllocationCallbacks = nullptr,
.pDeviceMemoryCallbacks = nullptr, .pDeviceMemoryCallbacks = nullptr,
.pHeapSizeLimit = nullptr, .pHeapSizeLimit = nullptr,
.physicalDevice = physicalDevice,
.preferredLargeHeapBlockSize = 0,
.pTypeExternalMemoryHandleTypes = nullptr,
.pVulkanFunctions = nullptr, .pVulkanFunctions = nullptr,
.instance = instance,
.vulkanApiVersion = VK_API_VERSION_1_3, .vulkanApiVersion = VK_API_VERSION_1_3,
.pTypeExternalMemoryHandleTypes = nullptr,
}; };
vmaCreateAllocator(&createInfo, &allocator); vmaCreateAllocator(&createInfo, &allocator);
pipelineCache = new PipelineCache(this, "pipeline.cache"); pipelineCache = new PipelineCache(this, "pipeline.cache");
+2 -2
View File
@@ -125,8 +125,8 @@ TextureBase::TextureBase(PGraphics graphics, VkImageViewType viewType,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
}; };
VmaAllocationCreateInfo alloc = { VmaAllocationCreateInfo alloc = {
.usage = VMA_MEMORY_USAGE_AUTO,
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
}; };
VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &alloc, &stagingBuffer, &stagingAlloc, nullptr)); VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &alloc, &stagingBuffer, &stagingAlloc, nullptr));
vmaMapMemory(graphics->getAllocator(), stagingAlloc, &data); vmaMapMemory(graphics->getAllocator(), stagingAlloc, &data);
@@ -257,8 +257,8 @@ void TextureBase::download(uint32 mipLevel, uint32 arrayLayer, uint32 face, Arra
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
}; };
VmaAllocationCreateInfo alloc = { VmaAllocationCreateInfo alloc = {
.usage = VMA_MEMORY_USAGE_AUTO,
.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, .flags = VMA_ALLOCATION_CREATE_MAPPED_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
}; };
VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &alloc, &stagingBuffer, &stagingAlloc, nullptr)); VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &alloc, &stagingBuffer, &stagingAlloc, nullptr));
+1
View File
@@ -1,5 +1,6 @@
#pragma once #pragma once
#include <thread> #include <thread>
#include <functional>
#include "Containers/Array.h" #include "Containers/Array.h"
#include "Containers/List.h" #include "Containers/List.h"