mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 06:40:08 +00:00
b4a1ed2a70
Add a GSK_GPU_IMAGE_STRAIGHT_ALPHA and use it for images that have straight alpha. Make sure those images get passed through a premultiplying pass with the new straight alpha shader. Also remove the old Postprocess flags from the Vulkan image that were a leftover from copying that code from the old Vulkan renderer.
45 lines
651 B
GLSL
45 lines
651 B
GLSL
#include "common.glsl"
|
|
|
|
PASS(0) vec2 _pos;
|
|
PASS_FLAT(1) Rect _rect;
|
|
PASS(2) vec2 _tex_coord;
|
|
PASS_FLAT(3) uint _tex_id;
|
|
|
|
|
|
|
|
#ifdef GSK_VERTEX_SHADER
|
|
|
|
IN(0) vec4 in_rect;
|
|
IN(1) vec4 in_tex_rect;
|
|
IN(2) uint in_tex_id;
|
|
|
|
void
|
|
run (out vec2 pos)
|
|
{
|
|
Rect r = rect_from_gsk (in_rect);
|
|
|
|
pos = rect_get_position (r);
|
|
|
|
_pos = pos;
|
|
_rect = r;
|
|
_tex_coord = rect_get_coord (rect_from_gsk (in_tex_rect), pos);
|
|
_tex_id = in_tex_id;
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GSK_FRAGMENT_SHADER
|
|
|
|
void
|
|
run (out vec4 color,
|
|
out vec2 position)
|
|
{
|
|
color = gsk_texture_straight_alpha (_tex_id, _tex_coord) *
|
|
rect_coverage (_rect, _pos);
|
|
position = _pos;
|
|
}
|
|
|
|
#endif
|