From 7f1bd1f0470d5f802911efd6572c2d61677e5499 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 10 May 2023 00:08:24 +0200 Subject: [PATCH] vulkan: Handle empty child bounds in repeat node Also add test to the testsuite for it. --- gsk/vulkan/gskvulkanimage.c | 2 ++ gsk/vulkan/gskvulkanrenderpass.c | 3 +++ .../compare/repeat-empty-child-bounds.node | 24 ++++++++++++++++++ .../gsk/compare/repeat-empty-child-bounds.png | Bin 0 -> 119 bytes testsuite/gsk/meson.build | 1 + 5 files changed, 30 insertions(+) create mode 100644 testsuite/gsk/compare/repeat-empty-child-bounds.node create mode 100644 testsuite/gsk/compare/repeat-empty-child-bounds.png diff --git a/gsk/vulkan/gskvulkanimage.c b/gsk/vulkan/gskvulkanimage.c index b6b44ecc8c..5888cb0a23 100644 --- a/gsk/vulkan/gskvulkanimage.c +++ b/gsk/vulkan/gskvulkanimage.c @@ -209,6 +209,8 @@ gsk_vulkan_image_new (GdkVulkanContext *context, VkMemoryRequirements requirements; GskVulkanImage *self; + g_assert (width > 0 && height > 0); + self = g_object_new (GSK_TYPE_VULKAN_IMAGE, NULL); self->vulkan = g_object_ref (context); diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 556502af7a..0b1d431161 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -725,6 +725,9 @@ gsk_vulkan_render_pass_add_repeat_node (GskVulkanRenderPass *self, .render.node = node }; + if (graphene_rect_get_area (gsk_repeat_node_get_child_bounds (node)) == 0) + return TRUE; + if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds)) pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE; else if (constants->clip.type == GSK_VULKAN_CLIP_RECT) diff --git a/testsuite/gsk/compare/repeat-empty-child-bounds.node b/testsuite/gsk/compare/repeat-empty-child-bounds.node new file mode 100644 index 0000000000..b2dee849f3 --- /dev/null +++ b/testsuite/gsk/compare/repeat-empty-child-bounds.node @@ -0,0 +1,24 @@ +repeat { + bounds: 0 0 100 100; + child-bounds: 0 0 0 0; + child: color { + bounds: 0 0 20 20; + color: rgb(255,0,0); + } +} +repeat { + bounds: 0 0 100 100; + child-bounds: 0 0 20 0; + child: color { + bounds: 0 0 20 20; + color: rgb(0,128,0); + } +} +repeat { + bounds: 0 0 100 100; + child-bounds: 0 0 0 20; + child: color { + bounds: 0 0 20 20; + color: rgb(0,0,255); + } +} diff --git a/testsuite/gsk/compare/repeat-empty-child-bounds.png b/testsuite/gsk/compare/repeat-empty-child-bounds.png new file mode 100644 index 0000000000000000000000000000000000000000..1cf45d8688fc68c85c4d250d14eaf6fdf153ec82 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^DImYvN4 fzW~T20yHdVoU??1aarlqK9FipS3j3^P6