mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 16:22:47 +01:00
renderer_vulkan: Add missing initializers
This commit is contained in:
parent
7b2f680468
commit
ee0d68300e
3 changed files with 15 additions and 5 deletions
2
externals/vma/vma.cpp
vendored
2
externals/vma/vma.cpp
vendored
|
@ -2,4 +2,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#define VMA_IMPLEMENTATION
|
#define VMA_IMPLEMENTATION
|
||||||
|
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
||||||
|
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
|
||||||
#include <vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
|
@ -597,18 +597,22 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||||
graphics_queue = logical.GetQueue(graphics_family);
|
graphics_queue = logical.GetQueue(graphics_family);
|
||||||
present_queue = logical.GetQueue(present_family);
|
present_queue = logical.GetQueue(present_family);
|
||||||
|
|
||||||
const VmaVulkanFunctions functions = {
|
VmaVulkanFunctions functions{};
|
||||||
.vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr,
|
functions.vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr;
|
||||||
.vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr,
|
functions.vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr;
|
||||||
};
|
|
||||||
|
|
||||||
const VmaAllocatorCreateInfo allocator_info = {
|
const VmaAllocatorCreateInfo allocator_info = {
|
||||||
.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT,
|
.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT,
|
||||||
.physicalDevice = physical,
|
.physicalDevice = physical,
|
||||||
.device = *logical,
|
.device = *logical,
|
||||||
|
.preferredLargeHeapBlockSize = 0,
|
||||||
|
.pAllocationCallbacks = nullptr,
|
||||||
|
.pDeviceMemoryCallbacks = nullptr,
|
||||||
|
.pHeapSizeLimit = nullptr,
|
||||||
.pVulkanFunctions = &functions,
|
.pVulkanFunctions = &functions,
|
||||||
.instance = instance,
|
.instance = instance,
|
||||||
.vulkanApiVersion = VK_API_VERSION_1_1,
|
.vulkanApiVersion = VK_API_VERSION_1_1,
|
||||||
|
.pTypeExternalMemoryHandleTypes = nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
vk::Check(vmaCreateAllocator(&allocator_info, &allocator));
|
vk::Check(vmaCreateAllocator(&allocator_info, &allocator));
|
||||||
|
|
|
@ -75,7 +75,7 @@ struct Range {
|
||||||
|
|
||||||
[[nodiscard]] VkMemoryPropertyFlags MemoryUsagePreferedVmaFlags(MemoryUsage usage) {
|
[[nodiscard]] VkMemoryPropertyFlags MemoryUsagePreferedVmaFlags(MemoryUsage usage) {
|
||||||
return usage != MemoryUsage::DeviceLocal ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
|
return usage != MemoryUsage::DeviceLocal ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
|
||||||
: VkMemoryPropertyFlags{};
|
: VkMemoryPropertyFlagBits{};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] VmaAllocationCreateFlags MemoryUsageVmaFlags(MemoryUsage usage) {
|
[[nodiscard]] VmaAllocationCreateFlags MemoryUsageVmaFlags(MemoryUsage usage) {
|
||||||
|
@ -239,8 +239,10 @@ vk::Image MemoryAllocator::CreateImage(const VkImageCreateInfo& ci) const {
|
||||||
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
|
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
|
||||||
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
.preferredFlags = 0,
|
.preferredFlags = 0,
|
||||||
|
.memoryTypeBits = 0,
|
||||||
.pool = VK_NULL_HANDLE,
|
.pool = VK_NULL_HANDLE,
|
||||||
.pUserData = nullptr,
|
.pUserData = nullptr,
|
||||||
|
.priority = 0.f,
|
||||||
};
|
};
|
||||||
|
|
||||||
VkImage handle{};
|
VkImage handle{};
|
||||||
|
@ -259,8 +261,10 @@ vk::Buffer MemoryAllocator::CreateBuffer(const VkBufferCreateInfo& ci, MemoryUsa
|
||||||
.usage = MemoryUsageVma(usage),
|
.usage = MemoryUsageVma(usage),
|
||||||
.requiredFlags = MemoryUsageRequiredVmaFlags(usage),
|
.requiredFlags = MemoryUsageRequiredVmaFlags(usage),
|
||||||
.preferredFlags = MemoryUsagePreferedVmaFlags(usage),
|
.preferredFlags = MemoryUsagePreferedVmaFlags(usage),
|
||||||
|
.memoryTypeBits = 0,
|
||||||
.pool = VK_NULL_HANDLE,
|
.pool = VK_NULL_HANDLE,
|
||||||
.pUserData = nullptr,
|
.pUserData = nullptr,
|
||||||
|
.priority = 0.f,
|
||||||
};
|
};
|
||||||
|
|
||||||
VkBuffer handle{};
|
VkBuffer handle{};
|
||||||
|
|
Loading…
Reference in a new issue