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.
This commit is contained in:
Benjamin Otte 2024-10-01 23:55:57 +02:00 committed by Matthias Clasen
parent 874410129e
commit 5a11ee7b9c
3 changed files with 8 additions and 2 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;