[gtk+] vulkan: Allow to control scaling in the blend pipeline
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] vulkan: Allow to control scaling in the blend pipeline
- Date: Sat, 30 Sep 2017 03:09:57 +0000 (UTC)
commit 538e7c79821c754196e89de33162e0bd9a2cb62f
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 29 22:07:30 2017 -0400
vulkan: Allow to control scaling in the blend pipeline
Pass in a second rect that defines the size of the texture.
Update the sole caller to pass in the same rect, for unchanged
behavior.
gsk/gskvulkanblendpipeline.c | 11 ++++++-----
gsk/gskvulkanblendpipelineprivate.h | 3 ++-
gsk/gskvulkanrenderpass.c | 1 +
3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gsk/gskvulkanblendpipeline.c b/gsk/gskvulkanblendpipeline.c
index 6d939ca..2bcd549 100644
--- a/gsk/gskvulkanblendpipeline.c
+++ b/gsk/gskvulkanblendpipeline.c
@@ -93,7 +93,8 @@ gsk_vulkan_blend_pipeline_count_vertex_data (GskVulkanBlendPipeline *pipeline)
void
gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline *pipeline,
guchar *data,
- const graphene_rect_t *rect)
+ const graphene_rect_t *rect,
+ const graphene_rect_t *tex_rect)
{
GskVulkanBlendInstance *instance = (GskVulkanBlendInstance *) data;
@@ -101,10 +102,10 @@ gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline *pipeline,
instance->rect[1] = rect->origin.y;
instance->rect[2] = rect->size.width;
instance->rect[3] = rect->size.height;
- instance->tex_rect[0] = 0.0;
- instance->tex_rect[1] = 0.0;
- instance->tex_rect[2] = 1.0;
- instance->tex_rect[3] = 1.0;
+ instance->tex_rect[0] = (rect->origin.x - tex_rect->origin.x)/tex_rect->size.width;
+ instance->tex_rect[1] = (rect->origin.y - tex_rect->origin.y)/tex_rect->size.height;
+ instance->tex_rect[2] = (rect->size.width + rect->origin.x - tex_rect->origin.x)/tex_rect->size.width;
+ instance->tex_rect[3] = (rect->size.height + rect->origin.y - tex_rect->origin.y)/tex_rect->size.height;
}
gsize
diff --git a/gsk/gskvulkanblendpipelineprivate.h b/gsk/gskvulkanblendpipelineprivate.h
index eb47198..678db00 100644
--- a/gsk/gskvulkanblendpipelineprivate.h
+++ b/gsk/gskvulkanblendpipelineprivate.h
@@ -21,7 +21,8 @@ GskVulkanPipeline * gsk_vulkan_blend_pipeline_new (GdkVulk
gsize gsk_vulkan_blend_pipeline_count_vertex_data (GskVulkanBlendPipeline
*pipeline);
void gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline
*pipeline,
guchar
*data,
- const graphene_rect_t
*rect);
+ const graphene_rect_t
*rect,
+ const graphene_rect_t
*tex_rect);
gsize gsk_vulkan_blend_pipeline_draw (GskVulkanBlendPipeline
*pipeline,
VkCommandBuffer
command_buffer,
gsize
offset,
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index b222b9c..77f4fcd 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -1055,6 +1055,7 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
op->render.vertex_offset = offset + n_bytes;
gsk_vulkan_blend_pipeline_collect_vertex_data (GSK_VULKAN_BLEND_PIPELINE (op->render.pipeline),
data + n_bytes + offset,
+ &op->render.node->bounds,
&op->render.node->bounds);
n_bytes += op->render.vertex_count;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]