Skip to content

Commit

Permalink
[client] egl: make use of glsl's textureSize function
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Nov 11, 2021
1 parent a21eee2 commit 8167ef2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 0 additions & 7 deletions client/renderers/EGL/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ struct DesktopShader
EGL_Shader * shader;
GLint uTransform;
GLint uDesktopSize;
GLint uTextureSize;
GLint uScaleAlgo;
GLint uNVGain;
GLint uCBMode;
Expand Down Expand Up @@ -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" );
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions client/renderers/EGL/shader/desktop_rgb.frag
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ out vec4 color;
uniform sampler2D sampler1;

uniform int scaleAlgo;
uniform ivec2 textureSize;

uniform float nvGain;
uniform int cbMode;
Expand All @@ -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:
Expand Down

0 comments on commit 8167ef2

Please sign in to comment.