From 4c74695a859b2826bced79af71c316ff673dca7a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 18 Dec 2016 05:59:56 +0100 Subject: [PATCH] vulkan: Don't pass texture coordinates to the color pipeline --- gsk/gskvulkancolorpipeline.c | 22 +++++++--------------- gsk/resources/vulkan/color.frag.glsl | 2 -- gsk/resources/vulkan/color.frag.spv | Bin 892 -> 804 bytes gsk/resources/vulkan/color.vert.glsl | 4 ---- gsk/resources/vulkan/color.vert.spv | Bin 1104 -> 948 bytes 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/gsk/gskvulkancolorpipeline.c b/gsk/gskvulkancolorpipeline.c index b7dc8f4ccb..6702537896 100644 --- a/gsk/gskvulkancolorpipeline.c +++ b/gsk/gskvulkancolorpipeline.c @@ -13,8 +13,6 @@ struct _GskVulkanVertex { float x; float y; - float tex_x; - float tex_y; }; G_DEFINE_TYPE (GskVulkanColorPipeline, gsk_vulkan_color_pipeline, GSK_TYPE_VULKAN_PIPELINE) @@ -25,7 +23,7 @@ gsk_vulkan_color_pipeline_get_input_state_create_info (GskVulkanPipeline *self) static const VkVertexInputBindingDescription vertexBindingDescriptions[] = { { .binding = 0, - .stride = 4 * sizeof (float), + .stride = sizeof (GskVulkanVertex), .inputRate = VK_VERTEX_INPUT_RATE_VERTEX } }; @@ -35,12 +33,6 @@ gsk_vulkan_color_pipeline_get_input_state_create_info (GskVulkanPipeline *self) .binding = 0, .format = VK_FORMAT_R32G32_SFLOAT, .offset = 0, - }, - { - .location = 1, - .binding = 0, - .format = VK_FORMAT_R32G32_SFLOAT, - .offset = 2 * sizeof (float), } }; static const VkPipelineVertexInputStateCreateInfo info = { @@ -98,12 +90,12 @@ gsk_vulkan_color_pipeline_collect_vertex_data (GskVulkanColorPipeline *pipeline, { GskVulkanVertex *vertices = (GskVulkanVertex *) data; - vertices[0] = (GskVulkanVertex) { rect->origin.x, rect->origin.y, 0.0, 0.0 }; - vertices[1] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y, 1.0, 0.0 }; - vertices[2] = (GskVulkanVertex) { rect->origin.x, rect->origin.y + rect->size.height, 0.0, 1.0 }; - vertices[3] = (GskVulkanVertex) { rect->origin.x, rect->origin.y + rect->size.height, 0.0, 1.0 }; - vertices[4] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y, 1.0, 0.0 }; - vertices[5] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y + rect->size.height, 1.0, 1.0 }; + vertices[0] = (GskVulkanVertex) { rect->origin.x, rect->origin.y }; + vertices[1] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y }; + vertices[2] = (GskVulkanVertex) { rect->origin.x, rect->origin.y + rect->size.height }; + vertices[3] = (GskVulkanVertex) { rect->origin.x, rect->origin.y + rect->size.height }; + vertices[4] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y }; + vertices[5] = (GskVulkanVertex) { rect->origin.x + rect->size.width, rect->origin.y + rect->size.height }; } gsize diff --git a/gsk/resources/vulkan/color.frag.glsl b/gsk/resources/vulkan/color.frag.glsl index 952f9b7f21..fba9e47120 100644 --- a/gsk/resources/vulkan/color.frag.glsl +++ b/gsk/resources/vulkan/color.frag.glsl @@ -1,7 +1,5 @@ #version 420 core -layout(location = 0) in vec2 inTexCoord; - layout(set = 0, binding = 0) uniform sampler2D inTexture; layout(push_constant) uniform PushConstants { diff --git a/gsk/resources/vulkan/color.frag.spv b/gsk/resources/vulkan/color.frag.spv index 45ffde52a7ccbff22fd6fa2eeff2774fd29b74c5..beee876b1766f81a3300a7044cc4aefc323d0e0c 100644 GIT binary patch delta 120 zcmeyvwuFtBnMs+Qfq@YSIT*wz@|p^>F|aT&fN^eOW*(5qz&SDUGNagJN5*PFF(6k7 xBnAZTKt*Dc?=qfdm1N*#5T1OONm)?@C@u`d3P3qgkRl)eiCIJWVv`k_qXEo^4we7_ delta 208 zcmZ3&_J@s^nMs+Qfq@YSIT)lS@|udXGq5l)fN^eOW*(5qzzM{n6GJbHiUJv#c_FD4 z&iVO8DGUs(Kqxs`ld)P6BqImJAm9$vED5BQz&t2_@>a&vrs6;uVW21*5HkU>0+25P wq#1!2ByJ7mgG>X7Ndm1Fo7~EztSAoTi2*T4hXjxY0gxC-2Z%2@`6N>`0O4E|w*UYD diff --git a/gsk/resources/vulkan/color.vert.glsl b/gsk/resources/vulkan/color.vert.glsl index 2522b7e0ef..849d5cd517 100644 --- a/gsk/resources/vulkan/color.vert.glsl +++ b/gsk/resources/vulkan/color.vert.glsl @@ -1,19 +1,15 @@ #version 420 core layout(location = 0) in vec2 inPosition; -layout(location = 1) in vec2 inTexCoord; layout(push_constant) uniform PushConstants { mat4 mvp; } push; -layout(location = 0) out vec2 outTexCoord; - out gl_PerVertex { vec4 gl_Position; }; void main() { gl_Position = push.mvp * vec4 (inPosition, 0.0, 1.0); - outTexCoord = inTexCoord; } diff --git a/gsk/resources/vulkan/color.vert.spv b/gsk/resources/vulkan/color.vert.spv index 3deee1c8e2a792b01265279178a88a50f7f957a9..a7ca96a42546d99e7319d7539ab79b1befc0fc84 100644 GIT binary patch delta 70 zcmcb>v4x$NnMs+Qfq@YSIT#cs@|ubRc|gDd#JP!?c_20y5Q|Mrd_TE@v1Bt3lLq7D O6y_5ge}P&ofEWO6;|u@* delta 221 zcmdnOeu0CRnMs+Qfq@YSIT%zX@|wzXGJpUJ5a%Xl=7HE;Kr9Btia@M1G4j0{D+4Q- zlV4gAl3L-MpI?*$6k%mh0xHPNg9%M`V=R+(2bu)ZCkMnJ0OEs`f%uG@cQR@->M8(* z6o6c2AQk~)YbYP24I~EQivnqoHpa;hnNF+N0!2V7m7$_`Ky@J1ApT#VPb`2K0Lz&g AGXMYp