[client] egl: re-process the texture and invalidate if a setting changed

This commit is contained in:
Geoffrey McRae 2021-08-10 07:50:39 +10:00
parent 685499a0e0
commit 64ed383128
3 changed files with 23 additions and 0 deletions

View File

@ -266,12 +266,14 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0); igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0);
igPopItemWidth(); igPopItemWidth();
bool invalidateCAS = false;
bool cas = desktop->ffxCASEnable; bool cas = desktop->ffxCASEnable;
igCheckbox("AMD FidelityFX CAS", &cas); igCheckbox("AMD FidelityFX CAS", &cas);
if (cas != desktop->ffxCASEnable) if (cas != desktop->ffxCASEnable)
{ {
desktop->ffxCASEnable = cas; desktop->ffxCASEnable = cas;
egl_textureEnableFilter(desktop->ffxCASHandle, cas); egl_textureEnableFilter(desktop->ffxCASHandle, cas);
invalidateCAS = true;
} }
float sharpness = desktop->ffxUniform.f[0]; float sharpness = desktop->ffxUniform.f[0];
@ -286,6 +288,13 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
{ {
desktop->ffxUniform.f[0] = sharpness; desktop->ffxUniform.f[0] = sharpness;
egl_shaderSetUniforms(desktop->ffxCAS, &desktop->ffxUniform, 1); egl_shaderSetUniforms(desktop->ffxCAS, &desktop->ffxUniform, 1);
invalidateCAS = true;
}
if (invalidateCAS)
{
egl_textureInvalidate(desktop->texture);
app_invalidateWindow(true);
} }
} }

View File

@ -39,6 +39,8 @@ extern const EGL_TextureOps EGL_TextureDMABUF;
typedef struct RenderStep typedef struct RenderStep
{ {
EGL_Texture *owner;
bool enabled; bool enabled;
GLuint fb; GLuint fb;
GLuint tex; GLuint tex;
@ -403,6 +405,7 @@ PostProcessHandle egl_textureAddFilter(EGL_Texture * this, EGL_Shader * shader,
RenderStep * step = calloc(1, sizeof(*step)); RenderStep * step = calloc(1, sizeof(*step));
glGenTextures(1, &step->tex); glGenTextures(1, &step->tex);
step->owner = this;
step->shader = shader; step->shader = shader;
step->scale = outputScale; step->scale = outputScale;
step->uInRes = egl_shaderGetUniform(shader, "uInRes" ); 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) void egl_textureEnableFilter(PostProcessHandle * handle, bool enable)
{ {
RenderStep * step = (RenderStep *)handle; RenderStep * step = (RenderStep *)handle;
if (step->enabled == enable)
return;
step->enabled = enable; step->enabled = enable;
egl_textureInvalidate(step->owner);
}
void egl_textureInvalidate(EGL_Texture * texture)
{
texture->postProcessed = false;
} }
float egl_textureGetScale(EGL_Texture * this) float egl_textureGetScale(EGL_Texture * this)

View File

@ -176,4 +176,6 @@ PostProcessHandle egl_textureAddFilter(EGL_Texture * texture,
void egl_textureEnableFilter(PostProcessHandle * handle, bool enable); void egl_textureEnableFilter(PostProcessHandle * handle, bool enable);
void egl_textureInvalidate(EGL_Texture * texture);
float egl_textureGetScale(EGL_Texture * texture); float egl_textureGetScale(EGL_Texture * texture);