diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 56ae4f37a..71cae3196 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6854,7 +6854,7 @@ bool FurnaceGUI::init() { if (sdlWin==NULL) { const char* sdlErr=SDL_GetError(); lastError=fmt::sprintf("could not open window! %s",sdlErr); - if (settings.renderBackend!="Software" && strcmp(sdlErr,"No matching GL pixel format available")==0) { + if (settings.renderBackend!="Software" && strstr(sdlErr,"matching")!=NULL) { settings.renderBackend="Software"; e->setConf("renderBackend","Software"); e->saveConf(); diff --git a/src/gui/gui.h b/src/gui/gui.h index b7b9785ff..8654b7dfe 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1930,6 +1930,8 @@ class FurnaceGUI { int glBlueSize; int glAlphaSize; int glDepthSize; + int glStencilSize; + int glBufferSize; int glDoubleBuffer; int backupEnable; int backupInterval; @@ -2182,6 +2184,8 @@ class FurnaceGUI { glBlueSize(8), glAlphaSize(0), glDepthSize(24), + glStencilSize(0), + glBufferSize(32), glDoubleBuffer(1), backupEnable(1), backupInterval(30), diff --git a/src/gui/render/renderGL.cpp b/src/gui/render/renderGL.cpp index 161b36b2e..1b4ec6459 100644 --- a/src/gui/render/renderGL.cpp +++ b/src/gui/render/renderGL.cpp @@ -625,6 +625,8 @@ void FurnaceGUIRenderGL::preInit(const DivConfig& conf) { SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,conf.getInt("glAlphaSize",0)); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,conf.getInt("glDoubleBuffer",1)); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,conf.getInt("glDepthSize",24)); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,conf.getInt("glStencilSize",0)); + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,conf.getInt("glBufferSize",32)); } #define LOAD_PROC_MANDATORY(_v,_t,_s) \ diff --git a/src/gui/render/renderGL1.cpp b/src/gui/render/renderGL1.cpp index 0ebf8b391..4daace8ef 100644 --- a/src/gui/render/renderGL1.cpp +++ b/src/gui/render/renderGL1.cpp @@ -275,6 +275,8 @@ void FurnaceGUIRenderGL1::preInit(const DivConfig& conf) { SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,conf.getInt("glAlphaSize",0)); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,conf.getInt("glDoubleBuffer",1)); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,conf.getInt("glDepthSize",24)); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,conf.getInt("glStencilSize",0)); + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,conf.getInt("glBufferSize",32)); } #define LOAD_PROC_MANDATORY(_v,_t,_s) \ diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index cbdc77f07..b5434290a 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -490,6 +490,16 @@ void FurnaceGUI::drawSettings() { if (settings.glDepthSize>128) settings.glDepthSize=128; settingsChanged=true; } + if (ImGui::InputInt("Stencil buffer size",&settings.glStencilSize)) { + if (settings.glStencilSize<0) settings.glStencilSize=0; + if (settings.glStencilSize>32) settings.glStencilSize=32; + settingsChanged=true; + } + if (ImGui::InputInt("Buffer size",&settings.glBufferSize)) { + if (settings.glBufferSize<0) settings.glBufferSize=0; + if (settings.glBufferSize>128) settings.glBufferSize=128; + settingsChanged=true; + } bool glDoubleBufferB=settings.glDoubleBuffer; if (ImGui::Checkbox("Double buffer",&glDoubleBufferB)) { settings.glDoubleBuffer=glDoubleBufferB; @@ -4503,6 +4513,8 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.glBlueSize=conf.getInt("glBlueSize",8); settings.glAlphaSize=conf.getInt("glAlphaSize",0); settings.glDepthSize=conf.getInt("glDepthSize",24); + settings.glStencilSize=conf.getInt("glStencilSize",0); + settings.glBufferSize=conf.getInt("glBufferSize",32); settings.glDoubleBuffer=conf.getInt("glDoubleBuffer",1); settings.vsync=conf.getInt("vsync",1); @@ -5048,6 +5060,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.glBlueSize,0,32); clampSetting(settings.glAlphaSize,0,32); clampSetting(settings.glDepthSize,0,128); + clampSetting(settings.glStencilSize,0,32); clampSetting(settings.glDoubleBuffer,0,1); clampSetting(settings.backupEnable,0,1); clampSetting(settings.backupInterval,10,86400); @@ -5080,6 +5093,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("glBlueSize",settings.glBlueSize); conf.set("glAlphaSize",settings.glAlphaSize); conf.set("glDepthSize",settings.glDepthSize); + conf.set("glStencilSize",settings.glStencilSize); conf.set("glDoubleBuffer",settings.glDoubleBuffer); conf.set("vsync",settings.vsync);