diff --git a/android/jni/com/mapswithme/vulkan/android_vulkan_context_factory.cpp b/android/jni/com/mapswithme/vulkan/android_vulkan_context_factory.cpp index d58417b251..a1857d476a 100644 --- a/android/jni/com/mapswithme/vulkan/android_vulkan_context_factory.cpp +++ b/android/jni/com/mapswithme/vulkan/android_vulkan_context_factory.cpp @@ -3,6 +3,7 @@ #include "com/mapswithme/platform/Platform.hpp" #include "drape/drape_diagnostics.hpp" +#include "drape/support_manager.hpp" #include "drape/vulkan/vulkan_pipeline.hpp" #include "drape/vulkan/vulkan_utils.hpp" @@ -141,6 +142,20 @@ AndroidVulkanContextFactory::AndroidVulkanContextFactory(int appVersionCode) } m_gpu = tmpGpus[0]; + VkPhysicalDeviceProperties gpuProperties; + vkGetPhysicalDeviceProperties(m_gpu, &gpuProperties); + if (dp::SupportManager::Instance().IsVulkanForbidden(gpuProperties.deviceName, + {VK_VERSION_MAJOR(gpuProperties.apiVersion), + VK_VERSION_MINOR(gpuProperties.apiVersion), + VK_VERSION_PATCH(gpuProperties.apiVersion)}, + {VK_VERSION_MAJOR(gpuProperties.driverVersion), + VK_VERSION_MINOR(gpuProperties.driverVersion), + VK_VERSION_PATCH(gpuProperties.driverVersion)})) + { + LOG_ERROR_VK("GPU/Driver configuration is not supported."); + return; + } + uint32_t queueFamilyCount; vkGetPhysicalDeviceQueueFamilyProperties(m_gpu, &queueFamilyCount, nullptr); if (queueFamilyCount == 0) @@ -204,8 +219,6 @@ AndroidVulkanContextFactory::AndroidVulkanContextFactory(int appVersionCode) return; } - VkPhysicalDeviceProperties gpuProperties; - vkGetPhysicalDeviceProperties(m_gpu, &gpuProperties); VkPhysicalDeviceMemoryProperties memoryProperties; vkGetPhysicalDeviceMemoryProperties(m_gpu, &memoryProperties); m_objectManager = make_unique_dp(m_device, gpuProperties.limits, diff --git a/drape/support_manager.cpp b/drape/support_manager.cpp index b9d0519acf..0876cf913c 100644 --- a/drape/support_manager.cpp +++ b/drape/support_manager.cpp @@ -109,6 +109,33 @@ bool SupportManager::IsVulkanForbidden() const return forbidden; } +bool SupportManager::IsVulkanForbidden(std::string const & deviceName, + Version apiVersion, Version driverVersion) const +{ + // On these configurations we've detected fatal driver-specific Vulkan errors. + struct Configuration + { + std::string m_deviceName; + Version m_apiVersion; + Version m_driverVersion; + }; + static std::vector const kBannedConfigurations = { + {"Adreno (TM) 506", {1, 0, 31}, {42, 264, 975}}, + {"Adreno (TM) 506", {1, 1, 66}, {512, 313, 0}}, + {"Adreno (TM) 530", {1, 1, 66}, {512, 313, 0}}, + }; + + for (auto const & c : kBannedConfigurations) + { + if (c.m_deviceName == deviceName && c.m_apiVersion == apiVersion && + c.m_driverVersion == driverVersion) + { + return true; + } + } + return false; +} + SupportManager & SupportManager::Instance() { static SupportManager manager; diff --git a/drape/support_manager.hpp b/drape/support_manager.hpp index fb7b778afc..96e7b78267 100644 --- a/drape/support_manager.hpp +++ b/drape/support_manager.hpp @@ -5,6 +5,7 @@ #include "base/macros.hpp" +#include #include #include #include @@ -35,7 +36,11 @@ public: // These functions can be used without manager initialization. void ForbidVulkan(); + + using Version = std::array; bool IsVulkanForbidden() const; + bool IsVulkanForbidden(std::string const & deviceName, + Version apiVersion, Version driverVersion) const; private: SupportManager() = default;