mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-17 12:58:11 +00:00
[client] egl: add framework for multiple scaling algorithms
This commit fixes the issues with the meaning of useNearest being flipped by removing the variable and use enumerations. We define an enumeration EGL_DesktopScaleType to express the type of scaling needed to be performed: no scaling, upscaling, or downscaling. This is updated when either the frame size or the viewport size changes. Previously, we only updated the useNearest when the frame size changes. The desktop shader can now support an enumeration of scaling algorithms, although only nearest and linear are currently implemented. Like before, nearest is used when not scaling or upscaling, and linear is used when downscaling.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
#version 300 es
|
||||
|
||||
#define LG_SCALE_NEAREST 0
|
||||
#define LG_SCALE_LINEAR 1
|
||||
|
||||
in highp vec2 uv;
|
||||
out highp vec4 color;
|
||||
|
||||
uniform sampler2D sampler1;
|
||||
|
||||
uniform int nearest;
|
||||
uniform int scaleAlgo;
|
||||
uniform highp vec2 size;
|
||||
uniform int rotate;
|
||||
|
||||
@@ -36,10 +39,16 @@ void main()
|
||||
ruv.y = uv.x;
|
||||
}
|
||||
|
||||
if(nearest == 1)
|
||||
color = texture(sampler1, ruv);
|
||||
else
|
||||
color = texelFetch(sampler1, ivec2(ruv * size), 0);
|
||||
switch (scaleAlgo)
|
||||
{
|
||||
case LG_SCALE_NEAREST:
|
||||
color = texelFetch(sampler1, ivec2(ruv * size), 0);
|
||||
break;
|
||||
|
||||
case LG_SCALE_LINEAR:
|
||||
color = texture(sampler1, ruv);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cbMode > 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user