[Bf-blender-cvs] [404ed5a6eab] temp-vulkan-descriptor-sets: Fix memory allocation by disabling any extension.
Jeroen Bakker
noreply at git.blender.org
Mon Feb 6 13:31:28 CET 2023
Commit: 404ed5a6eab1030b1a2d047a5adf9a8cb7484f04
Author: Jeroen Bakker
Date: Mon Feb 6 13:31:21 2023 +0100
Branches: temp-vulkan-descriptor-sets
https://developer.blender.org/rB404ed5a6eab1030b1a2d047a5adf9a8cb7484f04
Fix memory allocation by disabling any extension.
===================================================================
M intern/ghost/intern/GHOST_ContextVK.cpp
M source/blender/gpu/vulkan/vk_buffer.cc
M source/blender/gpu/vulkan/vk_context.cc
===================================================================
diff --git a/intern/ghost/intern/GHOST_ContextVK.cpp b/intern/ghost/intern/GHOST_ContextVK.cpp
index 4ee48243234..10662f20d90 100644
--- a/intern/ghost/intern/GHOST_ContextVK.cpp
+++ b/intern/ghost/intern/GHOST_ContextVK.cpp
@@ -841,6 +841,12 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
extensions_device.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
}
+ extensions_device.push_back("VK_KHR_dedicated_allocation");
+ /* Enable MoltenVK required instance extensions.*/
+#ifdef VK_MVK_MOLTENVK_EXTENSION_NAME
+ requireExtension(
+ extensions_available, extensions_enabled, "VK_KHR_get_physical_device_properties2");
+#endif
VkApplicationInfo app_info = {};
app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
@@ -903,6 +909,13 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
return GHOST_kFailure;
}
+ /* According to the Vulkan specs, when `VK_KHR_portability_subset` is available it should be
+ * enabled. See
+ * https://vulkan.lunarg.com/doc/view/1.2.198.1/mac/1.2-extensions/vkspec.html#VUID-VkDeviceCreateInfo-pProperties-04451*/
+ if (device_extensions_support(m_physical_device, {VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME})) {
+ extensions_device.push_back(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME);
+ }
+
vector<VkDeviceQueueCreateInfo> queue_create_infos;
{
diff --git a/source/blender/gpu/vulkan/vk_buffer.cc b/source/blender/gpu/vulkan/vk_buffer.cc
index 66eec891046..ff12d153702 100644
--- a/source/blender/gpu/vulkan/vk_buffer.cc
+++ b/source/blender/gpu/vulkan/vk_buffer.cc
@@ -62,12 +62,9 @@ bool VKBuffer::create(VKContext &context,
create_info.pQueueFamilyIndices = context.queue_family_ptr_get();
VmaAllocationCreateInfo vma_create_info = {};
- /*
vma_create_info.flags = vma_allocation_flags(usage);
vma_create_info.priority = 1.0f;
vma_create_info.usage = VMA_MEMORY_USAGE_AUTO;
- vma_create_inf
- */
VkResult result = vmaCreateBuffer(
allocator, &create_info, &vma_create_info, &vk_buffer_, &allocation_, nullptr);
diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc
index 853968daa22..7d9fa356a65 100644
--- a/source/blender/gpu/vulkan/vk_context.cc
+++ b/source/blender/gpu/vulkan/vk_context.cc
@@ -28,8 +28,10 @@ VKContext::VKContext(void *ghost_window, void *ghost_context)
/* Initialize the memory allocator. */
VmaAllocatorCreateInfo info = {};
- /* Should use same vulkan version as GHOST. */
- info.vulkanApiVersion = VK_API_VERSION_1_2;
+ /* Should use same vulkan version as GHOST, but set to 1.0 for now. Raising it to 1.2 requires
+ * correct extensions and funtions to be found, which doesn't out-of-the-box. We should fix this,
+ * but to continue the development at hand we lower the API to 1.0.*/
+ info.vulkanApiVersion = VK_API_VERSION_1_0;
info.physicalDevice = physical_device_;
info.device = device_;
info.instance = instance_;
More information about the Bf-blender-cvs
mailing list