VK: Minor cleanup, turn off unfinished and probably wrong use of dedicated allocation feature

This commit is contained in:
Henrik Rydgard 2019-01-31 14:09:21 +01:00
parent 992cea1082
commit f339a0c15b
5 changed files with 6 additions and 8 deletions

View file

@ -588,9 +588,8 @@ VkResult VulkanContext::CreateDevice() {
}
assert(found);
if (EnableDeviceExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) {
deviceExtensionsLookup_.DEDICATED_ALLOCATION = EnableDeviceExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
}
deviceExtensionsLookup_.KHR_dedicated_allocation = EnableDeviceExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
deviceExtensionsLookup_.EXT_external_memory_host = EnableDeviceExtension(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME);
VkDeviceCreateInfo device_info{ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
device_info.queueCreateInfoCount = 1;

View file

@ -103,7 +103,8 @@ private:
// For fast extension-enabled checks.
struct VulkanDeviceExtensions {
bool DEDICATED_ALLOCATION;
bool KHR_dedicated_allocation;
bool EXT_external_memory_host;
};
// Useful for debugging on ARM Mali. This eliminates transaction elimination

View file

@ -117,9 +117,6 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
g_Config.sVulkanDevice = g_Vulkan->GetPhysicalDeviceProperties(deviceNum).deviceName;
}
g_Vulkan->ChooseDevice(deviceNum);
if (g_Vulkan->EnableDeviceExtension(VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME)) {
supportsDedicatedAlloc_ = true;
}
if (g_Vulkan->CreateDevice() != VK_SUCCESS) {
*error_message = g_Vulkan->InitError();
delete g_Vulkan;

View file

@ -35,6 +35,5 @@ public:
Draw::DrawContext *GetDrawContext() override { return draw_; }
private:
Draw::DrawContext *draw_;
bool supportsDedicatedAlloc_;
};

View file

@ -47,6 +47,7 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int
VkMemoryAllocateInfo alloc{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
alloc.allocationSize = memreq.size;
/*
// Hint to the driver that this allocation is image-specific. Some drivers benefit.
// We only bother supporting the KHR extension, not the old NV one.
VkMemoryDedicatedAllocateInfoKHR dedicated{ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };
@ -54,6 +55,7 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int
alloc.pNext = &dedicated;
dedicated.image = img.image;
}
*/
vulkan->MemoryTypeFromProperties(memreq.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &alloc.memoryTypeIndex);
VkResult res = vkAllocateMemory(vulkan->GetDevice(), &alloc, nullptr, &img.memory);