Make fallback stronger and safer

This commit is contained in:
Jupeyy 2021-08-18 12:03:42 +02:00
parent 551369cda1
commit 55abc3f7bb
3 changed files with 9 additions and 1 deletions

View file

@ -1741,12 +1741,14 @@ bool CCommandProcessorFragment_OpenGL2::Cmd_Init(const SCommand_Init *pCommand)
glUseProgram(0); glUseProgram(0);
} }
if(g_Config.m_Gfx3DTextureAnalysisDone == 0) if(g_Config.m_Gfx3DTextureAnalysisDone == 0 || str_comp(g_Config.m_Gfx3DTextureAnalysisRenderer, pCommand->m_pRendererString) != 0 || str_comp(g_Config.m_Gfx3DTextureAnalysisVersion, pCommand->m_pVersionString) != 0)
{ {
AnalysisCorrect = IsTileMapAnalysisSucceeded(); AnalysisCorrect = IsTileMapAnalysisSucceeded();
if(AnalysisCorrect) if(AnalysisCorrect)
{ {
g_Config.m_Gfx3DTextureAnalysisDone = 1; g_Config.m_Gfx3DTextureAnalysisDone = 1;
str_copy(g_Config.m_Gfx3DTextureAnalysisRenderer, pCommand->m_pRendererString, sizeof(g_Config.m_Gfx3DTextureAnalysisRenderer) / sizeof(g_Config.m_Gfx3DTextureAnalysisRenderer[0]));
str_copy(g_Config.m_Gfx3DTextureAnalysisVersion, pCommand->m_pVersionString, sizeof(g_Config.m_Gfx3DTextureAnalysisVersion) / sizeof(g_Config.m_Gfx3DTextureAnalysisVersion[0]));
} }
} }
} }

View file

@ -347,6 +347,8 @@ static bool BackendInitGlew(EBackendType BackendType, int &GlewMajor, int &GlewM
GlewPatch = 0; GlewPatch = 0;
return true; return true;
} }
// Don't allow GL 3.3, if the driver doesn't support atleast OpenGL 4.5
#ifndef CONF_PLATFORM_WINDOWS
if(GLEW_VERSION_4_4) if(GLEW_VERSION_4_4)
{ {
GlewMajor = 4; GlewMajor = 4;
@ -389,6 +391,7 @@ static bool BackendInitGlew(EBackendType BackendType, int &GlewMajor, int &GlewM
GlewPatch = 0; GlewPatch = 0;
return true; return true;
} }
#endif
if(GLEW_VERSION_3_0) if(GLEW_VERSION_3_0)
{ {
GlewMajor = 3; GlewMajor = 3;

View file

@ -403,6 +403,9 @@ 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_STR(Gfx3DTextureAnalysisRenderer, gfx_3d_texture_analysis_renderer, 128, "", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The renderer on which the analysis was performed")
MACRO_CONFIG_STR(Gfx3DTextureAnalysisVersion, gfx_3d_texture_analysis_version, 128, "", CFGFLAG_SAVE | CFGFLAG_CLIENT, "The version on which the analysis was performed")
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.") 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_MACOS) #if !defined(CONF_PLATFORM_MACOS)
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.")