summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-09-07 10:20:26 -0400
committerGitHub <noreply@github.com>2023-09-07 10:20:26 -0400
commit269282fd3647f1b201d2aae4c82b0c0af16c6420 (patch)
tree632ed29adcce2a7627b0050d08a28eca6be5b79d
parent135a5db8d3a7cafa3a43076f8b6f9b8615bd9491 (diff)
Add -repro-fallback-directory (#3188)
Co-authored-by: Yong He <yonghe@outlook.com>
-rw-r--r--docs/command-line-slangc-reference.md125
-rw-r--r--source/compiler-core/slang-dxc-compiler.cpp4
-rw-r--r--source/core/slang-file-system.h2
-rw-r--r--source/slang/slang-compiler.cpp2
-rwxr-xr-xsource/slang/slang-compiler.h5
-rw-r--r--source/slang/slang-options.cpp158
-rw-r--r--source/slang/slang-repro.cpp6
-rw-r--r--source/slang/slang-repro.h4
8 files changed, 201 insertions, 105 deletions
diff --git a/docs/command-line-slangc-reference.md b/docs/command-line-slangc-reference.md
index 05b27043f..e5590fadb 100644
--- a/docs/command-line-slangc-reference.md
+++ b/docs/command-line-slangc-reference.md
@@ -16,6 +16,7 @@ slangc -help-style markdown -h
* [Target](#Target)
* [Downstream](#Downstream)
* [Debugging](#Debugging)
+* [Repro](#Repro)
* [Experimental](#Experimental)
* [Internal](#Internal)
* [Deprecated](#Deprecated)
@@ -379,11 +380,36 @@ Places the $Globals cbuffer at descriptor set &lt;descriptor-set&gt; and binding
Negates (additively inverts) SV_Position.y before writing to stage output.
+<a id="fvk-use-entrypoint-name"></a>
+## -fvk-use-entrypoint-name
+Uses the entrypoint name from the source instead of 'main' in the spirv output.
+
+
+<a id="fvk-use-gl-layout"></a>
+## -fvk-use-gl-layout
+Use std430 layout instead of D3D buffer layout for raw buffer load/stores.
+
+
<a id="enable-effect-annotations"></a>
## -enable-effect-annotations
Enables support for legacy effect annotation syntax.
+<a id="emit-spirv-via-glsl"></a>
+## -emit-spirv-via-glsl
+Generate SPIR-V output by compiling generated GLSL with glslang (default)
+
+
+<a id="emit-spirv-directly"></a>
+## -emit-spirv-directly
+Generate SPIR-V output direclty rather than by compiling generated GLSL with glslang
+
+
+<a id="spirv-core-grammar"></a>
+## -spirv-core-grammar
+A path to a specific spirv.core.grammar.json to use when generating SPIR-V output
+
+
<a id="Downstream"></a>
# Downstream
@@ -391,7 +417,7 @@ Enables support for legacy effect annotation syntax.
Downstream compiler options
<a id="none-path"></a>
-## -none-path, -fxc-path, -dxc-path, -glslang-path, -visualstudio-path, -clang-path, -gcc-path, -genericcpp-path, -nvrtc-path, -llvm-path
+## -none-path, -fxc-path, -dxc-path, -glslang-path, -spirv-dis-path, -visualstudio-path, -clang-path, -gcc-path, -genericcpp-path, -nvrtc-path, -llvm-path
**-&lt;[compiler](#compiler)&gt;-path &lt;path&gt;**
@@ -460,23 +486,57 @@ Dump the IR for debugging.
Dump the IDs with [-dump-ir](#dump-ir) (debug builds only)
-<a id="dump-repro"></a>
-## -dump-repro
-Dump a `.slang-repro` file that can be used to reproduce a compilation on another machine.
+<a id="E"></a>
+## -E, -output-preprocessor
+Output the preprocessing result and exit.
+
+
+<a id="no-codegen"></a>
+## -no-codegen
+Skip the code generation step, just check the code and generate layout.
+
+
+<a id="output-includes"></a>
+## -output-includes
+Print the hierarchy of the processed source files.
+
+
+<a id="serial-ir"></a>
+## -serial-ir
+Serialize the IR between front-end and back-end.
+
+
+<a id="skip-codegen"></a>
+## -skip-codegen
+Skip the code generation phase.
+
+
+<a id="validate-ir"></a>
+## -validate-ir
+Validate the IR between the phases.
+
+
+<a id="verbose-paths"></a>
+## -verbose-paths
+When displaying diagnostic output aim to display more detailed path information. In practice this is typically the complete 'canonical' path to the source file used.
+
+
+<a id="verify-debug-serial-ir"></a>
+## -verify-debug-serial-ir
+Verify IR in the front-end.
+<a id="Repro"></a>
+# Repro
+
+Slang repro system related
<a id="dump-repro-on-error"></a>
## -dump-repro-on-error
Dump `.slang-repro` file on any compilation error.
-<a id="E"></a>
-## -E, -output-preprocessor
-Output the preprocessing result and exit.
-
-
<a id="extract-repro"></a>
## -extract-repro
@@ -501,16 +561,6 @@ Use repro along specified path
Load repro
-<a id="no-codegen"></a>
-## -no-codegen
-Skip the code generation step, just check the code and generate layout.
-
-
-<a id="output-includes"></a>
-## -output-includes
-Print the hierarchy of the processed source files.
-
-
<a id="repro-file-system"></a>
## -repro-file-system
@@ -519,29 +569,27 @@ Print the hierarchy of the processed source files.
Use a repro as a file system
-<a id="serial-ir"></a>
-## -serial-ir
-Serialize the IR between front-end and back-end.
+<a id="dump-repro"></a>
+## -dump-repro
+Dump a `.slang-repro` file that can be used to reproduce a compilation on another machine.
-<a id="skip-codegen"></a>
-## -skip-codegen
-Skip the code generation phase.
-<a id="validate-ir"></a>
-## -validate-ir
-Validate the IR between the phases.
+<a id="repro-fallback-directory"></a>
+## -repro-fallback-directory
+**-repro-fallback-directory &lt;path&gt;**
-<a id="verbose-paths"></a>
-## -verbose-paths
-When displaying diagnostic output aim to display more detailed path information. In practice this is typically the complete 'canonical' path to the source file used.
+Specify a directory to use if a file isn't found in a repro. Should be specified *before* any repro usage such as `load-repro`.
+There are two *special* &lt;path&gt;s:
-<a id="verify-debug-serial-ir"></a>
-## -verify-debug-serial-ir
-Verify IR in the front-end.
+
+
+* 'none:' indicates no fallback, so if the file isn't found in the repro compliation will fail
+
+* 'default:' is the default (which is the OS file system)
@@ -550,11 +598,6 @@ Verify IR in the front-end.
Experimental options (use at your own risk)
-<a id="emit-spirv-via-glsl"></a>
-## -emit-spirv-via-glsl
-Generate SPIR-V output by generating and compiling GLSL using glslang
-
-
<a id="file-system"></a>
## -file-system
@@ -667,6 +710,7 @@ Downstream Compilers (aka Pass through)
* `fxc` : FXC HLSL compiler
* `dxc` : DXC HLSL compiler
* `glslang` : GLSLANG GLSL compiler
+* `spirv-dis` : spirv-tools SPIRV disassembler
* `visualstudio`, `vs` : Visual Studio C/C++ compiler
* `clang` : Clang C/C++ compiler
* `gcc` : GCC C/C++ compiler
@@ -847,12 +891,13 @@ A capability describes an optional feature that a target may or may not support.
* `spirv_1_{ 0`, `1`, `2`, `3`, `4`, `5 }` : minimum supported SPIR - V version
* `invalid`
+* `textual_source`
* `hlsl`
* `glsl`
* `c`
* `cpp`
* `cuda`
-* `spirv`
+* `spirv`
* `GL_NV_ray_tracing` : enables the GL_NV_ray_tracing extension
* `GL_EXT_ray_tracing` : enables the GL_EXT_ray_tracing extension
* `GL_NV_fragment_shader_barycentric` : enables the GL_NV_fragment_shader_barycentric extension
diff --git a/source/compiler-core/slang-dxc-compiler.cpp b/source/compiler-core/slang-dxc-compiler.cpp
index 6956a3627..fc42dfc40 100644
--- a/source/compiler-core/slang-dxc-compiler.cpp
+++ b/source/compiler-core/slang-dxc-compiler.cpp
@@ -133,8 +133,8 @@ public:
// If it starts with ./ then attempt to strip it
if (filePath.startsWith("./"))
{
- String remaining(filePath.subString(2, filePath.getLength() - 2));
-
+ const String remaining = filePath.getUnownedSlice().tail(2);
+
// Okay if we strip ./ and what we have is absolute, then it's the absolute path that we care about,
// otherwise we just leave as is.
if (Path::isAbsolute(remaining))
diff --git a/source/core/slang-file-system.h b/source/core/slang-file-system.h
index 93d0659ec..6e29e277c 100644
--- a/source/core/slang-file-system.h
+++ b/source/core/slang-file-system.h
@@ -172,7 +172,7 @@ class CacheFileSystem: public ISlangFileSystemExt, public ComBaseObject
void setInnerFileSystem(ISlangFileSystem* fileSystem, UniqueIdentityMode uniqueIdentityMode = UniqueIdentityMode::Default, PathStyle pathStyle = PathStyle::Default);
/// Ctor
- CacheFileSystem(ISlangFileSystem* fileSystem, UniqueIdentityMode uniqueIdentityMode = UniqueIdentityMode::Default, PathStyle pathStyle = PathStyle::Default);
+ explicit CacheFileSystem(ISlangFileSystem* fileSystem, UniqueIdentityMode uniqueIdentityMode = UniqueIdentityMode::Default, PathStyle pathStyle = PathStyle::Default);
/// Dtor
virtual ~CacheFileSystem();
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index eecb86242..9b14fd2f7 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -1412,7 +1412,7 @@ namespace Slang
options.requiredCapabilityVersions = SliceUtil::asSlice(requiredCapabilityVersions);
options.libraries = SliceUtil::asSlice(libraries);
options.libraryPaths = allocator.allocate(libraryPaths);
-
+
// Compile
ComPtr<IArtifact> artifact;
auto downstreamStartTime = std::chrono::high_resolution_clock::now();
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 6e4d7ff17..95995349a 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -19,6 +19,8 @@
#include "../core/slang-std-writers.h"
#include "../core/slang-command-options.h"
+#include "../core/slang-file-system.h"
+
#include "../../slang-com-ptr.h"
#include "slang-capability.h"
@@ -2697,6 +2699,9 @@ namespace Slang
/// Holds the container as a file system
ComPtr<ISlangMutableFileSystem> m_containerFileSystem;
+ /// File system used by repro system if a file couldn't be found within the repro (or associated directory)
+ ComPtr<ISlangFileSystem> m_reproFallbackFileSystem = ComPtr<ISlangFileSystem>(OSFileSystem::getExtSingleton());
+
// Path to output container to
String m_containerOutputPath;
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index c911baea4..67f95df1e 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -96,7 +96,6 @@ enum class OptionKind
VulkanUseEntryPointName,
VulkanUseGLLayout,
-
GLSLForceScalarLayout,
EnableEffectAnnotations,
@@ -111,6 +110,15 @@ enum class OptionKind
DownstreamArgs,
PassThrough,
+ // Repro
+
+ DumpRepro,
+ DumpReproOnError,
+ ExtractRepro,
+ LoadRepro,
+ LoadReproDirectory,
+ ReproFallbackDirectory,
+
// Debugging
DumpAst,
@@ -118,12 +126,7 @@ enum class OptionKind
DumpIntermediates,
DumpIr,
DumpIrIds,
- DumpRepro,
- DumpReproOnError,
PreprocessorOutput,
- ExtractRepro,
- LoadRepro,
- LoadReproDirectory,
NoCodeGen,
OutputIncludes,
ReproFileSystem,
@@ -223,6 +226,7 @@ void initCommandOptions(CommandOptions& options)
options.addCategory(CategoryKind::Option, "Target", "Target code generation options");
options.addCategory(CategoryKind::Option, "Downstream", "Downstream compiler options");
options.addCategory(CategoryKind::Option, "Debugging", "Compiler debugging/instrumentation options");
+ options.addCategory(CategoryKind::Option, "Repro", "Slang repro system related");
options.addCategory(CategoryKind::Option, "Experimental", "Experimental options (use at your own risk)");
options.addCategory(CategoryKind::Option, "Internal", "Internal-use options (use at your own risk)");
options.addCategory(CategoryKind::Option, "Deprecated", "Deprecated options (allowed but ignored; may be removed in future)");
@@ -562,6 +566,28 @@ void initCommandOptions(CommandOptions& options)
_addOptions(makeConstArrayView(downstreamOpts), options);
+ /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Repro !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+ options.setCategory("Repro");
+
+ const Option reproOpts[] =
+ {
+ { OptionKind::DumpReproOnError, "-dump-repro-on-error", nullptr, "Dump `.slang-repro` file on any compilation error." },
+ { OptionKind::ExtractRepro, "-extract-repro", "-extract-repro <name>", "Extract the repro files into a folder." },
+ { OptionKind::LoadReproDirectory, "-load-repro-directory", "-load-repro-directory <path>", "Use repro along specified path" },
+ { OptionKind::LoadRepro, "-load-repro", "-load-repro <name>", "Load repro"},
+ { OptionKind::ReproFileSystem, "-repro-file-system", "-repro-file-system <name>", "Use a repro as a file system" },
+ { OptionKind::DumpRepro, "-dump-repro", nullptr, "Dump a `.slang-repro` file that can be used to reproduce "
+ "a compilation on another machine.\n"},
+ { OptionKind::ReproFallbackDirectory, "-repro-fallback-directory <path>",
+ "Specify a directory to use if a file isn't found in a repro. Should be specified *before* any repro usage such as `load-repro`. \n"
+ "There are two *special* directories: \n\n"
+ " * 'none:' indicates no fallback, so if the file isn't found in the repro compliation will fail\n"
+ " * 'default:' is the default (which is the OS file system)"}
+ };
+
+ _addOptions(makeConstArrayView(reproOpts), options);
+
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Debugging !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
options.setCategory("Debugging");
@@ -574,16 +600,9 @@ void initCommandOptions(CommandOptions& options)
{ OptionKind::DumpIntermediates, "-dump-intermediates", nullptr, "Dump intermediate outputs for debugging." },
{ OptionKind::DumpIr, "-dump-ir", nullptr, "Dump the IR for debugging." },
{ OptionKind::DumpIrIds, "-dump-ir-ids", nullptr, "Dump the IDs with -dump-ir (debug builds only)" },
- { OptionKind::DumpRepro, "-dump-repro", nullptr, "Dump a `.slang-repro` file that can be used to reproduce "
- "a compilation on another machine.\n"},
- { OptionKind::DumpReproOnError, "-dump-repro-on-error", nullptr, "Dump `.slang-repro` file on any compilation error." },
{ OptionKind::PreprocessorOutput, "-E,-output-preprocessor", nullptr, "Output the preprocessing result and exit." },
- { OptionKind::ExtractRepro, "-extract-repro", "-extract-repro <name>", "Extract the repro files into a folder." },
- { OptionKind::LoadReproDirectory, "-load-repro-directory", "-load-repro-directory <path>", "Use repro along specified path" },
- { OptionKind::LoadRepro, "-load-repro", "-load-repro <name>", "Load repro"},
{ OptionKind::NoCodeGen, "-no-codegen", nullptr, "Skip the code generation step, just check the code and generate layout." },
{ OptionKind::OutputIncludes, "-output-includes", nullptr, "Print the hierarchy of the processed source files." },
- { OptionKind::ReproFileSystem, "-repro-file-system", "-repro-file-system <name>", "Use a repro as a file system" },
{ OptionKind::SerialIr, "-serial-ir", nullptr, "Serialize the IR between front-end and back-end." },
{ OptionKind::SkipCodeGen, "-skip-codegen", nullptr, "Skip the code generation phase." },
{ OptionKind::ValidateIr, "-validate-ir", nullptr, "Validate the IR between the phases." },
@@ -790,7 +809,6 @@ struct OptionsParser
static bool _passThroughRequiresStage(PassThroughMode passThrough);
-
SlangResult _compileReproDirectory(SlangSession* session, EndToEndCompileRequest* originalRequest, const String& dir);
// Pass Severity::Disabled to allow any original severity
@@ -1166,7 +1184,33 @@ void OptionsParser::setFloatingPointMode(RawTarget* rawTarget, FloatingPointMode
}
}
-/* static */SlangResult OptionsParser::_compileReproDirectory(SlangSession* session, EndToEndCompileRequest* originalRequest, const String& dir)
+static SlangResult _loadRepro(const String& path, DiagnosticSink* sink, EndToEndCompileRequest* request)
+{
+ List<uint8_t> buffer;
+ SLANG_RETURN_ON_FAIL(ReproUtil::loadState(path, sink, buffer));
+
+ auto requestState = ReproUtil::getRequest(buffer);
+ MemoryOffsetBase base;
+ base.set(buffer.getBuffer(), buffer.getCount());
+
+ // If we can find a directory, that exists, we will set up a file system to load from that directory
+ ComPtr<ISlangFileSystem> optionalFileSystem;
+ String dirPath;
+ if (SLANG_SUCCEEDED(ReproUtil::calcDirectoryPathFromFilename(path, dirPath)))
+ {
+ SlangPathType pathType;
+ if (SLANG_SUCCEEDED(Path::getPathType(dirPath, &pathType)) && pathType == SLANG_PATH_TYPE_DIRECTORY)
+ {
+ optionalFileSystem = new RelativeFileSystem(OSFileSystem::getExtSingleton(), dirPath);
+ }
+ }
+
+ SLANG_RETURN_ON_FAIL(ReproUtil::load(base, requestState, optionalFileSystem, request));
+
+ return SLANG_OK;
+}
+
+SlangResult OptionsParser::_compileReproDirectory(SlangSession* session, EndToEndCompileRequest* originalRequest, const String& dir)
{
auto stdOut = originalRequest->getWriter(WriterChannel::StdOutput);
@@ -1175,34 +1219,28 @@ void OptionsParser::setFloatingPointMode(RawTarget* rawTarget, FloatingPointMode
for (auto filename : visitor.m_filenames)
{
- auto path = Path::combine(dir, filename);
-
+ // Create a fresh request
ComPtr<slang::ICompileRequest> request;
SLANG_RETURN_ON_FAIL(session->createCompileRequest(request.writeRef()));
auto requestImpl = asInternal(request);
- List<uint8_t> buffer;
- SLANG_RETURN_ON_FAIL(ReproUtil::loadState(path, m_sink, buffer));
+ // Copy over the fallback file system
+ requestImpl->m_reproFallbackFileSystem = originalRequest->m_reproFallbackFileSystem;
- auto requestState = ReproUtil::getRequest(buffer);
- MemoryOffsetBase base;
- base.set(buffer.getBuffer(), buffer.getCount());
+ // Load the repro into it
+ auto path = Path::combine(dir, filename);
- // If we can find a directory, that exists, we will set up a file system to load from that directory
- ComPtr<ISlangFileSystem> fileSystem;
- String dirPath;
- if (SLANG_SUCCEEDED(ReproUtil::calcDirectoryPathFromFilename(path, dirPath)))
+ if (SLANG_FAILED(_loadRepro(path, m_sink, requestImpl)))
{
- SlangPathType pathType;
- if (SLANG_SUCCEEDED(Path::getPathType(dirPath, &pathType)) && pathType == SLANG_PATH_TYPE_DIRECTORY)
+ if (stdOut)
{
- fileSystem = new RelativeFileSystem(OSFileSystem::getExtSingleton(), dirPath);
+ StringBuilder buf;
+ buf << filename << " - Failed to load!\n";
}
+ continue;
}
- SLANG_RETURN_ON_FAIL(ReproUtil::load(base, requestState, fileSystem, requestImpl));
-
if (stdOut)
{
StringBuilder buf;
@@ -1616,34 +1654,12 @@ SlangResult OptionsParser::_parseLoadRepro(const CommandLineArg& arg)
CommandLineArg reproName;
SLANG_RETURN_ON_FAIL(m_reader.expectArg(reproName));
- List<uint8_t> buffer;
- {
- const Result res = ReproUtil::loadState(reproName.value, m_sink, buffer);
- if (SLANG_FAILED(res))
- {
- m_sink->diagnose(reproName.loc, Diagnostics::unableToReadFile, reproName.value);
- return res;
- }
- }
-
- auto requestState = ReproUtil::getRequest(buffer);
- MemoryOffsetBase base;
- base.set(buffer.getBuffer(), buffer.getCount());
-
- // If we can find a directory, that exists, we will set up a file system to load from that directory
- ComPtr<ISlangFileSystem> fileSystem;
- String dirPath;
- if (SLANG_SUCCEEDED(ReproUtil::calcDirectoryPathFromFilename(reproName.value, dirPath)))
+ if (SLANG_FAILED(_loadRepro(reproName.value, m_sink, m_requestImpl)))
{
- SlangPathType pathType;
- if (SLANG_SUCCEEDED(Path::getPathType(dirPath, &pathType)) && pathType == SLANG_PATH_TYPE_DIRECTORY)
- {
- fileSystem = new RelativeFileSystem(OSFileSystem::getExtSingleton(), dirPath);
- }
+ m_sink->diagnose(reproName.loc, Diagnostics::unableToReadFile, reproName.value);
+ return SLANG_FAIL;
}
- SLANG_RETURN_ON_FAIL(ReproUtil::load(base, requestState, fileSystem, m_requestImpl));
-
m_hasLoadedRepro = true;
return SLANG_OK;
}
@@ -1916,6 +1932,36 @@ SlangResult OptionsParser::_parse(
SLANG_RETURN_ON_FAIL(_compileReproDirectory(m_session, m_requestImpl, reproDirectory.value));
break;
}
+ case OptionKind::ReproFallbackDirectory:
+ {
+ CommandLineArg reproDirectory;
+ SLANG_RETURN_ON_FAIL(m_reader.expectArg(reproDirectory));
+
+ if (reproDirectory.value == toSlice("default:"))
+ {
+ // The default is to use the OS file system
+ m_requestImpl->m_reproFallbackFileSystem = OSFileSystem::getExtSingleton();
+ }
+ else if (reproDirectory.value == toSlice("none:"))
+ {
+ // None, means that there isn't a fallback
+ m_requestImpl->m_reproFallbackFileSystem.setNull();
+ }
+ else
+ {
+ auto osFileSystem = OSFileSystem::getExtSingleton();
+
+ SlangPathType pathType;
+ if (SLANG_FAILED(osFileSystem->getPathType(reproDirectory.value.getBuffer(), &pathType) )
+ || pathType != SLANG_PATH_TYPE_DIRECTORY)
+ {
+ return SLANG_FAIL;
+ }
+ // Make the fallback directory use a relative file system, to the specified directory
+ m_requestImpl->m_reproFallbackFileSystem = new RelativeFileSystem(osFileSystem, reproDirectory.value);
+ }
+ break;
+ }
case OptionKind::ReproFileSystem: SLANG_RETURN_ON_FAIL(_parseReproFileSystem(arg)); break;
case OptionKind::SerialIr: m_frontEndReq->useSerialIRBottleneck = true; break;
case OptionKind::DisableSpecialization: m_requestImpl->disableSpecialization = true; break;
diff --git a/source/slang/slang-repro.cpp b/source/slang/slang-repro.cpp
index de698cf46..a19470ebf 100644
--- a/source/slang/slang-repro.cpp
+++ b/source/slang/slang-repro.cpp
@@ -888,7 +888,7 @@ struct LoadContext
return SLANG_OK;
}
-/* static */SlangResult ReproUtil::load(OffsetBase& base, RequestState* requestState, ISlangFileSystem* fileSystem, EndToEndCompileRequest* request)
+/* static */SlangResult ReproUtil::load(OffsetBase& base, RequestState* requestState, ISlangFileSystem* optionalFileSystem, EndToEndCompileRequest* request)
{
auto externalRequest = asExternal(request);
@@ -902,7 +902,7 @@ struct LoadContext
linkage->targets.clear();
}
- LoadContext context(linkage->getSourceManager(), fileSystem, &base);
+ LoadContext context(linkage->getSourceManager(), optionalFileSystem, &base);
// Try to set state through API - as doing so means if state stored in multiple places it will be ok
@@ -1046,7 +1046,7 @@ struct LoadContext
}
{
- auto cacheFileSystem = new CacheFileSystem(nullptr);
+ auto cacheFileSystem = new CacheFileSystem(request->m_reproFallbackFileSystem);
ComPtr<ISlangFileSystemExt> fileSystemExt(cacheFileSystem);
auto& dstUniqueMap = cacheFileSystem->getUniqueMap();
auto& dstPathMap = cacheFileSystem->getPathMap();
diff --git a/source/slang/slang-repro.h b/source/slang/slang-repro.h
index 03276d6d3..39efcabc0 100644
--- a/source/slang/slang-repro.h
+++ b/source/slang/slang-repro.h
@@ -174,9 +174,9 @@ struct ReproUtil
static SlangResult loadFileSystem(OffsetBase& base, RequestState* requestState, ISlangFileSystem* fileSystem, ComPtr<ISlangFileSystemExt>& outFileSystem);
/// Load the requestState into request
- /// The fileSystem is optional and can be passed as nullptr. If set, as each file is loaded
+ /// The overrideFileSystem is optional and can be passed as nullptr. If set, as each file is loaded
/// it will attempt to load from fileSystem the *uniqueName*
- static SlangResult load(OffsetBase& base, RequestState* requestState, ISlangFileSystem* fileSystem, EndToEndCompileRequest* request);
+ static SlangResult load(OffsetBase& base, RequestState* requestState, ISlangFileSystem* overrideFileSystem, EndToEndCompileRequest* request);
static SlangResult loadState(const String& filename, DiagnosticSink* sink, List<uint8_t>& outBuffer);
static SlangResult loadState(Stream* stream, DiagnosticSink* sink, List<uint8_t>& outBuffer);