#version 430
#extension GL_ARB_bindless_texture : require

#include "ssbo_ui.glslshared"

layout(std430, binding=0) buffer Elems
{
	ssbo_ui elems[];
};
smooth in vec2 uv;
flat in int inst;
out vec4 out_Color;

void main(void)
{
	vec4 c = unpackUnorm4x8(elems[inst].fg) * texture(sampler2D(elems[inst].tex), uv);
	out_Color = fma(vec4(1.0 - c.a), unpackUnorm4x8(elems[inst].bg), c);
}
