[client] egl: allow ffxCAS sharpness configuration

This commit is contained in:
Geoffrey McRae 2021-08-10 00:54:54 +10:00
parent 30e6a258ad
commit 37faccd014
2 changed files with 21 additions and 2 deletions

View File

@ -82,6 +82,7 @@ struct EGL_Desktop
EGL_Shader * ffxCAS; EGL_Shader * ffxCAS;
bool enableCAS; bool enableCAS;
PostProcessHandle ffxCASHandle; PostProcessHandle ffxCASHandle;
EGL_Uniform ffxUniform;
}; };
// forwards // forwards
@ -176,6 +177,11 @@ bool egl_desktopInit(EGL * egl, EGL_Desktop ** desktop_, EGLDisplay * display,
b_shader_basic_vert , b_shader_basic_vert_size, b_shader_basic_vert , b_shader_basic_vert_size,
b_shader_ffx_cas_frag, b_shader_ffx_cas_frag_size); b_shader_ffx_cas_frag, b_shader_ffx_cas_frag_size);
desktop->ffxUniform.type = EGL_UNIFORM_TYPE_1F;
desktop->ffxUniform.location =
egl_shaderGetUniform(desktop->ffxCAS, "uSharpness");
desktop->ffxUniform.f[0] = 0.0f;
setupFilters(desktop); setupFilters(desktop);
return true; return true;
@ -263,6 +269,19 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
desktop->enableCAS = cas; desktop->enableCAS = cas;
egl_textureEnableFilter(desktop->ffxCASHandle, cas); egl_textureEnableFilter(desktop->ffxCASHandle, cas);
} }
float sharpness = desktop->ffxUniform.f[0];
igText("Sharpness:");
igSameLine(0.0f, -1.0f);
igPushItemWidth(igGetWindowWidth() - igGetCursorPosX() - igGetStyle()->WindowPadding.x);
igSliderFloat("##casSharpness", &sharpness, 0.0f, 1.0f, NULL, 0);
igPopItemWidth();
if (sharpness != desktop->ffxUniform.f[0])
{
desktop->ffxUniform.f[0] = sharpness;
egl_shaderSetUniforms(desktop->ffxCAS, &desktop->ffxUniform, 1);
}
} }
bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format) bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)

View File

@ -8,6 +8,7 @@ out vec4 fragColor;
uniform sampler2D iChannel0; uniform sampler2D iChannel0;
uniform uvec2 uInRes[8]; uniform uvec2 uInRes[8];
uniform uvec2 uOutRes; uniform uvec2 uOutRes;
uniform float uSharpness;
// the following are not available until verion 400 or later // the following are not available until verion 400 or later
// so we implement our own versions of them // so we implement our own versions of them
@ -51,12 +52,11 @@ void main()
vec4 color; vec4 color;
vec2 inputResolution = vec2(uInRes[0]); vec2 inputResolution = vec2(uInRes[0]);
vec2 outputResolution = vec2(uOutRes); vec2 outputResolution = vec2(uOutRes);
float sharpnessTuning = 1.0f;
uvec4 const0; uvec4 const0;
uvec4 const1; uvec4 const1;
CasSetup(const0, const1, sharpnessTuning, CasSetup(const0, const1, uSharpness,
inputResolution.x, inputResolution.y, inputResolution.x, inputResolution.y,
outputResolution.x, outputResolution.y); outputResolution.x, outputResolution.y);