From 8167ef2c4a438085380d4eb3973a10b3c496a6f1 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 12 Nov 2021 07:41:59 +1100 Subject: [PATCH] [client] egl: make use of glsl's textureSize function --- client/renderers/EGL/desktop.c | 7 ------- client/renderers/EGL/shader/desktop_rgb.frag | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index 3192d569..8ffc7bf1 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -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, diff --git a/client/renderers/EGL/shader/desktop_rgb.frag b/client/renderers/EGL/shader/desktop_rgb.frag index 3ee2efee..3dcd8f65 100644 --- a/client/renderers/EGL/shader/desktop_rgb.frag +++ b/client/renderers/EGL/shader/desktop_rgb.frag @@ -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: