Skip to content

Commit

Permalink
metal: fix varying matrices and arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Apr 13, 2024
1 parent 4a0e24c commit 59e18df
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modules/graphics/metal/Shader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,15 @@ static EShLanguage getGLSLangStage(ShaderStageType stage)

for (const auto &varying : resources.stage_outputs)
{
// printf("vertex shader output %s: %d\n", inp.name.c_str(), msl.get_decoration(inp.id, spv::DecorationLocation));
varyings[varying.name] = nextVaryingLocation;
msl.set_decoration(varying.id, spv::DecorationLocation, nextVaryingLocation++);
msl.set_decoration(varying.id, spv::DecorationLocation, nextVaryingLocation);

const auto &type = msl.get_type(varying.base_type_id);
int count = type.array.empty() ? 1 : type.array[0];
if (type.op == spv::OpTypeMatrix)
count *= type.columns;

nextVaryingLocation += count;
}
}
else if (stageindex == SHADERSTAGE_PIXEL)
Expand Down

0 comments on commit 59e18df

Please sign in to comment.