[client] egl: do not use damage when overlays are visible

This allows the overlays to show up correctly.
This commit is contained in:
Quantum 2021-07-11 03:52:41 -04:00 committed by Geoffrey McRae
parent e42747f4e3
commit 00eb26a34f
5 changed files with 31 additions and 19 deletions

View File

@ -124,6 +124,7 @@ struct Inst
bool cursorLastValid;
struct CursorState cursorLast;
bool hadOverlay;
_Atomic(struct DesktopDamage *) desktopDamage;
};
@ -832,6 +833,7 @@ bool egl_render(void * opaque, LG_RendererRotate rotate)
bool hasLastCursor = this->cursorLastValid;
bool cursorRendered = false;
bool hasOverlay = false;
struct CursorState cursorState;
struct DesktopDamage * desktopDamage = NULL;
@ -878,12 +880,15 @@ bool egl_render(void * opaque, LG_RendererRotate rotate)
}
if (!this->waitDone)
{
egl_splash_render(this->splash, a, this->splashRatio);
hasOverlay = true;
}
}
else
else if (!this->start)
{
if (!this->start)
egl_splash_render(this->splash, 1.0f, this->splashRatio);
egl_splash_render(this->splash, 1.0f, this->splashRatio);
hasOverlay = true;
}
if (this->showAlert)
@ -900,13 +905,26 @@ bool egl_render(void * opaque, LG_RendererRotate rotate)
this->cursorLastValid = false;
}
else
{
egl_alert_render(this->alert, this->screenScaleX, this->screenScaleY);
hasOverlay = true;
}
}
hasOverlay |= egl_fps_render(this->fps, this->screenScaleX, this->screenScaleY);
hasOverlay |= egl_help_render(this->help, this->screenScaleX, this->screenScaleY);
if (app_renderImGui())
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
hasOverlay = true;
}
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + 2];
int damageIdx = 0;
if (this->waitDone)
if (!hasOverlay && !this->hadOverlay)
{
if (cursorRendered && hasLastCursor)
{
@ -953,15 +971,7 @@ bool egl_render(void * opaque, LG_RendererRotate rotate)
}
}
}
egl_fps_render(this->fps, this->screenScaleX, this->screenScaleY);
egl_help_render(this->help, this->screenScaleX, this->screenScaleY);
if (app_renderImGui())
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
}
this->hadOverlay = hasOverlay;
app_eglSwapBuffers(this->display, this->surface, damage, damageIdx);
return true;

View File

@ -187,10 +187,10 @@ void egl_fps_update(EGL_FPS * fps, const float avgFPS, const float renderFPS)
fps->font->release(fps->fontObj, bmp);
}
void egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY)
bool egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY)
{
if (!fps->display || !fps->ready)
return;
return false;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -208,4 +208,5 @@ void egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY)
egl_model_render(fps->model);
glDisable(GL_BLEND);
return true;
}

View File

@ -32,4 +32,4 @@ void egl_fps_free(EGL_FPS ** fps);
void egl_fps_set_display(EGL_FPS * fps, bool display);
void egl_fps_set_font (EGL_FPS * fps, LG_Font * fontObj);
void egl_fps_update(EGL_FPS * fps, const float avgUPS, const float avgFPS);
void egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY);
bool egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY);

View File

@ -160,7 +160,7 @@ void egl_help_set_font(EGL_Help * help, LG_FontObj fontObj)
help->fontObj = fontObj;
}
void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY)
bool egl_help_render(EGL_Help * help, const float scaleX, const float scaleY)
{
LG_FontBitmap * bmp = atomic_exchange(&help->bmp, NULL);
if (bmp)
@ -194,7 +194,7 @@ void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY)
}
if (!help->shouldRender)
return;
return false;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -212,4 +212,5 @@ void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY)
egl_model_render(help->model);
glDisable(GL_BLEND);
return true;
}

View File

@ -31,4 +31,4 @@ void egl_help_free(EGL_Help ** help);
void egl_help_set_text(EGL_Help * help, const char * help_text);
void egl_help_set_font(EGL_Help * help, LG_FontObj fontObj);
void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY);
bool egl_help_render(EGL_Help * help, const float scaleX, const float scaleY);