Browse Source

vulkan: fix shader:send with fields in an array-of-structs.

Sasha Szpakowski 1 year ago
parent
commit
c764626a6a
1 changed files with 13 additions and 2 deletions
  1. 13 2
      src/modules/graphics/vulkan/Shader.cpp

+ 13 - 2
src/modules/graphics/vulkan/Shader.cpp

@@ -411,8 +411,19 @@ void Shader::buildLocalUniforms(spirv_cross::Compiler &comp, const spirv_cross::
 		switch (memberType.basetype)
 		switch (memberType.basetype)
 		{
 		{
 		case SPIRType::Struct:
 		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;
 			continue;
 		case SPIRType::Int:
 		case SPIRType::Int:
 		case SPIRType::UInt:
 		case SPIRType::UInt: