[client] egl: keep the mouse cursor 1:1 when downscaling

This keeps the cursor a usable size when the guest is running a high
resolution and downscaling (ie, 4K -> FHD).
This commit is contained in:
Geoffrey McRae
2021-10-22 23:19:56 +11:00
parent 74444f8eed
commit d69069fb09
8 changed files with 137 additions and 52 deletions

View File

@@ -5,11 +5,25 @@ in vec2 uv;
out vec4 color;
uniform sampler2D sampler1;
uniform float scale;
void main()
{
vec4 tmp = texture(sampler1, uv);
vec4 tmp;
if (scale > 1.0)
{
vec2 ts = vec2(textureSize(sampler1, 0));
vec2 px = (uv - (0.5 / ts)) * ts;
if (px.x < 0.0 || px.y < 0.0)
discard;
tmp = texelFetch(sampler1, ivec2(px), 0);
}
else
tmp = texture(sampler1, uv);
if (tmp.rgb == vec3(0.0, 0.0, 0.0))
discard;
color = tmp;
}