mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-11-27 11:48:23 +00:00
[client] egl: cleanup texture filtering/post-processing
This commit is contained in:
@@ -5,10 +5,10 @@ precision mediump float;
|
||||
layout(location = 0) in vec2 uVertex;
|
||||
layout(location = 1) in vec2 uUV;
|
||||
|
||||
out vec2 iFragCoord;
|
||||
out vec2 fragCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(uVertex, 0.0, 1.0);
|
||||
iFragCoord = uUV;
|
||||
fragCoord = uUV;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,10 @@ precision mediump float;
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
in vec2 iFragCoord;
|
||||
in vec2 fragCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D iChannel0;
|
||||
uniform uvec2 uInRes[8];
|
||||
uniform uvec2 uOutRes;
|
||||
uniform sampler2D texture;
|
||||
uniform float uSharpness;
|
||||
|
||||
#define A_GPU 1
|
||||
@@ -18,7 +16,7 @@ uniform float uSharpness;
|
||||
|
||||
vec3 imageLoad(ivec2 point)
|
||||
{
|
||||
return texelFetch(iChannel0, point, 0).rgb;
|
||||
return texelFetch(texture, point, 0).rgb;
|
||||
}
|
||||
|
||||
AF3 CasLoad(ASU2 p)
|
||||
@@ -32,18 +30,15 @@ void CasInput(inout AF1 r,inout AF1 g,inout AF1 b) {}
|
||||
|
||||
void main()
|
||||
{
|
||||
uvec2 point = uvec2(iFragCoord * vec2(uInRes[0].xy));
|
||||
vec2 res = vec2(textureSize(texture, 0));
|
||||
uvec2 point = uvec2(fragCoord * res);
|
||||
|
||||
vec4 color;
|
||||
vec2 inputResolution = vec2(uInRes[0]);
|
||||
vec2 outputResolution = vec2(uOutRes);
|
||||
|
||||
uvec4 const0;
|
||||
uvec4 const1;
|
||||
|
||||
CasSetup(const0, const1, uSharpness,
|
||||
inputResolution.x, inputResolution.y,
|
||||
outputResolution.x, outputResolution.y);
|
||||
res.x, res.y, res.x, res.y);
|
||||
|
||||
CasFilter(
|
||||
fragColor.r, fragColor.g, fragColor.b,
|
||||
|
||||
@@ -3,11 +3,10 @@ precision mediump float;
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
in vec2 iFragCoord;
|
||||
in vec2 fragCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D iChannel0;
|
||||
uniform uvec2 uInRes[8];
|
||||
uniform sampler2D texture;
|
||||
uniform uvec2 uOutRes;
|
||||
|
||||
#define A_GPU 1
|
||||
@@ -20,7 +19,8 @@ uniform uvec2 uOutRes;
|
||||
|
||||
vec4 _textureGather(sampler2D tex, vec2 uv, int comp)
|
||||
{
|
||||
ivec2 p = ivec2((uv * vec2(uInRes[0])) - 0.5f);
|
||||
vec2 res = vec2(textureSize(tex, 0));
|
||||
ivec2 p = ivec2((uv * res) - 0.5f);
|
||||
vec4 c0 = texelFetchOffset(tex, p, 0, ivec2(0,1));
|
||||
vec4 c1 = texelFetchOffset(tex, p, 0, ivec2(1,1));
|
||||
vec4 c2 = texelFetchOffset(tex, p, 0, ivec2(1,0));
|
||||
@@ -28,18 +28,18 @@ vec4 _textureGather(sampler2D tex, vec2 uv, int comp)
|
||||
return vec4(c0[comp], c1[comp], c2[comp],c3[comp]);
|
||||
}
|
||||
|
||||
AF4 FsrEasuRF(AF2 p){return AF4(_textureGather(iChannel0, p, 0));}
|
||||
AF4 FsrEasuGF(AF2 p){return AF4(_textureGather(iChannel0, p, 1));}
|
||||
AF4 FsrEasuBF(AF2 p){return AF4(_textureGather(iChannel0, p, 2));}
|
||||
AF4 FsrEasuRF(AF2 p){return AF4(_textureGather(texture, p, 0));}
|
||||
AF4 FsrEasuGF(AF2 p){return AF4(_textureGather(texture, p, 1));}
|
||||
AF4 FsrEasuBF(AF2 p){return AF4(_textureGather(texture, p, 2));}
|
||||
|
||||
#include "ffx_fsr1.h"
|
||||
|
||||
void main()
|
||||
{
|
||||
AU4 con0, con1, con2, con3;
|
||||
vec2 inRes = vec2(uInRes[0]);
|
||||
vec2 inRes = vec2(textureSize(texture, 0));
|
||||
vec2 outRes = vec2(uOutRes);
|
||||
|
||||
AU4 con0, con1, con2, con3;
|
||||
FsrEasuCon(
|
||||
con0,
|
||||
con1,
|
||||
@@ -51,7 +51,7 @@ void main()
|
||||
);
|
||||
|
||||
vec3 color;
|
||||
uvec2 point = uvec2(iFragCoord * outRes);
|
||||
uvec2 point = uvec2(fragCoord * outRes);
|
||||
FsrEasuF(color, point, con0, con1, con2, con3);
|
||||
fragColor = vec4(color.xyz, 1);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ precision mediump float;
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
in vec2 iFragCoord;
|
||||
in vec2 fragCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D iChannel0;
|
||||
uniform uvec2 uInRes[8];
|
||||
uniform sampler2D texture;
|
||||
uniform float uSharpness;
|
||||
|
||||
#define A_GPU 1
|
||||
@@ -16,7 +15,7 @@ uniform float uSharpness;
|
||||
|
||||
#include "ffx_a.h"
|
||||
|
||||
AF4 FsrRcasLoadF(ASU2 p) { return texelFetch(iChannel0, ASU2(p), 0); }
|
||||
AF4 FsrRcasLoadF(ASU2 p) { return texelFetch(texture, ASU2(p), 0); }
|
||||
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
|
||||
|
||||
#define FSR_RCAS_F 1
|
||||
@@ -25,8 +24,8 @@ void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 inRes = vec2(uInRes[0]);
|
||||
uvec2 point = uvec2(iFragCoord * (inRes + 0.5f));
|
||||
vec2 inRes = vec2(textureSize(texture, 0));
|
||||
uvec2 point = uvec2(fragCoord * (inRes + 0.5f));
|
||||
|
||||
uvec4 const0;
|
||||
FsrRcasCon(const0, uSharpness);
|
||||
|
||||
Reference in New Issue
Block a user