From 5c153295205d2d5d6340f3d569a550f4697946c5 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 1 Jul 2020 14:20:42 -0400 Subject: Fix bug in slang-dxc-support where it didn't get the source path correctly (#1420) * Fix handling of UniformState from #1396 * * Fix bug in slang-dxc-support where it didn't get the source path correctly * Make entryPointIndices const List& --- source/slang/slang-compiler.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index ca7e5fb83..68ab205c4 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -567,7 +567,7 @@ namespace Slang SlangResult emitEntryPointsSource( BackEndCompileRequest* compileRequest, - List entryPointIndices, + const List& entryPointIndices, TargetRequest* targetReq, CodeGenTarget target, EndToEndCompileRequest* endToEndReq, @@ -577,9 +577,9 @@ namespace Slang if(isPassThroughEnabled(endToEndReq)) { - for (auto entryPointIndex = entryPointIndices.begin(); entryPointIndex != entryPointIndices.end(); entryPointIndex++) + for (auto entryPointIndex : entryPointIndices) { - auto translationUnit = getPassThroughTranslationUnit(endToEndReq, *entryPointIndex); + auto translationUnit = getPassThroughTranslationUnit(endToEndReq, entryPointIndex); SLANG_ASSERT(translationUnit); // Generate a string that includes the content of // the source file(s), along with a line directive @@ -779,7 +779,7 @@ namespace Slang String calcSourcePathForEntryPoints( EndToEndCompileRequest* endToEndReq, - List entryPointIndices) + const List& entryPointIndices) { String failureMode = "slang-generated"; if (entryPointIndices.getCount() != 1) @@ -841,10 +841,12 @@ namespace Slang } // Helper function for recovering the entry point code indices from a list of entry points - List getEntryPointIndices(List const& entryPoints) { + List getEntryPointIndices(List const& entryPoints) + { List result; - for (auto entryPoint = entryPoints.begin(); entryPoint != entryPoints.end(); entryPoint++) { - result.add(entryPoint->index); + for (auto& entryPoint : entryPoints) + { + result.add(entryPoint.index); } return result; } @@ -1276,7 +1278,7 @@ SlangResult dissassembleDXILUsingDXC( SlangResult emitWithDownstreamForEntryPoints( BackEndCompileRequest* slangRequest, - List entryPointIndices, + const List& entryPointIndices, TargetRequest* targetReq, EndToEndCompileRequest* endToEndReq, RefPtr& outResult) @@ -1638,7 +1640,7 @@ SlangResult dissassembleDXILUsingDXC( SlangResult emitSPIRVForEntryPointsDirectly( BackEndCompileRequest* compileRequest, - List entryPointIndices, + const List& entryPointIndices, TargetRequest* targetReq, List& spirvOut); @@ -2229,14 +2231,15 @@ SlangResult dissassembleDXILUsingDXC( } CompileResult& TargetProgram::_createWholeProgramResult( - List entryPointIndices, + const List& entryPointIndices, BackEndCompileRequest* backEndRequest, EndToEndCompileRequest* endToEndRequest) { List entryPoints; - for (auto entryPointIndex = entryPointIndices.begin(); entryPointIndex != entryPointIndices.end(); entryPointIndex++) { - if (*entryPointIndex >= m_entryPointResults.getCount()) - m_entryPointResults.setCount(*entryPointIndex + 1); + for (auto entryPointIndex : entryPointIndices) + { + if (entryPointIndex >= m_entryPointResults.getCount()) + m_entryPointResults.setCount(entryPointIndex + 1); // It is possible that entry points goot added to the `Program` // *after* we created this `TargetProgram`, so there might be @@ -2246,8 +2249,8 @@ SlangResult dissassembleDXILUsingDXC( // constructed all at once rather than incrementally, to avoid // this problem. // - auto entryPoint = m_program->getEntryPoint(*entryPointIndex); - entryPoints.add(EntryPointAndIndex(entryPoint, *entryPointIndex)); + auto entryPoint = m_program->getEntryPoint(entryPointIndex); + entryPoints.add(EntryPointAndIndex(entryPoint, entryPointIndex)); } auto& result = m_wholeProgramResult; result = emitEntryPoints( @@ -2290,7 +2293,7 @@ SlangResult dissassembleDXILUsingDXC( } CompileResult& TargetProgram::getOrCreateWholeProgramResult( - List entryPointIndices, + const List& entryPointIndices, DiagnosticSink* sink) { auto& result = m_wholeProgramResult; -- cgit v1.2.3