From c764626a6ae519b7772ff3060c3a67c3900e50ac Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 30 Mar 2024 12:20:52 -0300 Subject: [PATCH] vulkan: fix shader:send with fields in an array-of-structs. --- src/modules/graphics/vulkan/Shader.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/vulkan/Shader.cpp b/src/modules/graphics/vulkan/Shader.cpp index 8f606e9fa..44582a397 100644 --- a/src/modules/graphics/vulkan/Shader.cpp +++ b/src/modules/graphics/vulkan/Shader.cpp @@ -411,8 +411,19 @@ void Shader::buildLocalUniforms(spirv_cross::Compiler &comp, const spirv_cross:: switch (memberType.basetype) { case SPIRType::Struct: - name += "."; - buildLocalUniforms(comp, memberType, offset, name); + if (memberType.op == spv::OpTypeArray) + { + for (uint32 i = 0; i < memberType.array[0]; i++) + { + std::string structname = name + "[" + std::to_string(i) + "]."; + buildLocalUniforms(comp, memberType, offset, structname); + } + } + else + { + std::string structname = name = "."; + buildLocalUniforms(comp, memberType, offset, structname); + } continue; case SPIRType::Int: case SPIRType::UInt: