Browse Source

vulkan: fix shader creation when using a varying matrix.

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

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

@@ -735,8 +735,10 @@ void Shader::compileShaders()
 
 			for (const auto &r : shaderResources.stage_outputs)
 			{
-				const auto &type = comp.get_type(r.type_id);
+				const auto &type = comp.get_type(r.base_type_id);
 				int count = type.array.empty() ? 1 : type.array[0];
+				if (type.op == spv::OpTypeMatrix)
+					count *= type.columns;
 
 				ioLocationMapper(comp, spirv, r.name, count, r.id);
 			}
@@ -745,8 +747,10 @@ void Shader::compileShaders()
 		{
 			for (const auto &r : shaderResources.stage_inputs)
 			{
-				const auto &type = comp.get_type(r.type_id);
+				const auto &type = comp.get_type(r.base_type_id);
 				int count = type.array.empty() ? 1 : type.array[0];
+				if (type.op == spv::OpTypeMatrix)
+					count *= type.columns;
 
 				ioLocationMapper(comp, spirv, r.name, count, r.id);
 			}