diff --git a/src/rendering/vulkan/renderer/vk_renderpass.cpp b/src/rendering/vulkan/renderer/vk_renderpass.cpp index 53940d044..111c1dc20 100644 --- a/src/rendering/vulkan/renderer/vk_renderpass.cpp +++ b/src/rendering/vulkan/renderer/vk_renderpass.cpp @@ -71,11 +71,13 @@ int VkRenderPassManager::GetVertexFormat(int numBindingPoints, int numAttributes VkVertexFormat fmt; fmt.NumBindingPoints = numBindingPoints; fmt.Stride = stride; - fmt.UseVertexData = false; + fmt.UseVertexData = 0; for (int j = 0; j < numAttributes; j++) { if (attrs[j].location == VATTR_COLOR) - fmt.UseVertexData = true; + fmt.UseVertexData |= 1; + else if (attrs[j].location == VATTR_NORMAL) + fmt.UseVertexData |= 2; fmt.Attrs.push_back(attrs[j]); } VertexFormats.push_back(fmt); @@ -264,7 +266,7 @@ void VkRenderPassSetup::CreatePipeline(const VkRenderPassKey &key) VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, - VK_FORMAT_A2R10G10B10_SNORM_PACK32 + VK_FORMAT_A2B10G10R10_SNORM_PACK32 }; bool inputLocations[6] = { false, false, false, false, false, false }; diff --git a/src/rendering/vulkan/renderer/vk_renderpass.h b/src/rendering/vulkan/renderer/vk_renderpass.h index e8232dadf..0294c93c3 100644 --- a/src/rendering/vulkan/renderer/vk_renderpass.h +++ b/src/rendering/vulkan/renderer/vk_renderpass.h @@ -60,7 +60,7 @@ public: int NumBindingPoints; size_t Stride; std::vector Attrs; - bool UseVertexData; + int UseVertexData; }; class VkRenderPassManager diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index f8de93ba0..86da9868a 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -42,7 +42,7 @@ void main() vec4 eyeCoordPos = ViewMatrix * worldcoord; #ifdef HAS_UNIFORM_VERTEX_DATA - if (useVertexData == 0) + if ((useVertexData & 1) == 0) vColor = uVertexColor; else vColor = aColor; @@ -79,7 +79,7 @@ void main() } #ifdef HAS_UNIFORM_VERTEX_DATA - if (useVertexData == 0) + if ((useVertexData & 2) == 0) vWorldNormal = NormalModelMatrix * vec4(uVertexNormal.xyz, 1.0); else vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0);