MCPcopy Create free account
hub / github.com/csyonghe/Spire / DeclareOutput

Method DeclareOutput

Source/SpireCore/GLSLCodeGen.cpp:901–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899 : OutputStrategy(pCodeGen, world), declPrefix(prefix)
900 {}
901 virtual void DeclareOutput(CodeGenContext & ctx, ILStage *) override
902 {
903 int location = 0;
904 for (auto & field : world->OutputType->Members)
905 {
906 if (field.Value.Attributes.ContainsKey("FragDepth"))
907 continue;
908 ctx.GlobalHeader << "layout(location = " << location << ") ";
909 if (declPrefix.Length())
910 ctx.GlobalHeader << declPrefix << " ";
911 if (field.Value.Type->IsIntegral())
912 ctx.GlobalHeader << "flat ";
913 ctx.GlobalHeader << "out ";
914 String declName = field.Key;
915 codeGen->PrintDef(ctx.GlobalHeader, field.Value.Type.Ptr(), AddWorldNameSuffix(declName, world->OutputType->TypeName));
916 ctx.GlobalHeader << ";\n";
917 location++;
918 }
919 }
920 virtual void ProcessExportInstruction(CodeGenContext & ctx, ExportInstruction * instr) override
921 {
922 if (world->OutputType->Members[instr->ComponentName]().Attributes.ContainsKey("FragDepth"))

Callers

nothing calls this directly

Calls 6

AddWorldNameSuffixFunction · 0.85
PrintDefMethod · 0.80
ContainsKeyMethod · 0.45
LengthMethod · 0.45
IsIntegralMethod · 0.45
PtrMethod · 0.45

Tested by

no test coverage detected