diff options
Diffstat (limited to 'vulkan/libvulkan/driver.cpp')
-rw-r--r-- | vulkan/libvulkan/driver.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index 4927150b6a..a99355f047 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -1027,8 +1027,11 @@ void QueryPresentationProperties( } } -bool GetAndroidNativeBufferSpecVersion9Support( - VkPhysicalDevice physicalDevice) { +VkResult GetAndroidNativeBufferSpecVersion9Support( + VkPhysicalDevice physicalDevice, + bool& support) { + support = false; + const InstanceData& data = GetData(physicalDevice); // Call to get propertyCount @@ -1038,6 +1041,10 @@ bool GetAndroidNativeBufferSpecVersion9Support( physicalDevice, nullptr, &propertyCount, nullptr); ATRACE_END(); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) { + return result; + } + // Call to enumerate properties std::vector<VkExtensionProperties> properties(propertyCount); ATRACE_BEGIN("driver.EnumerateDeviceExtensionProperties"); @@ -1045,6 +1052,10 @@ bool GetAndroidNativeBufferSpecVersion9Support( physicalDevice, nullptr, &propertyCount, properties.data()); ATRACE_END(); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) { + return result; + } + for (uint32_t i = 0; i < propertyCount; i++) { auto& prop = properties[i]; @@ -1053,11 +1064,12 @@ bool GetAndroidNativeBufferSpecVersion9Support( continue; if (prop.specVersion >= 9) { - return true; + support = true; + return result; } } - return false; + return result; } VkResult EnumerateDeviceExtensionProperties( @@ -1101,18 +1113,30 @@ VkResult EnumerateDeviceExtensionProperties( swapchainCompFeats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT; swapchainCompFeats.pNext = nullptr; + swapchainCompFeats.imageCompressionControlSwapchain = false; VkPhysicalDeviceImageCompressionControlFeaturesEXT imageCompFeats = {}; imageCompFeats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; imageCompFeats.pNext = &swapchainCompFeats; + imageCompFeats.imageCompressionControl = false; VkPhysicalDeviceFeatures2 feats2 = {}; feats2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; feats2.pNext = &imageCompFeats; - GetPhysicalDeviceFeatures2(physicalDevice, &feats2); + const auto& driver = GetData(physicalDevice).driver; + if (driver.GetPhysicalDeviceFeatures2 || + driver.GetPhysicalDeviceFeatures2KHR) { + GetPhysicalDeviceFeatures2(physicalDevice, &feats2); + } - bool anb9 = GetAndroidNativeBufferSpecVersion9Support(physicalDevice); + bool anb9 = false; + VkResult result = + GetAndroidNativeBufferSpecVersion9Support(physicalDevice, anb9); + + if (result != VK_SUCCESS && result != VK_INCOMPLETE) { + return result; + } if (anb9 && imageCompFeats.imageCompressionControl) { loader_extensions.push_back( @@ -1142,7 +1166,7 @@ VkResult EnumerateDeviceExtensionProperties( } ATRACE_BEGIN("driver.EnumerateDeviceExtensionProperties"); - VkResult result = data.driver.EnumerateDeviceExtensionProperties( + result = data.driver.EnumerateDeviceExtensionProperties( physicalDevice, pLayerName, pPropertyCount, pProperties); ATRACE_END(); @@ -1532,6 +1556,11 @@ void GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, } break; case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT: { + VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT* + compressionFeat = reinterpret_cast< + VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT*>( + pFeats); + compressionFeat->imageCompressionControlSwapchain = false; imageCompressionControlSwapchainInChain = true; } break; @@ -1551,6 +1580,7 @@ void GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, imageCompFeats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; imageCompFeats.pNext = nullptr; + imageCompFeats.imageCompressionControl = false; VkPhysicalDeviceFeatures2 feats2 = {}; feats2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; |