From: Georges Basile Stavracas Neto Date: Mon, 3 Apr 2023 13:06:18 +0000 (-0300) Subject: gsk/vulkan/renderpass: Don't scale scissor and render area X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~446^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=db1d2781007cb5a9e5ff4d03305743351286da11;p=gtk4.git gsk/vulkan/renderpass: Don't scale scissor and render area The rects passed to the clip region are in buffer coordinates, and must not be scaled. Consider the following scenario: Wayland, with a 1024x768@2 window. That gives us a 2048x1536 raw image. To setup the Vulkan render pass code, we'd scale 2048x1536 *again*, to an unreasonable 4196x3072, which is (1) incorrect and (2) really incorrect and (3) can lead to crashes at best, full GPU resets at worst - and a GPU reset is incredibly not fun! Now that we pass the right clip regions at the right coordinates at all times, remove the extra scaling from the render pass. --- diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 458d2b1fa4..24432ddd06 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -2258,8 +2258,8 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self, 0, 1, &(VkRect2D) { - { rect.x * self->scale_x, rect.y * self->scale_y }, - { rect.width * self->scale_x, rect.height * self->scale_y } + { rect.x, rect.y }, + { rect.width, rect.height } }); vkCmdBeginRenderPass (command_buffer, @@ -2268,8 +2268,8 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self, .renderPass = self->render_pass, .framebuffer = gsk_vulkan_render_get_framebuffer (render, self->target), .renderArea = { - { rect.x * self->scale_x, rect.y * self->scale_y }, - { rect.width * self->scale_x, rect.height * self->scale_y } + { rect.x, rect.y }, + { rect.width, rect.height } }, .clearValueCount = 1, .pClearValues = (VkClearValue [1]) {