LookingGlass/client/renderers/EGL/shader/downscale.frag
Geoffrey McRae 91b0cba145 [client] egl: switch from mediump to highp
This fixes a rounding issue on certain hardware (NVidia) which actually
implement mediump as half precision (16-bit) float. It's safe to assume
`highp` is available as if the GPU does not support it, then the shader
compiler will try to find a lower precision that is supported by the GPU
2023-03-05 14:10:21 +11:00

27 lines
528 B
GLSL

#version 300 es
precision highp float;
in vec2 fragCoord;
out vec4 fragColor;
uniform sampler2D texture;
uniform vec3 uConfig;
void main()
{
float pixelSize = uConfig.x;
float vOffset = uConfig.y;
float hOffset = uConfig.z;
vec2 inRes = vec2(textureSize(texture, 0));
ivec2 point = ivec2(
(floor((fragCoord * inRes) / pixelSize) * pixelSize) +
pixelSize / 2.0f
);
point.x += int(pixelSize * hOffset);
point.y += int(pixelSize * vOffset);
fragColor = texelFetch(texture, point, 0);
}