Workaround sampling alpha between eyes

This commit is contained in:
Patrick Nicolas
2026-04-09 12:29:07 +02:00
parent e7450df991
commit bf510a0f76
2 changed files with 16 additions and 9 deletions
+14 -7
View File
@@ -18,6 +18,12 @@
*/
#version 450
layout(push_constant) uniform pc
{
ivec4 rgb_rect;
ivec4 a_rect;
};
#ifdef VERT_SHADER
layout (location = 0) in vec2 vPosition;
@@ -25,12 +31,6 @@ layout (location = 1) in uvec2 vUV;
layout(location = 0) out vec4 outUV;
layout(push_constant) uniform pc
{
ivec4 rgb_rect;
ivec4 a_rect;
};
void main()
{
gl_Position = vec4(vPosition, 0.0, 1.0);
@@ -70,7 +70,14 @@ vec4 sRGB_to_linear_rgba(vec4 x)
void main()
{
if (alpha == 1)
outColor = vec4(texture(rgb[0], inUV.xy).rgb, texture(rgb[1], inUV.zw).r);
{
// Avoid sampling between the eyes
vec2 a = inUV.zw;
float d = a.x - 0.5;
if (abs(d) *a_rect.z < 1)
a.x += (d > 0 ? 1 : -1) / float(a_rect.z);
outColor = vec4(texture(rgb[0], inUV.xy).rgb, texture(rgb[1], a).r);
}
else
outColor = texture(rgb[0], inUV.xy).rgba;