From 0ed45c5f40d624b04fbe76bd7a0ff250c220e641 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 29 Aug 2023 11:16:27 +0200 Subject: [PATCH] gpu: Move global syncing out This is necessary so that fallback code can properly sync itself, instead of just add_node(). Fixes a bunch of glitches when fallbacks would be used. --- gsk/gpu/gskgpunodeprocessor.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index 91f1de5463..551de9948d 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -142,6 +142,20 @@ gsk_gpu_node_processor_emit_scissor_op (GskGpuNodeProcessor *self) self->pending_globals &= ~GSK_GPU_GLOBAL_SCISSOR; } +static void +gsk_gpu_node_processor_sync_globals (GskGpuNodeProcessor *self, + GskGpuGlobals ignored) +{ + GskGpuGlobals required; + + required = self->pending_globals & ~ignored; + + if (required & (GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP)) + gsk_gpu_node_processor_emit_globals_op (self); + if (required & GSK_GPU_GLOBAL_SCISSOR) + gsk_gpu_node_processor_emit_scissor_op (self); +} + void gsk_gpu_node_processor_process (GskGpuFrame *frame, GskGpuImage *target, @@ -273,6 +287,8 @@ gsk_gpu_node_processor_add_fallback_node (GskGpuNodeProcessor *self, { GskGpuImage *image; + gsk_gpu_node_processor_sync_globals (self, 0); + image = gsk_gpu_upload_cairo_op (self->frame, node, &self->scale, @@ -669,7 +685,6 @@ gsk_gpu_node_processor_add_node (GskGpuNodeProcessor *self, GskRenderNode *node) { GskRenderNodeType node_type; - GskGpuGlobals required_globals; /* This catches the corner cases of empty nodes, so after this check * there's quaranteed to be at least 1 pixel that needs to be drawn */ @@ -686,11 +701,7 @@ gsk_gpu_node_processor_add_node (GskGpuNodeProcessor *self, return; } - required_globals = self->pending_globals & ~nodes_vtable[node_type].ignored_globals; - if (required_globals & (GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP)) - gsk_gpu_node_processor_emit_globals_op (self); - if (required_globals & GSK_GPU_GLOBAL_SCISSOR) - gsk_gpu_node_processor_emit_scissor_op (self); + gsk_gpu_node_processor_sync_globals (self, nodes_vtable[node_type].ignored_globals); g_assert ((self->pending_globals & ~nodes_vtable[node_type].ignored_globals) == 0); if (nodes_vtable[node_type].process_node)