diff options
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 59b059e91..e59cfae37 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -160,9 +160,10 @@ struct LinkingAndOptimizationOptions CLikeSourceEmitter* sourceEmitter = nullptr; }; +// TODO(DG): A bit tricky; this needs to be generalized to multiple entry points Result linkAndOptimizeIR( BackEndCompileRequest* compileRequest, - Int entryPointIndex, + List<Int> entryPointIndices, CodeGenTarget target, TargetRequest* targetRequest, LinkingAndOptimizationOptions const& options, @@ -184,7 +185,7 @@ Result linkAndOptimizeIR( // outLinkedIR = linkIR( compileRequest, - entryPointIndex, + entryPointIndices, target, targetProgram); auto irModule = outLinkedIR.module; @@ -287,6 +288,9 @@ Result linkAndOptimizeIR( break; } + // TODO(DG): There are multiple DCE steps here, which need to be changed + // CHECK: how to these modules work? + // so that they don't just throw out any non-entry point code // Debugging code for IR transformations... #if 0 dumpIRIfEnabled(compileRequest, irModule, "SPECIALIZED"); @@ -605,19 +609,23 @@ Result linkAndOptimizeIR( return SLANG_OK; } +// TODO(DG): This probably needs to be generalized to a list SlangResult emitEntryPointSourceFromIR( BackEndCompileRequest* compileRequest, - Int entryPointIndex, + List<Int> entryPointIndices, CodeGenTarget target, TargetRequest* targetRequest, SourceResult& outSource) { + // Temporary assertion for checkpoint + SLANG_ASSERT(entryPointIndices.getCount() == 1); outSource.reset(); auto sink = compileRequest->getSink(); auto program = compileRequest->getProgram(); - auto entryPoint = program->getEntryPoint(entryPointIndex); + // TODO(DG): Update from assertion + auto entryPoint = program->getEntryPoint(entryPointIndices[0]); auto lineDirectiveMode = compileRequest->getLineDirectiveMode(); // To try to make the default behavior reasonable, we will @@ -637,6 +645,7 @@ SlangResult emitEntryPointSourceFromIR( desc.compileRequest = compileRequest; desc.target = target; + // TODO(DG): Can't assume a single entry point stage for multiple entry points desc.entryPointStage = entryPoint->getStage(); desc.effectiveProfile = getEffectiveProfile(entryPoint, targetRequest); desc.sourceWriter = &sourceWriter; @@ -700,7 +709,7 @@ SlangResult emitEntryPointSourceFromIR( linkAndOptimizeIR( compileRequest, - entryPointIndex, + entryPointIndices, target, targetRequest, linkingAndOptimizationOptions, @@ -769,25 +778,27 @@ SlangResult emitSPIRVFromIR( IRFunc* irEntryPoint, List<uint8_t>& spirvOut); -SlangResult emitSPIRVForEntryPointDirectly( +SlangResult emitSPIRVForEntryPointsDirectly( BackEndCompileRequest* compileRequest, - Int entryPointIndex, + List<Int> entryPointIndices, TargetRequest* targetRequest, List<uint8_t>& spirvOut) { + // TODO(DG): Temporary assertion for checkpoint + SLANG_ASSERT(entryPointIndices.getCount() == 1); auto sink = compileRequest->getSink(); auto program = compileRequest->getProgram(); auto targetProgram = program->getTargetProgram(targetRequest); auto programLayout = targetProgram->getOrCreateLayout(sink); - RefPtr<EntryPointLayout> entryPointLayout = programLayout->entryPoints[entryPointIndex]; + RefPtr<EntryPointLayout> entryPointLayout = programLayout->entryPoints[entryPointIndices[0]]; // Outside because we want to keep IR in scope whilst we are processing emits LinkedIR linkedIR; LinkingAndOptimizationOptions linkingAndOptimizationOptions; linkAndOptimizeIR( compileRequest, - entryPointIndex, + entryPointIndices, targetRequest->getTarget(), targetRequest, linkingAndOptimizationOptions, |
