mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-12 19:53:24 +02:00
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.
28 lines
582 B
GLSL
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
|
|
}
|