@@ -54,16 +54,14 @@ void VkShaderGenerator::emitInputs(GenContext& context, ShaderStage& stage) cons
5454 const VariableBlock& vertexData = stage.getInputBlock (HW::VERTEX_DATA);
5555 if (!vertexData.empty ())
5656 {
57- emitComment (" Inputs: " + vertexData.getName (), stage);
58- for (size_t i = 0 ; i < vertexData.size (); ++i)
59- {
60-
61- emitLineBegin (stage);
62- emitString (" layout (location = " + std::to_string (i) + " ) " , stage);
63- emitVariableDeclaration (vertexData[i], _syntax->getInputQualifier (), context, stage, false );
64- emitString (Syntax::SEMICOLON, stage);
65- emitLineEnd (stage, false );
66- }
57+ emitString (" layout (location = " + std::to_string (vertexDataLocation) + " ) " +
58+ _syntax->getInputQualifier () + " " + vertexData.getName (), stage);
59+ emitLineBreak (stage);
60+ emitScopeBegin (stage);
61+ emitVariableDeclarations (vertexData, EMPTY_STRING, Syntax::SEMICOLON, context, stage, false );
62+ emitScopeEnd (stage, false , false );
63+ emitString (" " + vertexData.getInstance () + Syntax::SEMICOLON, stage);
64+ emitLineBreak (stage);
6765 emitLineBreak (stage);
6866 }
6967 }
@@ -81,14 +79,14 @@ void VkShaderGenerator::emitOutputs(GenContext& context, ShaderStage& stage) con
8179 const VariableBlock& vertexData = stage.getOutputBlock (HW::VERTEX_DATA);
8280 if (!vertexData.empty ())
8381 {
84- for ( size_t i = 0 ; i < vertexData. size (); ++i)
85- {
86- emitLineBegin (stage);
87- emitString ( " layout (location = " + std::to_string (i) + " ) " , stage);
88- emitVariableDeclaration (vertexData[i], _syntax-> getOutputQualifier () , context, stage, false );
89- emitString (Syntax::SEMICOLON, stage );
90- emitLineEnd (stage, false );
91- }
82+ emitString ( " layout (location = " + std::to_string (vertexDataLocation) + " ) " +
83+ _syntax-> getOutputQualifier () + " " + vertexData. getName (), stage);
84+ emitLineBreak (stage);
85+ emitScopeBegin ( stage);
86+ emitVariableDeclarations (vertexData, EMPTY_STRING, Syntax::SEMICOLON , context, stage, false );
87+ emitScopeEnd (stage, false , false );
88+ emitString ( " " + vertexData. getInstance () + Syntax::SEMICOLON, stage );
89+ emitLineBreak (stage);
9290 emitLineBreak (stage);
9391 }
9492 }
0 commit comments