vulkan: Don't pass texture coordinates to the color pipeline

This commit is contained in:
Benjamin Otte 2016-12-18 05:59:56 +01:00
parent 5dfb74c70c
commit 4c74695a85
5 changed files with 7 additions and 21 deletions

View File

@ -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

View File

@ -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 {

Binary file not shown.

View File

@ -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;
}

Binary file not shown.