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

Class ArrayOutputStrategy

Source/SpireCore/GLSLCodeGen.cpp:931–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929 };
930
931 class ArrayOutputStrategy : public OutputStrategy
932 {
933 protected:
934 bool isPatch = false;
935 int arraySize = 0;
936 public:
937 String outputIndex;
938 ArrayOutputStrategy(GLSLCodeGen * pCodeGen, ILWorld * world, bool pIsPatch, int pArraySize, String pOutputIndex)
939 : OutputStrategy(pCodeGen, world)
940 {
941 isPatch = pIsPatch;
942 arraySize = pArraySize;
943 outputIndex = pOutputIndex;
944 }
945 virtual void DeclareOutput(CodeGenContext & ctx, ILStage *) override
946 {
947 for (auto & field : world->OutputType->Members)
948 {
949 if (isPatch)
950 ctx.GlobalHeader << "patch ";
951 ctx.GlobalHeader << "out ";
952 codeGen->PrintDef(ctx.GlobalHeader, field.Value.Type.Ptr(), AddWorldNameSuffix(field.Key, world->Name));
953 ctx.GlobalHeader << "[";
954 if (arraySize != 0)
955 ctx.GlobalHeader << arraySize;
956 ctx.GlobalHeader<<"]; \n";
957 }
958 }
959 virtual void ProcessExportInstruction(CodeGenContext & ctx, ExportInstruction * instr) override
960 {
961 ctx.Body << AddWorldNameSuffix(instr->ComponentName, world->Name) << "[" << outputIndex << "] = ";
962 codeGen->PrintOp(ctx, instr->Operand.Ptr());
963 ctx.Body << ";\n";
964 }
965 };
966
967 class PackedBufferOutputStrategy : public OutputStrategy
968 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected