[gtk+/wip/otte/vulkan: 36/62] gsk: Pass texture coordinates to Vulkan renderer
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/vulkan: 36/62] gsk: Pass texture coordinates to Vulkan renderer
- Date: Fri, 9 Dec 2016 17:37:58 +0000 (UTC)
commit a7cbbaf8fcb35bc0b53f5386d42135eb0d97a12f
Author: Benjamin Otte <otte redhat com>
Date: Mon Dec 5 23:07:56 2016 +0100
gsk: Pass texture coordinates to Vulkan renderer
We just render the coordinates as color, we don't do anything with them
yet.
gsk/gskvulkanpipeline.c | 10 ++++++++--
gsk/gskvulkanrenderer.c | 12 ++++++------
gsk/resources/vulkan/blit.frag.glsl | 4 +++-
gsk/resources/vulkan/blit.frag.spv | Bin 420 -> 564 bytes
gsk/resources/vulkan/blit.vert.glsl | 6 +++++-
gsk/resources/vulkan/blit.vert.spv | Bin 692 -> 848 bytes
6 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/gsk/gskvulkanpipeline.c b/gsk/gskvulkanpipeline.c
index 8da3f27..93f0cf7 100644
--- a/gsk/gskvulkanpipeline.c
+++ b/gsk/gskvulkanpipeline.c
@@ -95,17 +95,23 @@ gsk_vulkan_pipeline_new (GdkVulkanContext *context,
.pVertexBindingDescriptions =
(VkVertexInputBindingDescription[]) {
{
.binding = 0,
- .stride = 2 * sizeof(float),
+ .stride = 4 * sizeof (float),
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
}
},
- .vertexAttributeDescriptionCount = 1,
+ .vertexAttributeDescriptionCount = 2,
.pVertexAttributeDescriptions =
(VkVertexInputAttributeDescription[]) {
{
.location = 0,
.binding = 0,
.format = VK_FORMAT_R32G32_SFLOAT,
.offset = 0,
+ },
+ {
+ .location = 1,
+ .binding = 0,
+ .format = VK_FORMAT_R32G32_SFLOAT,
+ .offset = 2 * sizeof (float),
}
}
},
diff --git a/gsk/gskvulkanrenderer.c b/gsk/gskvulkanrenderer.c
index dddcc5a..d846449 100644
--- a/gsk/gskvulkanrenderer.c
+++ b/gsk/gskvulkanrenderer.c
@@ -277,13 +277,13 @@ gsk_vulkan_renderer_do_render_commands (GskVulkanRenderer *self,
{
GskVulkanBuffer *buffer;
float pts[] = {
- -1.0, -1.0,
- 1.0, -1.0,
- -1.0, 1.0,
+ -1.0, -1.0, 0.0, 0.0,
+ 1.0, -1.0, 1.0, 0.0,
+ -1.0, 1.0, 0.0, 1.0,
- -1.0, 1.0,
- 1.0, -1.0,
- 1.0, 1.0
+ -1.0, 1.0, 0.0, 1.0,
+ 1.0, -1.0, 1.0, 0.0,
+ 1.0, 1.0, 1.0, 1.0
};
guchar *data;
diff --git a/gsk/resources/vulkan/blit.frag.glsl b/gsk/resources/vulkan/blit.frag.glsl
index 94f76e4..acc8680 100644
--- a/gsk/resources/vulkan/blit.frag.glsl
+++ b/gsk/resources/vulkan/blit.frag.glsl
@@ -1,8 +1,10 @@
#version 420 core
+layout(location = 0) in vec2 inTexCoord;
+
layout(location = 0) out vec4 color;
void main()
{
- color = vec4(1.0, 1.0, 0.0, 1.0);
+ color = vec4 (inTexCoord, 0.0, 1.0);
}
diff --git a/gsk/resources/vulkan/blit.frag.spv b/gsk/resources/vulkan/blit.frag.spv
index 76adb08..05fd469 100644
Binary files a/gsk/resources/vulkan/blit.frag.spv and b/gsk/resources/vulkan/blit.frag.spv differ
diff --git a/gsk/resources/vulkan/blit.vert.glsl b/gsk/resources/vulkan/blit.vert.glsl
index ae45000..3865405 100644
--- a/gsk/resources/vulkan/blit.vert.glsl
+++ b/gsk/resources/vulkan/blit.vert.glsl
@@ -1,11 +1,15 @@
#version 420 core
layout(location = 0) in vec2 inPosition;
+layout(location = 1) in vec2 inTexCoord;
+
+layout(location = 0) out vec2 outTexCoord;
out gl_PerVertex {
vec4 gl_Position;
};
void main() {
- gl_Position = vec4(inPosition, 0.0, 1.0);
+ gl_Position = vec4 (inPosition, 0.0, 1.0);
+ outTexCoord = inTexCoord;
}
diff --git a/gsk/resources/vulkan/blit.vert.spv b/gsk/resources/vulkan/blit.vert.spv
index 41ea691..6641397 100644
Binary files a/gsk/resources/vulkan/blit.vert.spv and b/gsk/resources/vulkan/blit.vert.spv differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]