From c99451ad10754a704be9cde07522bfa8cb5688c9 Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Sat, 20 Jan 2024 19:14:19 +0100 Subject: [PATCH] Fixing struct initializer order --- src/Engine/Graphics/Enums.cpp | 1 + src/Engine/Graphics/Vulkan/Buffer.cpp | 6 +++--- src/Engine/Graphics/Vulkan/Graphics.cpp | 8 ++++---- src/Engine/Graphics/Vulkan/Texture.cpp | 4 ++-- src/Engine/ThreadPool.h | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Engine/Graphics/Enums.cpp b/src/Engine/Graphics/Enums.cpp index 7dc5253..171d834 100644 --- a/src/Engine/Graphics/Enums.cpp +++ b/src/Engine/Graphics/Enums.cpp @@ -1,4 +1,5 @@ #include "Enums.h" +#include using namespace Seele; using namespace Seele::Gfx; diff --git a/src/Engine/Graphics/Vulkan/Buffer.cpp b/src/Engine/Graphics/Vulkan/Buffer.cpp index e7f7449..592fb40 100644 --- a/src/Engine/Graphics/Vulkan/Buffer.cpp +++ b/src/Engine/Graphics/Vulkan/Buffer.cpp @@ -35,8 +35,8 @@ Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::Q .sharingMode = VK_SHARING_MODE_EXCLUSIVE, }; 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, + .usage = VMA_MEMORY_USAGE_AUTO, }; 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, .pNext = nullptr, .flags = 0, - .usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT, .size = regionSize, + .usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT, .sharingMode = VK_SHARING_MODE_EXCLUSIVE, }; VmaAllocationCreateInfo allocInfo = { @@ -198,7 +198,6 @@ void Buffer::unmap() if (found != pendingBuffers.end()) { PendingBuffer &pending = found->value; - vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0, VK_WHOLE_SIZE); if (pending.writeOnly) { if (buffers[currentBuffer].properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) @@ -207,6 +206,7 @@ void Buffer::unmap() } else { + vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0, VK_WHOLE_SIZE); vmaUnmapMemory(graphics->getAllocator(), pending.allocation); PCommand command = graphics->getQueueCommands(owner)->getCommands(); VkCommandBuffer cmdHandle = command->getHandle(); diff --git a/src/Engine/Graphics/Vulkan/Graphics.cpp b/src/Engine/Graphics/Vulkan/Graphics.cpp index 1790b2e..62e1bbc 100644 --- a/src/Engine/Graphics/Vulkan/Graphics.cpp +++ b/src/Engine/Graphics/Vulkan/Graphics.cpp @@ -58,16 +58,16 @@ void Graphics::init(GraphicsInitializer initInfo) pickPhysicalDevice(); createDevice(initInfo); VmaAllocatorCreateInfo createInfo = { + .physicalDevice = physicalDevice, .device = handle, - .instance = instance, + .preferredLargeHeapBlockSize = 0, .pAllocationCallbacks = nullptr, .pDeviceMemoryCallbacks = nullptr, .pHeapSizeLimit = nullptr, - .physicalDevice = physicalDevice, - .preferredLargeHeapBlockSize = 0, - .pTypeExternalMemoryHandleTypes = nullptr, .pVulkanFunctions = nullptr, + .instance = instance, .vulkanApiVersion = VK_API_VERSION_1_3, + .pTypeExternalMemoryHandleTypes = nullptr, }; vmaCreateAllocator(&createInfo, &allocator); pipelineCache = new PipelineCache(this, "pipeline.cache"); diff --git a/src/Engine/Graphics/Vulkan/Texture.cpp b/src/Engine/Graphics/Vulkan/Texture.cpp index 1a5d302..0a06dc1 100644 --- a/src/Engine/Graphics/Vulkan/Texture.cpp +++ b/src/Engine/Graphics/Vulkan/Texture.cpp @@ -125,8 +125,8 @@ TextureBase::TextureBase(PGraphics graphics, VkImageViewType viewType, .sharingMode = VK_SHARING_MODE_EXCLUSIVE, }; VmaAllocationCreateInfo alloc = { - .usage = VMA_MEMORY_USAGE_AUTO, .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, + .usage = VMA_MEMORY_USAGE_AUTO, }; VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &alloc, &stagingBuffer, &stagingAlloc, nullptr)); vmaMapMemory(graphics->getAllocator(), stagingAlloc, &data); @@ -257,8 +257,8 @@ void TextureBase::download(uint32 mipLevel, uint32 arrayLayer, uint32 face, Arra .sharingMode = VK_SHARING_MODE_EXCLUSIVE, }; VmaAllocationCreateInfo alloc = { - .usage = VMA_MEMORY_USAGE_AUTO, .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)); diff --git a/src/Engine/ThreadPool.h b/src/Engine/ThreadPool.h index afa27d8..15b0899 100644 --- a/src/Engine/ThreadPool.h +++ b/src/Engine/ThreadPool.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include "Containers/Array.h" #include "Containers/List.h"