mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Track the driver state
This commit is contained in:
parent
62e291b4d1
commit
81a11532c5
|
@ -3897,18 +3897,37 @@ void CCommandProcessorFragment_SDL::Cmd_Init(const SCommand_Init *pCommand)
|
||||||
|
|
||||||
*pCommand->m_pInitError = 0;
|
*pCommand->m_pInitError = 0;
|
||||||
|
|
||||||
const char *pErrString = ParseBlocklistDriverVersions(pVendorString, pVersionString);
|
int BlocklistMajor = -1, BlocklistMinor = -1, BlocklistPatch = -1;
|
||||||
|
const char *pErrString = ParseBlocklistDriverVersions(pVendorString, pVersionString, BlocklistMajor, BlocklistMinor, BlocklistPatch);
|
||||||
//if the driver is buggy, and the requested GL version is the default, fallback
|
//if the driver is buggy, and the requested GL version is the default, fallback
|
||||||
if(pErrString != NULL && pCommand->m_RequestedMajor == 3 && pCommand->m_RequestedMinor == 0 && pCommand->m_RequestedPatch == 0)
|
if(pErrString != NULL && pCommand->m_RequestedMajor == 3 && pCommand->m_RequestedMinor == 0 && pCommand->m_RequestedPatch == 0)
|
||||||
{
|
{
|
||||||
// fallback to known good GL version
|
// if not already in the error state, set the GL version
|
||||||
pCommand->m_pCapabilities->m_ContextMajor = 2;
|
if(g_Config.m_GfxDriverIsBlocked == 0)
|
||||||
|
{
|
||||||
|
// fallback to known good GL version
|
||||||
|
pCommand->m_pCapabilities->m_ContextMajor = BlocklistMajor;
|
||||||
|
pCommand->m_pCapabilities->m_ContextMinor = BlocklistMinor;
|
||||||
|
pCommand->m_pCapabilities->m_ContextPatch = BlocklistPatch;
|
||||||
|
|
||||||
|
// set backend error string
|
||||||
|
*pCommand->m_pErrStringPtr = pErrString;
|
||||||
|
*pCommand->m_pInitError = -2;
|
||||||
|
|
||||||
|
g_Config.m_GfxDriverIsBlocked = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if the driver was in a blocked error state, but is not anymore, reset all config variables
|
||||||
|
else if(pErrString == NULL && g_Config.m_GfxDriverIsBlocked == 1)
|
||||||
|
{
|
||||||
|
pCommand->m_pCapabilities->m_ContextMajor = 3;
|
||||||
pCommand->m_pCapabilities->m_ContextMinor = 0;
|
pCommand->m_pCapabilities->m_ContextMinor = 0;
|
||||||
pCommand->m_pCapabilities->m_ContextPatch = 0;
|
pCommand->m_pCapabilities->m_ContextPatch = 0;
|
||||||
|
|
||||||
// set backend error string
|
// tell the caller to reinitialize the context
|
||||||
*pCommand->m_pErrStringPtr = pErrString;
|
|
||||||
*pCommand->m_pInitError = -2;
|
*pCommand->m_pInitError = -2;
|
||||||
|
|
||||||
|
g_Config.m_GfxDriverIsBlocked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MajorV = pCommand->m_pCapabilities->m_ContextMajor;
|
int MajorV = pCommand->m_pCapabilities->m_ContextMajor;
|
||||||
|
|
|
@ -26,13 +26,19 @@ struct SBackEndDriverBlockList
|
||||||
{
|
{
|
||||||
SVersion m_VersionMin;
|
SVersion m_VersionMin;
|
||||||
SVersion m_VersionMax;
|
SVersion m_VersionMax;
|
||||||
|
|
||||||
|
// the OpenGL version, that is supported
|
||||||
|
int m_AllowedMajor;
|
||||||
|
int m_AllowedMinor;
|
||||||
|
int m_AllowedPatch;
|
||||||
|
|
||||||
const char *m_pReason;
|
const char *m_pReason;
|
||||||
};
|
};
|
||||||
|
|
||||||
static SBackEndDriverBlockList gs_aBlockList[] = {
|
static SBackEndDriverBlockList gs_aBlockList[] = {
|
||||||
{{26, 20, 100, 7800}, {26, 20, 100, 7999}, "This Intel driver version can cause crashes, please update it to a newer version and remove any gfx_opengl* config from ddnet_settings.cfg."}};
|
{{26, 20, 100, 7800}, {26, 20, 100, 7999}, 2, 0, 0, "This Intel driver version can cause crashes, please update it to a newer version."}};
|
||||||
|
|
||||||
const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr)
|
const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr, int &BlocklistMajor, int &BlocklistMinor, int &BlocklistPatch)
|
||||||
{
|
{
|
||||||
if(str_find_nocase(pVendorStr, "Intel") == NULL)
|
if(str_find_nocase(pVendorStr, "Intel") == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -59,7 +65,12 @@ const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVe
|
||||||
for(const auto &BlockListItem : gs_aBlockList)
|
for(const auto &BlockListItem : gs_aBlockList)
|
||||||
{
|
{
|
||||||
if(BlockListItem.m_VersionMin <= Version && Version <= BlockListItem.m_VersionMax)
|
if(BlockListItem.m_VersionMin <= Version && Version <= BlockListItem.m_VersionMax)
|
||||||
|
{
|
||||||
|
BlocklistMajor = BlockListItem.m_AllowedMajor;
|
||||||
|
BlocklistMinor = BlockListItem.m_AllowedMinor;
|
||||||
|
BlocklistPatch = BlockListItem.m_AllowedPatch;
|
||||||
return BlockListItem.m_pReason;
|
return BlockListItem.m_pReason;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
#ifndef ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
||||||
#define ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
#define ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
||||||
|
|
||||||
const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr);
|
const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr, int &BlocklistMajor, int &BlocklistMinor, int &BlocklistPatch);
|
||||||
|
|
||||||
#endif // ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
#endif // ENGINE_CLIENT_BLOCKLIST_DRIVER_H
|
||||||
|
|
|
@ -395,6 +395,7 @@ MACRO_CONFIG_INT(GfxOpenGLPatch, gfx_opengl_patch, 0, 0, 10, CFGFLAG_SAVE | CFGF
|
||||||
MACRO_CONFIG_INT(GfxOpenGLTextureLODBIAS, gfx_opengl_texture_lod_bias, -500, -15000, 15000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "The lod bias for OpenGL texture sampling multiplied by 1000")
|
MACRO_CONFIG_INT(GfxOpenGLTextureLODBIAS, gfx_opengl_texture_lod_bias, -500, -15000, 15000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "The lod bias for OpenGL texture sampling multiplied by 1000")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(Gfx3DTextureAnalysisDone, gfx_3d_texture_analysis_done, 0, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Analyzed, if sampling 3D/2D array textures was correct")
|
MACRO_CONFIG_INT(Gfx3DTextureAnalysisDone, gfx_3d_texture_analysis_done, 0, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Analyzed, if sampling 3D/2D array textures was correct")
|
||||||
|
MACRO_CONFIG_INT(GfxDriverIsBlocked, gfx_driver_is_blocked, 0, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "If 1, the current driver is in a blocked error state.")
|
||||||
#if !defined(CONF_PLATFORM_MACOSX)
|
#if !defined(CONF_PLATFORM_MACOSX)
|
||||||
MACRO_CONFIG_INT(GfxEnableTextureUnitOptimization, gfx_enable_texture_unit_optimization, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Use multiple texture units, instead of only one.")
|
MACRO_CONFIG_INT(GfxEnableTextureUnitOptimization, gfx_enable_texture_unit_optimization, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Use multiple texture units, instead of only one.")
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -4,15 +4,17 @@
|
||||||
|
|
||||||
TEST(BlocklistDriver, Valid)
|
TEST(BlocklistDriver, Valid)
|
||||||
{
|
{
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7810"), "This Intel driver version can cause crashes, please update it to a newer version and remove any gfx_opengl* config from ddnet_settings.cfg.");
|
int Major, Minor, Patch;
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7926"), "This Intel driver version can cause crashes, please update it to a newer version and remove any gfx_opengl* config from ddnet_settings.cfg.");
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7810", Major, Minor, Patch), "This Intel driver version can cause crashes, please update it to a newer version.");
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7985"), "This Intel driver version can cause crashes, please update it to a newer version and remove any gfx_opengl* config from ddnet_settings.cfg.");
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7926", Major, Minor, Patch), "This Intel driver version can cause crashes, please update it to a newer version.");
|
||||||
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7985", Major, Minor, Patch), "This Intel driver version can cause crashes, please update it to a newer version.");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlocklistDriver, Invalid)
|
TEST(BlocklistDriver, Invalid)
|
||||||
{
|
{
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 25.20.100.7810"), NULL);
|
int Major, Minor, Patch;
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7799"), NULL);
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 25.20.100.7810", Major, Minor, Patch), NULL);
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.8000"), NULL);
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7799", Major, Minor, Patch), NULL);
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 27.20.100.7900"), NULL);
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.8000", Major, Minor, Patch), NULL);
|
||||||
|
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 27.20.100.7900", Major, Minor, Patch), NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue