Compare commits

...

2 Commits

Author SHA1 Message Date
Benjamin Otte
1a5dc094f3 gpu: Add GSK_GPU_DISABLE=repeat
This is useful for testing of repeat nodes - both performance
and conformance, and potentially even driver issues with GL_REPEAT.

We have code for manual repeating anyway, so adding a flag to force
always using it is easy.
2024-10-02 00:04:08 +02:00
Benjamin Otte
5fc7b191fe gtkpango: Use repeat nodes properly
Instead of trying to set the bounds of the repeat node child via a
transprent color node, use the child_bounds argument.
2024-10-02 00:04:08 +02:00
4 changed files with 9 additions and 6 deletions

View File

@@ -3265,6 +3265,7 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self,
const graphene_rect_t *child_bounds;
graphene_rect_t bounds;
float tile_left, tile_right, tile_top, tile_bottom;
gboolean avoid_offscreen;
child = gsk_repeat_node_get_child (node);
child_bounds = gsk_repeat_node_get_child_bounds (node);
@@ -3279,10 +3280,12 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self,
tile_right = (bounds.origin.x + bounds.size.width - child_bounds->origin.x) / child_bounds->size.width;
tile_top = (bounds.origin.y - child_bounds->origin.y) / child_bounds->size.height;
tile_bottom = (bounds.origin.y + bounds.size.height - child_bounds->origin.y) / child_bounds->size.height;
avoid_offscreen = !gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_REPEAT);
/* the 1st check tests that a tile fully fits into the bounds,
* the 2nd check is to catch the case where it fits exactly */
if (ceilf (tile_left) < floorf (tile_right) &&
if (!avoid_offscreen &&
ceilf (tile_left) < floorf (tile_right) &&
bounds.size.width > child_bounds->size.width)
{
if (ceilf (tile_top) < floorf (tile_bottom) &&
@@ -3320,7 +3323,8 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self,
}
}
}
else if (ceilf (tile_top) < floorf (tile_bottom) &&
else if (!avoid_offscreen &&
ceilf (tile_top) < floorf (tile_bottom) &&
bounds.size.height > child_bounds->size.height)
{
/* repeat horizontally, tile vertically */

View File

@@ -32,6 +32,7 @@ static const GdkDebugKey gsk_gpu_optimization_keys[] = {
{ "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" },
{ "to-image", GSK_GPU_OPTIMIZE_TO_IMAGE, "Don't fast-path creation of images for nodes" },
{ "occlusion", GSK_GPU_OPTIMIZE_OCCLUSION_CULLING, "Disable occlusion culling via opaque node tracking" },
{ "repeat", GSK_GPU_OPTIMIZE_REPEAT, "Repeat drawing operations instead of using offscreen and GL_REPEAT" },
};
typedef struct _GskGpuRendererPrivate GskGpuRendererPrivate;

View File

@@ -139,5 +139,6 @@ typedef enum {
GSK_GPU_OPTIMIZE_MIPMAP = 1 << 4,
GSK_GPU_OPTIMIZE_TO_IMAGE = 1 << 5,
GSK_GPU_OPTIMIZE_OCCLUSION_CULLING = 1 << 6,
GSK_GPU_OPTIMIZE_REPEAT = 1 << 7,
} GskGpuOptimizations;

View File

@@ -211,7 +211,7 @@ gsk_pango_renderer_draw_error_underline (PangoRenderer *renderer,
gtk_snapshot_push_repeat (crenderer->snapshot,
&GRAPHENE_RECT_INIT (xx, yy, ww, hh),
NULL);
&GRAPHENE_RECT_INIT (xx, yy, 1.5 * hh, hh));
gsk_rounded_rect_init_from_rect (&dot,
&GRAPHENE_RECT_INIT (xx, yy, hh, hh),
@@ -220,9 +220,6 @@ gsk_pango_renderer_draw_error_underline (PangoRenderer *renderer,
gtk_snapshot_push_rounded_clip (crenderer->snapshot, &dot);
gtk_snapshot_append_color2 (crenderer->snapshot, &color, &dot.bounds);
gtk_snapshot_pop (crenderer->snapshot);
gtk_snapshot_append_color2 (crenderer->snapshot,
&GDK_COLOR_SRGB (0, 0, 0, 0),
&GRAPHENE_RECT_INIT (xx, yy, 1.5 * hh, hh));
gdk_color_finish (&color);