diff --git a/src/util/opengl_device.cpp b/src/util/opengl_device.cpp index 7d68aa4e3..bcbe3b3b9 100644 --- a/src/util/opengl_device.cpp +++ b/src/util/opengl_device.cpp @@ -358,42 +358,10 @@ bool OpenGLDevice::CheckFeatures(FeatureMask disabled_features) const char* renderer = (const char*)glGetString(GL_RENDERER); SetDriverType(GuessDriverType(0, vendor, renderer)); - if (std::strstr(vendor, "Advanced Micro Devices") || std::strstr(vendor, "ATI Technologies Inc.") || - std::strstr(vendor, "ATI")) - { - INFO_LOG("AMD GPU detected."); - vendor_id_amd = true; - } - else if (std::strstr(vendor, "NVIDIA Corporation")) - { - INFO_LOG("NVIDIA GPU detected."); - // vendor_id_nvidia = true; - } - else if (std::strstr(vendor, "Intel")) - { - INFO_LOG("Intel GPU detected."); - vendor_id_intel = true; - } - else if (std::strstr(vendor, "ARM")) - { - INFO_LOG("ARM GPU detected."); - vendor_id_arm = true; - } - else if (std::strstr(vendor, "Qualcomm")) - { - INFO_LOG("Qualcomm GPU detected."); - vendor_id_qualcomm = true; - } - else if (std::strstr(vendor, "Imagination Technologies") || std::strstr(renderer, "PowerVR")) - { - INFO_LOG("PowerVR GPU detected."); - vendor_id_powervr = true; - } - // Don't use PBOs when we don't have ARB_buffer_storage, orphaning buffers probably ends up worse than just // using the normal texture update routines and letting the driver take care of it. PBOs are also completely // broken on mobile drivers. - const bool is_shitty_mobile_driver = (vendor_id_powervr || vendor_id_qualcomm || vendor_id_arm); + const bool is_shitty_mobile_driver = (m_driver_type & GPUDriverType::MobileFlag) == GPUDriverType::MobileFlag; m_disable_pbo = (!GLAD_GL_VERSION_4_4 && !GLAD_GL_ARB_buffer_storage && !GLAD_GL_EXT_buffer_storage) || is_shitty_mobile_driver; if (m_disable_pbo && !is_shitty_mobile_driver) diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index 240fa4b8c..28095724c 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -623,7 +623,7 @@ bool VulkanDevice::EnableOptionalDeviceExtensions(VkPhysicalDevice physical_devi m_optional_extensions.vk_ext_external_memory_host &= (external_memory_host_properties.minImportedHostPointerAlignment <= HOST_PAGE_SIZE); - if (IsBrokenMobileDriver()) + if ((m_driver_type & GPUDriverType::MobileFlag) == GPUDriverType::MobileFlag) { // Push descriptor is broken on Adreno v502.. don't want to think about dynamic rendending. if (m_optional_extensions.vk_khr_dynamic_rendering) @@ -639,7 +639,7 @@ bool VulkanDevice::EnableOptionalDeviceExtensions(VkPhysicalDevice physical_devi WARNING_LOG("Disabling VK_KHR_push_descriptor on broken mobile driver."); } } - else if (IsDeviceAMD()) + else if (m_driver_type == GPUDriverType::AMDProprietary) { // VK_KHR_dynamic_rendering_local_read appears to be broken on RDNA3, like everything else... // Just causes GPU resets when you actually use a feedback loop. Assume Mesa is fine. @@ -1772,41 +1772,6 @@ void VulkanDevice::DisableDebugUtils() } } -bool VulkanDevice::IsDeviceNVIDIA() const -{ - return (m_device_properties.vendorID == 0x10DE); -} - -bool VulkanDevice::IsDeviceAMD() const -{ - return (m_device_properties.vendorID == 0x1002); -} - -bool VulkanDevice::IsDeviceAdreno() const -{ - // Assume turnip is fine... - return ((m_device_properties.vendorID == 0x5143 || - m_device_driver_properties.driverID == VK_DRIVER_ID_QUALCOMM_PROPRIETARY) && - m_device_driver_properties.driverID != VK_DRIVER_ID_MESA_TURNIP); -} - -bool VulkanDevice::IsDeviceMali() const -{ - return (m_device_properties.vendorID == 0x13B5 || - m_device_driver_properties.driverID == VK_DRIVER_ID_ARM_PROPRIETARY); -} - -bool VulkanDevice::IsDeviceImgTec() const -{ - return (m_device_properties.vendorID == 0x1010 || - m_device_driver_properties.driverID == VK_DRIVER_ID_IMAGINATION_PROPRIETARY); -} - -bool VulkanDevice::IsBrokenMobileDriver() const -{ - return (IsDeviceAdreno() || IsDeviceMali() || IsDeviceImgTec()); -} - VkRenderPass VulkanDevice::CreateCachedRenderPass(RenderPassCacheKey key) { std::array color_references; @@ -2747,7 +2712,7 @@ void VulkanDevice::ClearRenderTarget(GPUTexture* t, u32 c) { VulkanTexture* T = static_cast(t); - if (IsDeviceNVIDIA()) + if (m_driver_type == GPUDriverType::NVIDIAProprietary) { EndRenderPass(); } @@ -2775,7 +2740,7 @@ void VulkanDevice::ClearDepth(GPUTexture* t, float d) // should be failing. Breaking/restarting the render pass isn't enough to work around the bug, // it needs an explicit pipeline barrier. VulkanTexture* T = static_cast(t); - if (IsDeviceNVIDIA()) + if (m_driver_type == GPUDriverType::NVIDIAProprietary) { EndRenderPass(); T->TransitionSubresourcesToLayout(GetCurrentCommandBuffer(), 0, 1, 0, 1, T->GetLayout(), T->GetLayout()); @@ -3344,7 +3309,7 @@ void VulkanDevice::BeginRenderPass() // NVIDIA drivers appear to return random garbage when sampling the RT via a feedback loop, if the load op for // the render pass is CLEAR. Using vkCmdClearAttachments() doesn't work, so we have to clear the image instead. - if (m_current_render_pass_flags & GPUPipeline::ColorFeedbackLoop && IsDeviceNVIDIA()) + if (m_current_render_pass_flags & GPUPipeline::ColorFeedbackLoop && m_driver_type == GPUDriverType::NVIDIAProprietary) { for (u32 i = 0; i < m_num_current_render_targets; i++) { diff --git a/src/util/vulkan_device.h b/src/util/vulkan_device.h index 8a284c2f7..c870566c4 100644 --- a/src/util/vulkan_device.h +++ b/src/util/vulkan_device.h @@ -325,18 +325,6 @@ private: bool EnableDebugUtils(); void DisableDebugUtils(); - /// Returns true if running on an NVIDIA GPU. - bool IsDeviceNVIDIA() const; - - /// Returns true if running on an AMD GPU. - bool IsDeviceAMD() const; - - // Vendor queries. - bool IsDeviceAdreno() const; - bool IsDeviceMali() const; - bool IsDeviceImgTec() const; - bool IsBrokenMobileDriver() const; - using ExtensionList = std::vector; static bool SelectInstanceExtensions(ExtensionList* extension_list, const WindowInfo& wi, OptionalExtensions* oe, bool enable_debug_utils);