#version 450
#extension GL_EXT_shader_quad_control : require
#extension GL_KHR_shader_subgroup_vote : require
layout(quad_derivatives) in;

layout(set = 0, binding = 0) uniform sampler2D tex1;
layout(set = 0, binding = 1) uniform sampler2D tex2;

layout(location = 0) out vec4 outColor;
layout(location = 0) in vec2 inCoords;

void main()
{
    bool condition = gl_FragCoord.y < 10.0;
    if (subgroupQuadAll(condition))
    {
        outColor = texture(tex1, inCoords);
    }
    else
    {
        if (subgroupQuadAny(condition))
        {
            outColor = texture(tex2, inCoords);
        }
        else
        {
            outColor = vec4(0.0, 0.0, 0.0, 1.0);
        }
    }
}

