Browse Source

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.

niki 2 years ago
parent
commit
ba15a2ab05
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/modules/graphics/vulkan/Graphics.cpp

+ 3 - 2
src/modules/graphics/vulkan/Graphics.cpp

@@ -1647,10 +1647,11 @@ void Graphics::createLogicalDevice()
 
 
 	VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extendedDynamicStateFeatures{};
 	VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extendedDynamicStateFeatures{};
 	extendedDynamicStateFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT;
 	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;
 	extendedDynamicStateFeatures.pNext = nullptr;
 
 
-	createInfo.pNext = &extendedDynamicStateFeatures;
+	if (optionalDeviceExtensions.extendedDynamicState)
+		createInfo.pNext = &extendedDynamicStateFeatures;
 
 
 	if (vkCreateDevice(physicalDevice, &createInfo, nullptr, &device) != VK_SUCCESS)
 	if (vkCreateDevice(physicalDevice, &createInfo, nullptr, &device) != VK_SUCCESS)
 		throw love::Exception("failed to create logical device");
 		throw love::Exception("failed to create logical device");