summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-07-01 14:20:42 -0400
committerGitHub <noreply@github.com>2020-07-01 14:20:42 -0400
commit5c153295205d2d5d6340f3d569a550f4697946c5 (patch)
treeb9dfcf19bd9ec4b9b045e2e8a4a0f072bb2a2ad2 /source
parent69a059511389506460abd6f1f8ffe71e1dba5aa0 (diff)
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<Int>&
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-compiler.cpp35
-rw-r--r--source/slang/slang-compiler.h8
-rw-r--r--source/slang/slang-dxc-support.cpp4
-rw-r--r--source/slang/slang-emit.cpp8
-rw-r--r--source/slang/slang-emit.h4
-rw-r--r--source/slang/slang-ir-link.cpp2
-rw-r--r--source/slang/slang-ir-link.h2
7 files changed, 32 insertions, 31 deletions
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<Int> entryPointIndices,
+ const List<Int>& 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<Int> entryPointIndices)
+ const List<Int>& 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<Int> getEntryPointIndices(List<EntryPointAndIndex> const& entryPoints) {
+ List<Int> getEntryPointIndices(List<EntryPointAndIndex> const& entryPoints)
+ {
List<Int> 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<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
TargetRequest* targetReq,
EndToEndCompileRequest* endToEndReq,
RefPtr<DownstreamCompileResult>& outResult)
@@ -1638,7 +1640,7 @@ SlangResult dissassembleDXILUsingDXC(
SlangResult emitSPIRVForEntryPointsDirectly(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
TargetRequest* targetReq,
List<uint8_t>& spirvOut);
@@ -2229,14 +2231,15 @@ SlangResult dissassembleDXILUsingDXC(
}
CompileResult& TargetProgram::_createWholeProgramResult(
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
BackEndCompileRequest* backEndRequest,
EndToEndCompileRequest* endToEndRequest)
{
List<EntryPointAndIndex> 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<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
DiagnosticSink* sink)
{
auto& result = m_wholeProgramResult;
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 72c40a497..bbf3be1ca 100644
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -1682,7 +1682,7 @@ namespace Slang
/// code generation to the given `sink`.
///
CompileResult& getOrCreateEntryPointResult(Int entryPointIndex, DiagnosticSink* sink);
- CompileResult& getOrCreateWholeProgramResult(List<Int> entryPointIndices, DiagnosticSink* sink);
+ CompileResult& getOrCreateWholeProgramResult(const List<Int>& entryPointIndices, DiagnosticSink* sink);
CompileResult& getExistingWholeProgramResult()
@@ -1700,7 +1700,7 @@ namespace Slang
}
CompileResult& _createWholeProgramResult(
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
BackEndCompileRequest* backEndRequest,
EndToEndCompileRequest* endToEndRequest);
/// Internal helper for `getOrCreateEntryPointResult`.
@@ -1959,7 +1959,7 @@ namespace Slang
// TODO(DG): Note to reviewer; this was changed from UInt to List<Int> -- let me know if that's a problem
// and I can work out the appropriate casts
String calcSourcePathForEntryPoint(EndToEndCompileRequest* endToEndReq, Int entryPointIndex);
- String calcSourcePathForEntryPoints(EndToEndCompileRequest* endToEndReq, List<Int> entryPointIndices);
+ String calcSourcePathForEntryPoints(EndToEndCompileRequest* endToEndReq, const List<Int>& entryPointIndices);
struct SourceResult
{
@@ -1978,7 +1978,7 @@ namespace Slang
the target (not targetReq) */
SlangResult emitEntryPointsSource(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
TargetRequest* targetReq,
CodeGenTarget target,
EndToEndCompileRequest* endToEndReq,
diff --git a/source/slang/slang-dxc-support.cpp b/source/slang/slang-dxc-support.cpp
index 4fdb55e29..1bd4f101a 100644
--- a/source/slang/slang-dxc-support.cpp
+++ b/source/slang/slang-dxc-support.cpp
@@ -193,9 +193,7 @@ namespace Slang
args[argCount++] = L"-enable-16bit-types";
}
- List<Int> entryPointIndices2;
- entryPointIndices.add(entryPointIndex);
- const String sourcePath = calcSourcePathForEntryPoints(endToEndReq, entryPointIndices2);
+ const String sourcePath = calcSourcePathForEntryPoints(endToEndReq, entryPointIndices);
ComPtr<IDxcOperationResult> dxcResult;
SLANG_RETURN_ON_FAIL(dxcCompiler->Compile(dxcSourceBlob,
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index e59cfae37..a93427e29 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -163,7 +163,7 @@ struct LinkingAndOptimizationOptions
// TODO(DG): A bit tricky; this needs to be generalized to multiple entry points
Result linkAndOptimizeIR(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
CodeGenTarget target,
TargetRequest* targetRequest,
LinkingAndOptimizationOptions const& options,
@@ -612,10 +612,10 @@ Result linkAndOptimizeIR(
// TODO(DG): This probably needs to be generalized to a list
SlangResult emitEntryPointSourceFromIR(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
CodeGenTarget target,
TargetRequest* targetRequest,
- SourceResult& outSource)
+ SourceResult& outSource)
{
// Temporary assertion for checkpoint
SLANG_ASSERT(entryPointIndices.getCount() == 1);
@@ -780,7 +780,7 @@ SlangResult emitSPIRVFromIR(
SlangResult emitSPIRVForEntryPointsDirectly(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
TargetRequest* targetRequest,
List<uint8_t>& spirvOut)
{
diff --git a/source/slang/slang-emit.h b/source/slang/slang-emit.h
index 09da4c2ba..2c36436ee 100644
--- a/source/slang/slang-emit.h
+++ b/source/slang/slang-emit.h
@@ -38,9 +38,9 @@ namespace Slang
///
SlangResult emitEntryPointSourceFromIR(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
CodeGenTarget target,
TargetRequest* targetRequest,
- SourceResult& outSource);
+ SourceResult& outSource);
}
#endif
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp
index f1f6d4cd4..7acdac40b 100644
--- a/source/slang/slang-ir-link.cpp
+++ b/source/slang/slang-ir-link.cpp
@@ -1349,7 +1349,7 @@ struct IRSpecializationState
// TODO(DG): Generalize to multiple entry points
LinkedIR linkIR(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
CodeGenTarget target,
TargetProgram* targetProgram)
{
diff --git a/source/slang/slang-ir-link.h b/source/slang/slang-ir-link.h
index e244f29e6..dc9ad50a0 100644
--- a/source/slang/slang-ir-link.h
+++ b/source/slang/slang-ir-link.h
@@ -20,7 +20,7 @@ namespace Slang
//
LinkedIR linkIR(
BackEndCompileRequest* compileRequest,
- List<Int> entryPointIndices,
+ const List<Int>& entryPointIndices,
CodeGenTarget target,
TargetProgram* targetProgram);