From 64ed383128fb09daab761d9a9af9a6112c45bb78 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 10 Aug 2021 07:50:39 +1000 Subject: [PATCH] [client] egl: re-process the texture and invalidate if a setting changed --- client/renderers/EGL/desktop.c | 9 +++++++++ client/renderers/EGL/texture.c | 12 ++++++++++++ client/renderers/EGL/texture.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index c67bef51..b055dee4 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -266,12 +266,14 @@ void egl_desktopConfigUI(EGL_Desktop * desktop) igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0); igPopItemWidth(); + bool invalidateCAS = false; bool cas = desktop->ffxCASEnable; igCheckbox("AMD FidelityFX CAS", &cas); if (cas != desktop->ffxCASEnable) { desktop->ffxCASEnable = cas; egl_textureEnableFilter(desktop->ffxCASHandle, cas); + invalidateCAS = true; } float sharpness = desktop->ffxUniform.f[0]; @@ -286,6 +288,13 @@ void egl_desktopConfigUI(EGL_Desktop * desktop) { desktop->ffxUniform.f[0] = sharpness; egl_shaderSetUniforms(desktop->ffxCAS, &desktop->ffxUniform, 1); + invalidateCAS = true; + } + + if (invalidateCAS) + { + egl_textureInvalidate(desktop->texture); + app_invalidateWindow(true); } } diff --git a/client/renderers/EGL/texture.c b/client/renderers/EGL/texture.c index d159cbcd..2c02e0cf 100644 --- a/client/renderers/EGL/texture.c +++ b/client/renderers/EGL/texture.c @@ -39,6 +39,8 @@ extern const EGL_TextureOps EGL_TextureDMABUF; typedef struct RenderStep { + EGL_Texture *owner; + bool enabled; GLuint fb; GLuint tex; @@ -403,6 +405,7 @@ PostProcessHandle egl_textureAddFilter(EGL_Texture * this, EGL_Shader * shader, RenderStep * step = calloc(1, sizeof(*step)); glGenTextures(1, &step->tex); + step->owner = this; step->shader = shader; step->scale = outputScale; step->uInRes = egl_shaderGetUniform(shader, "uInRes" ); @@ -426,7 +429,16 @@ PostProcessHandle egl_textureAddFilter(EGL_Texture * this, EGL_Shader * shader, void egl_textureEnableFilter(PostProcessHandle * handle, bool enable) { RenderStep * step = (RenderStep *)handle; + if (step->enabled == enable) + return; + step->enabled = enable; + egl_textureInvalidate(step->owner); +} + +void egl_textureInvalidate(EGL_Texture * texture) +{ + texture->postProcessed = false; } float egl_textureGetScale(EGL_Texture * this) diff --git a/client/renderers/EGL/texture.h b/client/renderers/EGL/texture.h index e147daba..04b03a1f 100644 --- a/client/renderers/EGL/texture.h +++ b/client/renderers/EGL/texture.h @@ -176,4 +176,6 @@ PostProcessHandle egl_textureAddFilter(EGL_Texture * texture, void egl_textureEnableFilter(PostProcessHandle * handle, bool enable); +void egl_textureInvalidate(EGL_Texture * texture); + float egl_textureGetScale(EGL_Texture * texture);