mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- hook up VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT
This commit is contained in:
parent
7256af0b32
commit
1c9bf262e6
2 changed files with 12 additions and 3 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <array>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "vk_device.h"
|
||||
#include "vk_swapchain.h"
|
||||
|
@ -215,10 +216,16 @@ void VulkanDevice::SelectPhysicalDevice()
|
|||
transferFamily = SupportedDevices[selected].transferFamily;
|
||||
}
|
||||
|
||||
bool VulkanDevice::SupportsDeviceExtension(const char *ext) const
|
||||
{
|
||||
return std::find(EnabledDeviceExtensions.begin(), EnabledDeviceExtensions.end(), ext) != EnabledDeviceExtensions.end();
|
||||
}
|
||||
|
||||
void VulkanDevice::CreateAllocator()
|
||||
{
|
||||
VmaAllocatorCreateInfo allocinfo = {};
|
||||
// allocinfo.flags = VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT; // To do: enable this for better performance
|
||||
if (SupportsDeviceExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) && SupportsDeviceExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME))
|
||||
allocinfo.flags = VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
|
||||
allocinfo.physicalDevice = PhysicalDevice.Device;
|
||||
allocinfo.device = device;
|
||||
allocinfo.preferredLargeHeapBlockSize = 64 * 1024 * 1024;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
// Device setup
|
||||
VkPhysicalDeviceFeatures UsedDeviceFeatures = {};
|
||||
std::vector<const char *> EnabledDeviceExtensions = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
|
||||
std::vector<const char *> OptionalDeviceExtensions = { VK_EXT_HDR_METADATA_EXTENSION_NAME };
|
||||
std::vector<const char *> OptionalDeviceExtensions = { VK_EXT_HDR_METADATA_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME };
|
||||
VulkanPhysicalDevice PhysicalDevice;
|
||||
bool DebugLayerActive = false;
|
||||
|
||||
|
@ -83,11 +83,13 @@ private:
|
|||
void CreateInstance();
|
||||
void CreateSurface();
|
||||
void SelectPhysicalDevice();
|
||||
void SelectFeatures();
|
||||
void CreateDevice();
|
||||
void CreateAllocator();
|
||||
void ReleaseResources();
|
||||
|
||||
void SelectFeatures();
|
||||
bool SupportsDeviceExtension(const char *ext) const;
|
||||
|
||||
static bool CheckRequiredFeatures(const VkPhysicalDeviceFeatures &f);
|
||||
|
||||
VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE;
|
||||
|
|
Loading…
Reference in a new issue