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.
This commit is contained in:
niki
2023-07-18 14:01:05 +02:00
parent 04de1ade9e
commit ba15a2ab05
+3 -2
View File
@@ -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");