From c0aba9aee19d74e9b3b86c77240094ea5db90612 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 5 Jul 2024 02:31:38 +0200 Subject: [PATCH] gpu: Make crossfade op obey ccs I didn't have an idea what to use the alternate color state for, so I don't use it. --- gsk/gpu/gskgpucrossfadeop.c | 3 ++- gsk/gpu/gskgpucrossfadeopprivate.h | 1 + gsk/gpu/gskgpunodeprocessor.c | 1 + gsk/gpu/shaders/gskgpucrossfade.glsl | 14 ++++++++------ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gsk/gpu/gskgpucrossfadeop.c b/gsk/gpu/gskgpucrossfadeop.c index 83bee0d352..6c82a63b28 100644 --- a/gsk/gpu/gskgpucrossfadeop.c +++ b/gsk/gpu/gskgpucrossfadeop.c @@ -52,6 +52,7 @@ static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = { void gsk_gpu_cross_fade_op (GskGpuFrame *frame, GskGpuShaderClip clip, + GskGpuColorStates color_states, GskGpuDescriptors *desc, const graphene_rect_t *rect, const graphene_point_t *offset, @@ -66,7 +67,7 @@ gsk_gpu_cross_fade_op (GskGpuFrame *frame, gsk_gpu_shader_op_alloc (frame, &GSK_GPU_CROSS_FADE_OP_CLASS, - DEFAULT_COLOR_STATES, + color_states, 0, clip, desc, diff --git a/gsk/gpu/gskgpucrossfadeopprivate.h b/gsk/gpu/gskgpucrossfadeopprivate.h index d39ce1dfcf..0e7a89611d 100644 --- a/gsk/gpu/gskgpucrossfadeopprivate.h +++ b/gsk/gpu/gskgpucrossfadeopprivate.h @@ -8,6 +8,7 @@ G_BEGIN_DECLS void gsk_gpu_cross_fade_op (GskGpuFrame *frame, GskGpuShaderClip clip, + GskGpuColorStates color_states, GskGpuDescriptors *desc, const graphene_rect_t *rect, const graphene_point_t *offset, diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index f80ed80303..7d929e9dc8 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -2511,6 +2511,7 @@ gsk_gpu_node_processor_add_cross_fade_node (GskGpuNodeProcessor *self, gsk_gpu_cross_fade_op (self->frame, gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds), + gsk_gpu_node_processor_color_states_for_rgba (self), self->desc, &node->bounds, &self->offset, diff --git a/gsk/gpu/shaders/gskgpucrossfade.glsl b/gsk/gpu/shaders/gskgpucrossfade.glsl index 043adc170b..c7665d9c5a 100644 --- a/gsk/gpu/shaders/gskgpucrossfade.glsl +++ b/gsk/gpu/shaders/gskgpucrossfade.glsl @@ -52,12 +52,14 @@ void run (out vec4 color, out vec2 position) { - color = gsk_texture (_start_id, _start_coord) * - rect_coverage (_start_rect, _pos) * - _start_opacity + - gsk_texture (_end_id, _end_coord) * - rect_coverage (_end_rect, _pos) * - _end_opacity; + vec4 start = output_color_alpha (gsk_texture (_start_id, _start_coord), + rect_coverage (_start_rect, _pos) * + _start_opacity); + vec4 end = output_color_alpha (gsk_texture (_end_id, _end_coord), + rect_coverage (_end_rect, _pos) * + _end_opacity); + + color = start + end; position = _pos; }