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.
This commit is contained in:
Georges Basile Stavracas Neto 2023-04-03 10:06:18 -03:00
parent dde029c3d1
commit db1d278100

View File

@ -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]) {