[client] egl: make use of glsl's textureSize function

This commit is contained in:
Geoffrey McRae 2021-11-12 07:41:59 +11:00
parent a21eee26ab
commit 8167ef2c4a
2 changed files with 2 additions and 9 deletions

View File

@ -46,7 +46,6 @@ struct DesktopShader
EGL_Shader * shader;
GLint uTransform;
GLint uDesktopSize;
GLint uTextureSize;
GLint uScaleAlgo;
GLint uNVGain;
GLint uCBMode;
@ -105,7 +104,6 @@ static bool egl_initDesktopShader(
shader->uTransform = egl_shaderGetUniform(shader->shader, "transform" );
shader->uDesktopSize = egl_shaderGetUniform(shader->shader, "desktopSize");
shader->uTextureSize = egl_shaderGetUniform(shader->shader, "textureSize");
shader->uScaleAlgo = egl_shaderGetUniform(shader->shader, "scaleAlgo" );
shader->uNVGain = egl_shaderGetUniform(shader->shader, "nvGain" );
shader->uCBMode = egl_shaderGetUniform(shader->shader, "cbMode" );
@ -428,11 +426,6 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
.location = shader->uDesktopSize,
.f = { desktop->width, desktop->height },
},
{
.type = EGL_UNIFORM_TYPE_2I,
.location = shader->uTextureSize,
.i = { finalSizeX, finalSizeY },
},
{
.type = EGL_UNIFORM_TYPE_M3x2FV,
.location = shader->uTransform,

View File

@ -14,7 +14,6 @@ out vec4 color;
uniform sampler2D sampler1;
uniform int scaleAlgo;
uniform ivec2 textureSize;
uniform float nvGain;
uniform int cbMode;
@ -24,7 +23,8 @@ void main()
switch (scaleAlgo)
{
case EGL_SCALE_NEAREST:
color = texelFetch(sampler1, ivec2(uv * vec2(textureSize)), 0);
vec2 ts = vec2(textureSize(sampler1, 0));
color = texelFetch(sampler1, ivec2(uv * ts), 0);
break;
case EGL_SCALE_LINEAR: