Workaround sampling alpha between eyes
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user