From bf2b7d8cffe1dcb427e40e6b1a9e1ad3c237e4cc Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Thu, 3 Oct 2024 10:48:37 +0200 Subject: [PATCH] Block AMD drivers from after 19.12.1 & before 22.4.1 --- .../client/backend/vulkan/backend_vulkan.cpp | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/engine/client/backend/vulkan/backend_vulkan.cpp b/src/engine/client/backend/vulkan/backend_vulkan.cpp index 1e59e3fc24e..eb3d4f8b9c1 100644 --- a/src/engine/client/backend/vulkan/backend_vulkan.cpp +++ b/src/engine/client/backend/vulkan/backend_vulkan.cpp @@ -3574,6 +3574,22 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase return true; } + bool IsGpuDenied(uint32_t Vendor, uint32_t DriverVersion, uint32_t ApiMajor, uint32_t ApiMinor, uint32_t ApiPatch) + { + //#ifdef CONF_FAMILY_WINDOWS + // AMD + if(0x1002 == Vendor) + { + auto Major = (DriverVersion >> 22); + auto Minor = (DriverVersion >> 12) & 0x3ff; + auto Patch = DriverVersion & 0xfff; + + return Major == 2 && Minor == 0 && Patch > 116 && Patch < 220 && ((ApiMajor <= 1 && ApiMinor < 3) || (ApiMajor <= 1 && ApiMinor == 3 && ApiPatch < 206)); + } + //#endif + return false; + } + [[nodiscard]] bool CreateVulkanInstance(const std::vector &vVKLayers, const std::vector &vVKExtensions, bool TryDebugExtensions) { std::vector vLayersCStr; @@ -3745,10 +3761,12 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase STWGraphicGpu::ETWGraphicsGpuType GPUType = VKGPUTypeToGraphicsGpuType(DeviceProp.deviceType); - int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion); - int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion); + int DevApiMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion); + int DevApiMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion); + int DevApiPatch = (int)VK_API_VERSION_PATCH(DeviceProp.apiVersion); - if(DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)) + auto IsDenied = CCommandProcessorFragment_Vulkan::IsGpuDenied(DeviceProp.vendorID, DeviceProp.driverVersion, DevApiMajor, DevApiMinor, DevApiPatch); + if((DevApiMajor > gs_BackendVulkanMajor || (DevApiMajor == gs_BackendVulkanMajor && DevApiMinor >= gs_BackendVulkanMinor)) && !IsDenied) { STWGraphicGpu::STWGraphicGpuItem NewGpu; str_copy(NewGpu.m_aName, DeviceProp.deviceName); @@ -3787,9 +3805,9 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase { auto &DeviceProp = vDevicePropList[FoundDeviceIndex]; - int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion); - int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion); - int DevAPIPatch = (int)VK_API_VERSION_PATCH(DeviceProp.apiVersion); + int DevApiMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion); + int DevApiMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion); + int DevApiPatch = (int)VK_API_VERSION_PATCH(DeviceProp.apiVersion); str_copy(pRendererName, DeviceProp.deviceName, gs_GpuInfoStringSize); const char *pVendorNameStr = NULL; @@ -3827,7 +3845,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase char aBuff[256]; str_copy(pVendorName, pVendorNameStr, gs_GpuInfoStringSize); - str_format(pVersionName, gs_GpuInfoStringSize, "Vulkan %d.%d.%d (driver: %s)", DevAPIMajor, DevAPIMinor, DevAPIPatch, GetDriverVerson(aBuff, DeviceProp.driverVersion, DeviceProp.vendorID)); + str_format(pVersionName, gs_GpuInfoStringSize, "Vulkan %d.%d.%d (driver: %s)", DevApiMajor, DevApiMinor, DevApiPatch, GetDriverVerson(aBuff, DeviceProp.driverVersion, DeviceProp.vendorID)); // get important device limits m_NonCoherentMemAlignment = DeviceProp.limits.nonCoherentAtomSize;