21 lines
501 B
GLSL
21 lines
501 B
GLSL
#version 450
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
|
|
layout(location = 0) in vec2 glyphUV;
|
|
layout(location = 1) in vec4 glyphColor;
|
|
|
|
layout(location = 0) out vec4 result;
|
|
|
|
layout(std140, binding = 1) uniform Opt
|
|
{
|
|
bool preMultiply;
|
|
} opt;
|
|
|
|
layout(binding = 2) uniform sampler2D atlas;
|
|
|
|
void main()
|
|
{
|
|
result = vec4(glyphColor.r, glyphColor.g, glyphColor.b, glyphColor.a * texture(atlas, glyphUV).r);
|
|
if (opt.preMultiply)
|
|
result = vec4(result.rgb * result.a, result.a);
|
|
} |