GUI: render backend recovery, part 6

untested OpenGL implementation
This commit is contained in:
tildearrow 2023-07-02 15:10:26 -05:00
parent c49c052ca0
commit 7505915479
2 changed files with 19 additions and 1 deletions

View file

@ -51,6 +51,10 @@ PFNGLGETUNIFORMLOCATIONPROC furGetUniformLocation=NULL;
PFNGLUNIFORM1FPROC furUniform1f=NULL; PFNGLUNIFORM1FPROC furUniform1f=NULL;
PFNGLGETSHADERINFOLOGPROC furGetShaderInfoLog=NULL; PFNGLGETSHADERINFOLOGPROC furGetShaderInfoLog=NULL;
#ifndef USE_GLES
PFNGLGETGRAPHICSRESETSTATUSARBPROC furGetGraphicsResetStatusARB=NULL;
#endif
class FurnaceGLTexture: public FurnaceGUITexture { class FurnaceGLTexture: public FurnaceGUITexture {
public: public:
GLuint id; GLuint id;
@ -359,6 +363,9 @@ bool FurnaceGUIRenderGL::init(SDL_Window* win) {
LOAD_PROC_OPTIONAL(furUniform1f,PFNGLUNIFORM1FPROC,"glUniform1f"); LOAD_PROC_OPTIONAL(furUniform1f,PFNGLUNIFORM1FPROC,"glUniform1f");
LOAD_PROC_OPTIONAL(furGetShaderInfoLog,PFNGLGETSHADERINFOLOGPROC,"glGetShaderInfoLog"); LOAD_PROC_OPTIONAL(furGetShaderInfoLog,PFNGLGETSHADERINFOLOGPROC,"glGetShaderInfoLog");
#ifndef USE_GLES
LOAD_PROC_OPTIONAL(furGetGraphicsResetStatusARB,PFNGLGETGRAPHICSRESETSTATUSARBPROC,"glGetGraphicsResetStatusARB");
#endif
if (createShader(sh_wipe_srcV,sh_wipe_srcF,sh_wipe_vertex,sh_wipe_fragment,sh_wipe_program)) { if (createShader(sh_wipe_srcV,sh_wipe_srcF,sh_wipe_vertex,sh_wipe_fragment,sh_wipe_program)) {
sh_wipe_uAlpha=furGetUniformLocation(sh_wipe_program,"uAlpha"); sh_wipe_uAlpha=furGetUniformLocation(sh_wipe_program,"uAlpha");
@ -383,3 +390,13 @@ bool FurnaceGUIRenderGL::quit() {
void FurnaceGUIRenderGL::quitGUI() { void FurnaceGUIRenderGL::quitGUI() {
ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_Shutdown();
} }
bool FurnaceGUIRenderGL::isDead() {
#ifndef USE_GLES
if (furGetGraphicsResetStatusARB==NULL) return false;
return (furGetGraphicsResetStatusARB()!=GL_NO_ERROR);
#else
// handled by SDL... I think
return false;
#endif
}

View file

@ -57,6 +57,7 @@ class FurnaceGUIRenderGL: public FurnaceGUIRender {
void initGUI(SDL_Window* win); void initGUI(SDL_Window* win);
void quitGUI(); void quitGUI();
bool quit(); bool quit();
bool isDead();
FurnaceGUIRenderGL(): FurnaceGUIRenderGL():
context(NULL), context(NULL),
sdlWin(NULL) { sdlWin(NULL) {