From ba15a2ab05bc04017de8bdb6c5290710c32db7ee Mon Sep 17 00:00:00 2001 From: niki Date: Tue, 18 Jul 2023 14:01:05 +0200 Subject: [PATCH] vulkan: correct usage of pNext chain for device For systems where VK_EXT_extended_dynamic_state is not supported it is not valid to extend VkDeviceCreateInfo with an unknown struct. Todo: if more extensions are supported in the future this code probably needs adjustments to correctly build a pNext chain. --- src/modules/graphics/vulkan/Graphics.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index 21b1afd4a..82ca210b6 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -1647,10 +1647,11 @@ void Graphics::createLogicalDevice() VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extendedDynamicStateFeatures{}; extendedDynamicStateFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; - extendedDynamicStateFeatures.extendedDynamicState = Vulkan::getBool(optionalDeviceExtensions.extendedDynamicState); + extendedDynamicStateFeatures.extendedDynamicState = VK_TRUE; extendedDynamicStateFeatures.pNext = nullptr; - createInfo.pNext = &extendedDynamicStateFeatures; + if (optionalDeviceExtensions.extendedDynamicState) + createInfo.pNext = &extendedDynamicStateFeatures; if (vkCreateDevice(physicalDevice, &createInfo, nullptr, &device) != VK_SUCCESS) throw love::Exception("failed to create logical device");