diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index a3db26d5ae..7deb928d4b 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -384,7 +384,8 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame, clip, viewport); - if (!gsk_gpu_node_processor_add_first_node (&self, + if (!gsk_gpu_frame_should_optimize (frame, GSK_GPU_OPTIMIZE_OCCLUSION_CULLING) || + !gsk_gpu_node_processor_add_first_node (&self, target, clip, GSK_RENDER_PASS_PRESENT, diff --git a/gsk/gpu/gskgpurenderer.c b/gsk/gpu/gskgpurenderer.c index 999ab9966d..132c843fa1 100644 --- a/gsk/gpu/gskgpurenderer.c +++ b/gsk/gpu/gskgpurenderer.c @@ -24,12 +24,13 @@ #define GSK_GPU_MAX_FRAMES 4 static const GdkDebugKey gsk_gpu_optimization_keys[] = { - { "clear", GSK_GPU_OPTIMIZE_CLEAR, "Use shaders instead of vkCmdClearAttachment()/glClear()" }, - { "merge", GSK_GPU_OPTIMIZE_MERGE, "Use one vkCmdDraw()/glDrawArrays() per operation" }, - { "blit", GSK_GPU_OPTIMIZE_BLIT, "Use shaders instead of vkCmdBlit()/glBlitFramebuffer()" }, - { "gradients", GSK_GPU_OPTIMIZE_GRADIENTS, "Don't supersample gradients" }, - { "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" }, - { "to-image", GSK_GPU_OPTIMIZE_TO_IMAGE, "Don't fast-path creation of images for nodes" }, + { "clear", GSK_GPU_OPTIMIZE_CLEAR, "Use shaders instead of vkCmdClearAttachment()/glClear()" }, + { "merge", GSK_GPU_OPTIMIZE_MERGE, "Use one vkCmdDraw()/glDrawArrays() per operation" }, + { "blit", GSK_GPU_OPTIMIZE_BLIT, "Use shaders instead of vkCmdBlit()/glBlitFramebuffer()" }, + { "gradients", GSK_GPU_OPTIMIZE_GRADIENTS, "Don't supersample gradients" }, + { "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" }, }; typedef struct _GskGpuRendererPrivate GskGpuRendererPrivate; diff --git a/gsk/gpu/gskgputypesprivate.h b/gsk/gpu/gskgputypesprivate.h index c7ead752d2..bac2903b77 100644 --- a/gsk/gpu/gskgputypesprivate.h +++ b/gsk/gpu/gskgputypesprivate.h @@ -119,5 +119,6 @@ typedef enum { GSK_GPU_OPTIMIZE_GRADIENTS = 1 << 3, GSK_GPU_OPTIMIZE_MIPMAP = 1 << 4, GSK_GPU_OPTIMIZE_TO_IMAGE = 1 << 5, + GSK_GPU_OPTIMIZE_OCCLUSION_CULLING = 1 << 6, } GskGpuOptimizations;