From 93c6bf726a98b370f25e68c47c5ac989ab8fcaa5 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 12 Apr 2022 09:47:36 -0400 Subject: [PATCH] Fixup vertex normals --- libxiv | 2 +- renderer/src/renderer.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libxiv b/libxiv index f883585..f674fbe 160000 --- a/libxiv +++ b/libxiv @@ -1 +1 @@ -Subproject commit f8835854a3656f6212d647e7c7ce7c0c50c698b7 +Subproject commit f674fbe75bad269c6a00d9e4e5262df285b05152 diff --git a/renderer/src/renderer.cpp b/renderer/src/renderer.cpp index cb97a31..1ea7e9d 100644 --- a/renderer/src/renderer.cpp +++ b/renderer/src/renderer.cpp @@ -572,12 +572,14 @@ void Renderer::initPipeline() { normalAttribute.location = 1; normalAttribute.offset = offsetof(Vertex, normal); + std::array attributes = {positionAttribute, normalAttribute}; + VkPipelineVertexInputStateCreateInfo vertexInputState = {}; vertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputState.vertexBindingDescriptionCount = 1; vertexInputState.pVertexBindingDescriptions = &binding; - vertexInputState.vertexAttributeDescriptionCount = 1; - vertexInputState.pVertexAttributeDescriptions = &positionAttribute; + vertexInputState.vertexAttributeDescriptionCount = attributes.size(); + vertexInputState.pVertexAttributeDescriptions = attributes.data(); VkPipelineInputAssemblyStateCreateInfo inputAssembly = {}; inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;