Merge branch 'for-main' into 'main'

gpu: Add GSK_GPU_DISABLE=repeat

See merge request GNOME/gtk!7791
This commit is contained in:
Matthias Clasen 2024-10-04 00:48:58 +00:00
commit 3b027cf466
4 changed files with 9 additions and 4 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

@ -25,8 +25,7 @@ setups = [
{ 'backend': 'wayland', 'if': wayland_enabled, 'is_default': true, },
{ 'name': 'wayland_gl',
'backend': 'wayland', 'if': wayland_enabled,
'env': ['GDK_DEBUG=gl-prefer-gl,default-settings',
], },
'env': ['GDK_DISABLE=gles-api' ], },
{ 'backend': 'win32', 'if': os_win32 },
{ 'backend': 'broadway', 'if': broadway_enabled, },
{ 'backend': 'win32', 'if': os_win32 },