[gtk+] vulkan: Fix coordinate setup
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] vulkan: Fix coordinate setup
- Date: Mon, 26 Dec 2016 16:22:42 +0000 (UTC)
commit 3a79b173090c8777498e4cd4e1e7049571ed5375
Author: Benjamin Otte <otte redhat com>
Date: Mon Dec 26 14:49:34 2016 +0100
vulkan: Fix coordinate setup
This makes rendering textures work when the top left of the rendered
texture is not at (0, 0).
gsk/gskvulkanrender.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index 6f57c1d..59c5924 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -57,8 +57,8 @@ gsk_vulkan_render_compute_mvp (GskVulkanRender *self,
if (rect)
{
- self->scissor = (VkRect2D) { { rect->origin.x, rect->origin.y }, { rect->size.width, rect->size.height
} };
- self->viewport = self->scissor;
+ self->scissor = (VkRect2D) { { 0, 0 }, { rect->size.width, rect->size.height } };
+ self->viewport = (VkRect2D) { { rect->origin.x, rect->origin.y }, { rect->size.width,
rect->size.height } };
self->scale_factor = 1;
}
else
@@ -78,8 +78,8 @@ gsk_vulkan_render_compute_mvp (GskVulkanRender *self,
graphene_matrix_init_scale (&modelview, self->scale_factor, self->scale_factor, 1.0);
graphene_matrix_init_ortho (&projection,
- self->viewport.offset.x, self->viewport.extent.width,
- self->viewport.offset.y, self->viewport.extent.height,
+ self->viewport.offset.x, self->viewport.offset.x + self->viewport.extent.width,
+ self->viewport.offset.y, self->viewport.offset.y +
self->viewport.extent.height,
ORTHO_NEAR_PLANE,
ORTHO_FAR_PLANE);
@@ -471,8 +471,8 @@ gsk_vulkan_render_draw (GskVulkanRender *self,
0,
1,
&(VkViewport) {
- .x = self->viewport.offset.x,
- .y = self->viewport.offset.x,
+ .x = 0,
+ .y = 0,
.width = self->viewport.extent.width,
.height = self->viewport.extent.height,
.minDepth = 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]