#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(location = 0) in vec2 vUv;

layout(location = 0) out vec4 result;

layout(binding = 1) uniform Opt
{
    bool preMultiply;
    vec4 multiplier;
} opt;

layout(binding = 2) uniform sampler2D render;

void main()
{
    result = opt.multiplier * texture(render, vUv);
    if (opt.preMultiply)
        result = vec4(result.rgb * result.a, result.a);
}