Files
kitty/kitty/graphics_fragment.glsl
Kovid Goyal 248301f8b3 Cleanup a bunch of shader infrastructure
1) No longer us glScissor. It's an awful API and is not available in
   Vulkan. Instead the graphics drawing code ensures the graphic is
   drawn within the current viewport

2) Use generated code to automatically get the locations of uniforms
   from shaders. Greatly simplifies adding new uniforms to a shader.

3) Dont use a VAO for loading graphics vertices. Greatly simplifies
   a bunch of book keeping code.
2023-06-22 19:38:05 +05:30

28 lines
582 B
GLSL

#pragma kitty_include_shader <alpha_blend.glsl>
#define ALPHA_TYPE
uniform sampler2D image;
#ifdef ALPHA_MASK
uniform vec3 amask_fg;
uniform vec4 amask_bg_premult;
#else
uniform float inactive_text_alpha;
#endif
in vec2 texcoord;
out vec4 color;
void main() {
color = texture(image, texcoord);
#ifdef ALPHA_MASK
color = vec4(amask_fg, color.r);
color = vec4(color.rgb * color.a, color.a);
color = alpha_blend_premul(color, amask_bg_premult);
#else
color.a *= inactive_text_alpha;
#ifdef PREMULT
color = vec4(color.rgb * color.a, color.a);
#endif
#endif
}