Fix init code so it works properly on Vulkan 1.1 devices

This commit is contained in:
Bastiaan Olij 2021-08-17 23:46:22 +10:00
parent 84b11fbaa6
commit 38e73ba69e
1 changed files with 25 additions and 27 deletions

View File

@ -976,9 +976,9 @@ Error VulkanContext::_create_device() {
sdevice.queueCreateInfoCount = 2; sdevice.queueCreateInfoCount = 2;
} }
#ifdef VK_VERSION_1_2
VkPhysicalDeviceVulkan11Features vulkan11features; VkPhysicalDeviceVulkan11Features vulkan11features;
VkPhysicalDeviceMultiviewFeatures multiview_features;
if (vulkan_major > 1 || vulkan_minor >= 2) {
vulkan11features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; vulkan11features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
vulkan11features.pNext = nullptr; vulkan11features.pNext = nullptr;
// !BAS! Need to figure out which ones of these we want enabled... // !BAS! Need to figure out which ones of these we want enabled...
@ -996,9 +996,7 @@ Error VulkanContext::_create_device() {
vulkan11features.shaderDrawParameters = 0; vulkan11features.shaderDrawParameters = 0;
sdevice.pNext = &vulkan11features; sdevice.pNext = &vulkan11features;
#elif VK_VERSION_1_1 } else if (vulkan_major == 1 && vulkan_minor == 1) {
VkPhysicalDeviceMultiviewFeatures multiview_features;
multiview_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; multiview_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
multiview_features.pNext = nullptr; multiview_features.pNext = nullptr;
multiview_features.multiview = multiview_capabilities.is_supported; multiview_features.multiview = multiview_capabilities.is_supported;
@ -1006,7 +1004,7 @@ Error VulkanContext::_create_device() {
multiview_features.multiviewTessellationShader = multiview_capabilities.tessellation_shader_is_supported; multiview_features.multiviewTessellationShader = multiview_capabilities.tessellation_shader_is_supported;
sdevice.pNext = &multiview_features; sdevice.pNext = &multiview_features;
#endif }
err = vkCreateDevice(gpu, &sdevice, nullptr, &device); err = vkCreateDevice(gpu, &sdevice, nullptr, &device);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE); ERR_FAIL_COND_V(err, ERR_CANT_CREATE);