summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-05-16 17:18:19 +0200
committerBenjamin Otte <otte@redhat.com>2023-05-16 18:53:27 +0200
commit2b0ad09423ce8b3e5885a8a396e37949f66e702d (patch)
tree25b7af6f24450e332b53bd4529acb23541e159f6
parentf5955feea1cd0d5ebe457b8685ac27e03a02bf97 (diff)
downloadgtk+-2b0ad09423ce8b3e5885a8a396e37949f66e702d.tar.gz
vulkan: Make projection matrix match GL
Vulkan has a different initial coordinate system to GL. GL: (-1, 1, -1) +------+. |`. | `. | `·--|---· | : | : +------+. : `. : `.: `·------· (1, -1, 1) Vulkan: (-1, -1, 0) +------+. |`. | `. | `·--|---· | : | : +------+. : `. : `.: `·------· (1, 1, 1) so adjust the near and far plane we pass to graphene_matrix_init_ortho() to make it end up with the same projection as the GL renderer.
-rw-r--r--gsk/vulkan/gskvulkanrenderpass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c
index c23aa0ba7b..f364b7f4c1 100644
--- a/gsk/vulkan/gskvulkanrenderpass.c
+++ b/gsk/vulkan/gskvulkanrenderpass.c
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
graphene_matrix_init_ortho (&self->p,
viewport->origin.x, viewport->origin.x + viewport->size.width,
viewport->origin.y, viewport->origin.y + viewport->size.height,
- ORTHO_NEAR_PLANE,
+ 2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
ORTHO_FAR_PLANE);
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass