[client] egl: fixes to shader post-process pipeline

This commit is contained in:
Geoffrey McRae 2021-08-11 06:31:01 +10:00
parent cd5ecf3e5a
commit f78154d282
3 changed files with 10 additions and 8 deletions

View File

@ -338,7 +338,7 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
egl_textureEnableFilter(desktop->ffxFSR1Handle[1], egl_textureEnableFilter(desktop->ffxFSR1Handle[1],
fsr1 && desktop->upscale); fsr1 && desktop->upscale);
} }
desktop->ffxFSR1Uniform.f[0] = fsr1Sharpness; desktop->ffxFSR1Uniform.f[0] = 2.0f - fsr1Sharpness * 2.0f;
egl_shaderSetUniforms(desktop->ffxFSR1[1], &desktop->ffxFSR1Uniform, 1); egl_shaderSetUniforms(desktop->ffxFSR1[1], &desktop->ffxFSR1Uniform, 1);
invalidateTex = true; invalidateTex = true;
} }
@ -492,6 +492,12 @@ bool egl_desktopRender(EGL_Desktop * desktop, const float x, const float y,
int scaleAlgo = EGL_SCALE_NEAREST; int scaleAlgo = EGL_SCALE_NEAREST;
struct Rect finalSize;
egl_textureBind(desktop->texture);
egl_textureGetFinalSize(desktop->texture, &finalSize);
if (finalSize.x > desktop->width || finalSize.y > desktop->height)
scaleType = EGL_DESKTOP_DOWNSCALE;
switch (desktop->scaleAlgo) switch (desktop->scaleAlgo)
{ {
case EGL_SCALE_AUTO: case EGL_SCALE_AUTO:
@ -512,10 +518,6 @@ bool egl_desktopRender(EGL_Desktop * desktop, const float x, const float y,
scaleAlgo = desktop->scaleAlgo; scaleAlgo = desktop->scaleAlgo;
} }
struct Rect finalSize;
egl_textureBind(desktop->texture);
egl_textureGetFinalSize(desktop->texture, &finalSize);
egl_desktopRectsMatrix((float *)desktop->matrix->data, egl_desktopRectsMatrix((float *)desktop->matrix->data,
desktop->width, desktop->height, x, y, scaleX, scaleY, rotate); desktop->width, desktop->height, x, y, scaleX, scaleY, rotate);
egl_desktopRectsUpdate(desktop->mesh, rects, desktop->width, desktop->height); egl_desktopRectsUpdate(desktop->mesh, rects, desktop->width, desktop->height);

View File

@ -26,10 +26,10 @@ void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
void main() void main()
{ {
vec2 inRes = vec2(uInRes[0]); vec2 inRes = vec2(uInRes[0]);
uvec2 point = uvec2(iFragCoord * inRes); uvec2 point = uvec2(iFragCoord * (inRes + 0.5f));
uvec4 const0; uvec4 const0;
FsrRcasCon(const0, 1.0f - uSharpness); FsrRcasCon(const0, uSharpness);
FsrRcasF(fragColor.r, fragColor.g, fragColor.b, point, const0); FsrRcasF(fragColor.r, fragColor.g, fragColor.b, point, const0);
fragColor.a = 1.0f; fragColor.a = 1.0f;

View File

@ -265,7 +265,7 @@ static bool rbBindTexture(int index, void * value, void * udata)
glActiveTexture(GL_TEXTURE0 + index); glActiveTexture(GL_TEXTURE0 + index);
glBindTexture(GL_TEXTURE_2D, bi->tex); glBindTexture(GL_TEXTURE_2D, bi->tex);
glBindSampler(0, bd->sampler); glBindSampler(index, bd->sampler);
bd->dimensions[index * 2 + 0] = bi->width; bd->dimensions[index * 2 + 0] = bi->width;
bd->dimensions[index * 2 + 1] = bi->height; bd->dimensions[index * 2 + 1] = bi->height;
return true; return true;