[client] EGL: stop unpacking data across rows

This commit is contained in:
Tudor Brindus 2023-11-05 21:04:58 -05:00 committed by Geoffrey McRae
parent 3106d0e3e2
commit 1da50d220e

View File

@ -11,25 +11,22 @@ uniform vec2 outputSize;
void main()
{
uvec2 inputSize = uvec2(textureSize(sampler1, 0));
uvec2 pos = uvec2(fragCoord * outputSize);
uint outputWidth = uint(outputSize.x);
uvec2 inputSize = uvec2(textureSize(sampler1, 0));
uvec2 outputPos = uvec2(fragCoord * outputSize);
uint output_idx = pos.y * outputWidth + pos.x;
uint fst = outputPos.x * 3u / 4u;
vec4 color_0 = texelFetch(sampler1, ivec2(fst, outputPos.y), 0);
uint fst = output_idx * 3u / 4u;
vec4 color_0 = texelFetch(sampler1, ivec2(fst % inputSize.x, fst / inputSize.x), 0);
uint snd = (outputPos.x * 3u + 1u) / 4u;
vec4 color_1 = texelFetch(sampler1, ivec2(snd, outputPos.y), 0);
uint snd = (output_idx * 3u + 1u) / 4u;
vec4 color_1 = texelFetch(sampler1, ivec2(snd % inputSize.x, snd / inputSize.x), 0);
uint trd = (output_idx * 3u + 2u) / 4u;
vec4 color_2 = texelFetch(sampler1, ivec2(trd % inputSize.x, trd / inputSize.x), 0);
uint trd = (outputPos.x * 3u + 2u) / 4u;
vec4 color_2 = texelFetch(sampler1, ivec2(trd, outputPos.y), 0);
fragColor.bgra = vec4(
color_0.barg[output_idx % 4u],
color_1.gbar[output_idx % 4u],
color_2.rgba[output_idx % 4u],
color_0.barg[outputPos.x % 4u],
color_1.gbar[outputPos.x % 4u],
color_2.rgba[outputPos.x % 4u],
1.0
);
}