Skip to content

Commit

Permalink
Block AMD drivers from after 19.12.1 & before 22.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupeyy committed Oct 3, 2024
1 parent f10d476 commit bf2b7d8
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/engine/client/backend/vulkan/backend_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> &vVKLayers, const std::vector<std::string> &vVKExtensions, bool TryDebugExtensions)
{
std::vector<const char *> vLayersCStr;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit bf2b7d8

Please sign in to comment.