Vulkan: Enable VK_KHR_bind_memory2 extension

Don't assume support for VK_KHR_bind_memory2,
enable the extension, if supported, during device creation.

Also initialize all required extension functions for the
memory allocator.

Bug: angleproject:4966
Change-Id: I878939fb3324723675a2b7dec18ab453b2a9fc77
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359529
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
David Reveman 2020-08-16 16:13:59 -04:00 коммит произвёл Commit Bot
Родитель 831056bf05
Коммит 78d10017e2
4 изменённых файлов: 28 добавлений и 4 удалений

Просмотреть файл

@ -34,6 +34,7 @@ extern PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
// VK_KHR_get_physical_device_properties2
extern PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR;
extern PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR;
extern PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR;
// VK_KHR_external_semaphore_fd
extern PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR;
@ -49,9 +50,14 @@ extern PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT;
extern PFN_vkCmdEndQueryIndexedEXT vkCmdEndQueryIndexedEXT;
extern PFN_vkCmdDrawIndirectByteCountEXT vkCmdDrawIndirectByteCountEXT;
// VK_KHR_get_memory_requirements2
extern PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR;
extern PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR;
// VK_KHR_bind_memory2
extern PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR;
extern PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR;
// VK_KHR_external_fence_capabilities
extern PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR
vkGetPhysicalDeviceExternalFencePropertiesKHR;

Просмотреть файл

@ -1135,6 +1135,12 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
enabledDeviceExtensions.push_back(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
}
// Enable VK_KHR_bind_memory2, if supported
if (ExtensionFound(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, deviceExtensionNames))
{
enabledDeviceExtensions.push_back(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
}
// Selectively enable KHR_MAINTENANCE1 to support viewport flipping.
if ((getFeatures().flipViewportY.enabled) &&
(mPhysicalDeviceProperties.apiVersion < VK_MAKE_VERSION(1, 1, 0)))

Просмотреть файл

@ -42,11 +42,17 @@ VkResult InitAllocator(VkPhysicalDevice physicalDevice,
// When the vulkan-loader is statically linked, we need to use the extension
// functions defined in ANGLE's rx namespace. When it's dynamically linked
// with volk, this will default to the function definitions with no namespace
using rx::vkBindBufferMemory2KHR;
using rx::vkBindImageMemory2KHR;
using rx::vkGetBufferMemoryRequirements2KHR;
using rx::vkGetImageMemoryRequirements2KHR;
using rx::vkGetPhysicalDeviceMemoryProperties2KHR;
#endif // !defined(ANGLE_SHARED_LIBVULKAN)
funcs.vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2KHR;
funcs.vkGetImageMemoryRequirements2KHR = vkGetImageMemoryRequirements2KHR;
funcs.vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2KHR;
funcs.vkGetImageMemoryRequirements2KHR = vkGetImageMemoryRequirements2KHR;
funcs.vkBindBufferMemory2KHR = vkBindBufferMemory2KHR;
funcs.vkBindImageMemory2KHR = vkBindImageMemory2KHR;
funcs.vkGetPhysicalDeviceMemoryProperties2KHR = vkGetPhysicalDeviceMemoryProperties2KHR;
}
VmaAllocatorCreateInfo allocatorInfo = {};

Просмотреть файл

@ -791,8 +791,9 @@ PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT = nullptr;
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT = nullptr;
// VK_KHR_get_physical_device_properties2
PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR = nullptr;
PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR = nullptr;
PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR = nullptr;
PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR = nullptr;
PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR = nullptr;
// VK_KHR_external_semaphore_fd
PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR = nullptr;
@ -808,9 +809,14 @@ PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT =
PFN_vkCmdEndQueryIndexedEXT vkCmdEndQueryIndexedEXT = nullptr;
PFN_vkCmdDrawIndirectByteCountEXT vkCmdDrawIndirectByteCountEXT = nullptr;
// VK_KHR_get_memory_requirements2
PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR = nullptr;
PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR = nullptr;
// VK_KHR_bind_memory2
PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR = nullptr;
PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR = nullptr;
// VK_KHR_external_fence_capabilities
PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR vkGetPhysicalDeviceExternalFencePropertiesKHR =
nullptr;