From c40758209629df1392eef95622bb0167859b72f4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 6 Jul 2024 01:40:16 +0200 Subject: [PATCH] gpu: Make blur op obey ccs Blend ops don't do colorspace conversion, so this commit just hardcodes that and rewrites the shader to use recent APIs. --- gsk/gpu/gskgpublendmodeop.c | 2 +- gsk/gpu/shaders/gskgpublendmode.glsl | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gsk/gpu/gskgpublendmodeop.c b/gsk/gpu/gskgpublendmodeop.c index 7c3ba05143..fde694bde2 100644 --- a/gsk/gpu/gskgpublendmodeop.c +++ b/gsk/gpu/gskgpublendmodeop.c @@ -68,7 +68,7 @@ gsk_gpu_blend_mode_op (GskGpuFrame *frame, gsk_gpu_shader_op_alloc (frame, &GSK_GPU_BLEND_MODE_OP_CLASS, - DEFAULT_COLOR_STATES, + gsk_gpu_color_states_create_equal (TRUE, TRUE), blend_mode, clip, desc, diff --git a/gsk/gpu/shaders/gskgpublendmode.glsl b/gsk/gpu/shaders/gskgpublendmode.glsl index 74c72a1c12..8dee311e1c 100644 --- a/gsk/gpu/shaders/gskgpublendmode.glsl +++ b/gsk/gpu/shaders/gskgpublendmode.glsl @@ -51,11 +51,15 @@ void run (out vec4 color, out vec2 position) { - color = _opacity * blend_mode (gsk_texture (_bottom_id, _bottom_coord) - * rect_coverage (_bottom_rect, _pos), - gsk_texture (_top_id, _top_coord) - * rect_coverage (_top_rect, _pos), - GSK_VARIATION); + vec4 bottom_color = gsk_texture (_bottom_id, _bottom_coord); + bottom_color = output_color_alpha (bottom_color, rect_coverage (_bottom_rect, _pos)); + + vec4 top_color = gsk_texture (_top_id, _top_coord); + top_color = output_color_alpha (top_color, rect_coverage (_top_rect, _pos)); + + color = blend_mode (bottom_color, top_color, GSK_VARIATION); + color = output_color_alpha (color, _opacity); + position = _pos; }