[gtk+/wip/matthiasc/renderpasses] Set up viewport and mvp for secondary render passes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/renderpasses] Set up viewport and mvp for secondary render passes
- Date: Wed, 27 Sep 2017 21:36:28 +0000 (UTC)
commit aefe221aa9961c5def292a7eed24b36355273a79
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 27 17:35:45 2017 -0400
Set up viewport and mvp for secondary render passes
gsk/gskvulkanrender.c | 34 +++++++++++++++++++++++++---------
gsk/gskvulkanrenderpass.c | 2 +-
gsk/gskvulkanrenderprivate.h | 1 +
3 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index d6f134a..5d7ba45 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -65,8 +65,12 @@ typedef struct {
GskVulkanRender *render;
GskVulkanRenderPass *pass;
GskVulkanImage *target;
- cairo_region_t *clip;
+
+ graphene_matrix_t mvp;
int scale_factor;
+ VkRect2D viewport;
+ cairo_region_t *clip;
+
VkRenderPass render_pass;
GskVulkanBuffer *vertex_data;
VkSemaphore signal_semaphore;
@@ -331,15 +335,17 @@ gsk_vulkan_render_add_node (GskVulkanRender *self,
data->render_pass = self->render_pass;
data->signal_semaphore = VK_NULL_HANDLE;
data->wait_semaphores = NULL;
+ data->viewport = self->viewport;
+ data->mvp = self->mvp;
self->render_passes = g_list_prepend (self->render_passes, data);
gsk_vulkan_render_pass_add (data->pass,
self,
- &self->mvp,
+ &data->mvp,
&GRAPHENE_RECT_INIT (
- self->viewport.offset.x, self->viewport.offset.y,
- self->viewport.extent.width, self->viewport.extent.height
+ data->viewport.offset.x, data->viewport.offset.y,
+ data->viewport.extent.width, data->viewport.extent.height
),
node);
}
@@ -372,6 +378,7 @@ void
gsk_vulkan_render_add_node_for_texture (GskVulkanRender *self,
GskVulkanRenderPass *pass,
GskRenderNode *node,
+ const graphene_rect_t *bounds,
GskVulkanImage *target)
{
RenderPassData *data;
@@ -386,6 +393,15 @@ gsk_vulkan_render_add_node_for_texture (GskVulkanRender *self,
gsk_vulkan_image_get_width (target),
gsk_vulkan_image_get_height (target)
});
+ data->viewport.offset = (VkOffset2D) { 0, 0 };
+ data->viewport.extent.width = gsk_vulkan_image_get_width (target);
+ data->viewport.extent.height = gsk_vulkan_image_get_height (target);
+
+ graphene_matrix_init_ortho (&data->mvp,
+ bounds->origin.x, bounds->origin.x + bounds->size.width,
+ bounds->origin.y, bounds->origin.y + bounds->size.height,
+ ORTHO_NEAR_PLANE,
+ ORTHO_FAR_PLANE);
vkCreateSemaphore (gdk_vulkan_context_get_device (self->vulkan),
&(VkSemaphoreCreateInfo) {
@@ -441,10 +457,10 @@ gsk_vulkan_render_add_node_for_texture (GskVulkanRender *self,
gsk_vulkan_render_pass_add (data->pass,
self,
- &self->mvp,
+ &data->mvp,
&GRAPHENE_RECT_INIT (
- self->viewport.offset.x, self->viewport.offset.y,
- self->viewport.extent.width, self->viewport.extent.height
+ data->viewport.offset.x, data->viewport.offset.y,
+ data->viewport.extent.width, data->viewport.extent.height
),
node);
}
@@ -756,8 +772,8 @@ gsk_vulkan_render_draw (GskVulkanRender *self,
&(VkViewport) {
.x = 0,
.y = 0,
- .width = self->viewport.extent.width,
- .height = self->viewport.extent.height,
+ .width = pass->viewport.extent.width,
+ .height = pass->viewport.extent.height,
.minDepth = 0,
.maxDepth = 1
});
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 9d750a6..136dd9c 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -573,7 +573,7 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
ceil (bounds->size.width),
ceil (bounds->size.height));
g_assert (result != NULL);
- gsk_vulkan_render_add_node_for_texture (render, self, node, result);
+ gsk_vulkan_render_add_node_for_texture (render, self, node, bounds, result);
g_assert (result != 0);
return result;
diff --git a/gsk/gskvulkanrenderprivate.h b/gsk/gskvulkanrenderprivate.h
index 9a4ea93..2cce883 100644
--- a/gsk/gskvulkanrenderprivate.h
+++ b/gsk/gskvulkanrenderprivate.h
@@ -72,6 +72,7 @@ void gsk_vulkan_render_add_node (GskVulk
void gsk_vulkan_render_add_node_for_texture (GskVulkanRender *self,
GskVulkanRenderPass *pass,
GskRenderNode *node,
+ const graphene_rect_t *bounds,
GskVulkanImage *target);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]