2020-11-06 17:18:55 +00:00
|
|
|
#include "blocklist_driver.h"
|
|
|
|
|
|
|
|
#include <base/system.h>
|
|
|
|
|
|
|
|
#define VERSION_PARTS 4
|
|
|
|
|
|
|
|
struct SVersion
|
|
|
|
{
|
|
|
|
int m_Parts[VERSION_PARTS];
|
|
|
|
|
|
|
|
bool operator<=(const SVersion &Other) const
|
|
|
|
{
|
|
|
|
for(int i = 0; i < VERSION_PARTS; i++)
|
|
|
|
{
|
|
|
|
if(m_Parts[i] < Other.m_Parts[i])
|
|
|
|
return true;
|
|
|
|
if(m_Parts[i] > Other.m_Parts[i])
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* TODO: generalize it more for other drivers / vendors */
|
|
|
|
struct SBackEndDriverBlockList
|
|
|
|
{
|
|
|
|
SVersion m_VersionMin;
|
|
|
|
SVersion m_VersionMax;
|
2020-11-07 05:54:08 +00:00
|
|
|
|
|
|
|
// the OpenGL version, that is supported
|
|
|
|
int m_AllowedMajor;
|
|
|
|
int m_AllowedMinor;
|
|
|
|
int m_AllowedPatch;
|
|
|
|
|
2020-11-06 17:18:55 +00:00
|
|
|
const char *m_pReason;
|
|
|
|
};
|
|
|
|
|
|
|
|
static SBackEndDriverBlockList gs_aBlockList[] = {
|
2020-12-03 15:42:50 +00:00
|
|
|
{{26, 20, 100, 7800}, {27, 20, 100, 8853}, 2, 0, 0, "This Intel driver version can cause crashes, please update it to a newer version."}};
|
2020-11-06 17:18:55 +00:00
|
|
|
|
2020-11-07 05:54:08 +00:00
|
|
|
const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr, int &BlocklistMajor, int &BlocklistMinor, int &BlocklistPatch)
|
2020-11-06 17:18:55 +00:00
|
|
|
{
|
|
|
|
if(str_find_nocase(pVendorStr, "Intel") == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
const char *pVersionStrStart = str_find_nocase(pVersionStr, "Build ");
|
|
|
|
if(pVersionStrStart == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
// ignore "Build ", after that, it should directly start with the driver version
|
|
|
|
pVersionStrStart += (ptrdiff_t)str_length("Build ");
|
|
|
|
|
|
|
|
char aVersionStrHelper[512]; // the size is random, but shouldn't be too small probably
|
|
|
|
|
|
|
|
SVersion Version;
|
|
|
|
for(int &VersionPart : Version.m_Parts)
|
|
|
|
{
|
|
|
|
pVersionStrStart = str_next_token(pVersionStrStart, ".", aVersionStrHelper, sizeof(aVersionStrHelper));
|
|
|
|
if(pVersionStrStart == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
VersionPart = str_toint(aVersionStrHelper);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(const auto &BlockListItem : gs_aBlockList)
|
|
|
|
{
|
|
|
|
if(BlockListItem.m_VersionMin <= Version && Version <= BlockListItem.m_VersionMax)
|
2020-11-07 05:54:08 +00:00
|
|
|
{
|
|
|
|
BlocklistMajor = BlockListItem.m_AllowedMajor;
|
|
|
|
BlocklistMinor = BlockListItem.m_AllowedMinor;
|
|
|
|
BlocklistPatch = BlockListItem.m_AllowedPatch;
|
2020-11-06 17:18:55 +00:00
|
|
|
return BlockListItem.m_pReason;
|
2020-11-07 05:54:08 +00:00
|
|
|
}
|
2020-11-06 17:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|