diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-26 20:32:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 20:32:53 -0400 |
| commit | 5c2c2cfc9918bb43225159e67a851e196e17759a (patch) | |
| tree | 216009d02afe9dc17b074fdd394141ef71472268 /source/compiler-core/slang-fxc-compiler.cpp | |
| parent | ef067bef2f2188a4b3c420cbcd8d223874888ed2 (diff) | |
DownstreamCompileOptions using POD types (#2381)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Make DownstreamCompileOptions use POD types.
* CharSliceAllocator -> SliceAllocator
Added SliceConverter
CharSliceCaster -> SliceCaster
* First attempt at zero terminating around blobs.
* Fix clang warning.
* Add SlangTerminatedChars
Make Blob implementations support it.
Make most blobs 'terminated'.
* Fix bug setting up sourceFiles for CommandLineDownstreamCompiler.
* Traffic in TerminatedCharSlice for sourceFiles.
Use ArtifactDesc to generate temporary file names for source.
* Fix typo in testing for shared library/C++.
Diffstat (limited to 'source/compiler-core/slang-fxc-compiler.cpp')
| -rw-r--r-- | source/compiler-core/slang-fxc-compiler.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/compiler-core/slang-fxc-compiler.cpp b/source/compiler-core/slang-fxc-compiler.cpp index c07952d2d..03eaa8e34 100644 --- a/source/compiler-core/slang-fxc-compiler.cpp +++ b/source/compiler-core/slang-fxc-compiler.cpp @@ -153,7 +153,7 @@ SlangResult FXCDownstreamCompiler::init(ISlangSharedLibrary* library) return SLANG_OK; } -static SlangResult _parseDiagnosticLine(CharSliceAllocator& allocator, const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, ArtifactDiagnostic& outDiagnostic) +static SlangResult _parseDiagnosticLine(SliceAllocator& allocator, const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, ArtifactDiagnostic& outDiagnostic) { /* tests/diagnostics/syntax-error-intrinsic.slang(14,2): error X3000: syntax error: unexpected token '@' */ if (lineSlices.getCount() < 3) @@ -183,7 +183,7 @@ static SlangResult _parseDiagnosticLine(CharSliceAllocator& allocator, const Uno SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtifact** outArtifact) { // This compiler doesn't read files, they should be read externally and stored in sourceContents/sourceContentsPath - if (options.sourceFiles.getCount() > 0) + if (options.sourceFiles.count > 0) { return SLANG_FAIL; } @@ -204,7 +204,7 @@ SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtif SearchDirectoryList searchDirectories; for (const auto& includePath : options.includePaths) { - searchDirectories.searchDirectories.add(includePath); + searchDirectories.searchDirectories.add(asString(includePath)); } // Use the default fileSystemExt is not set @@ -213,9 +213,9 @@ SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtif FxcIncludeHandler fxcIncludeHandlerStorage(&searchDirectories, options.fileSystemExt, options.sourceManager); if (options.fileSystemExt) { - if (options.sourceContentsPath.getLength() > 0) + if (options.sourceContentsPath.count > 0) { - fxcIncludeHandlerStorage.m_rootPathInfo = PathInfo::makePath(options.sourceContentsPath); + fxcIncludeHandlerStorage.m_rootPathInfo = PathInfo::makePath(asString(options.sourceContentsPath)); } includeHandler = &fxcIncludeHandlerStorage; } @@ -223,13 +223,13 @@ SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtif List<D3D_SHADER_MACRO> dxMacrosStorage; D3D_SHADER_MACRO const* dxMacros = nullptr; - if (options.defines.getCount() > 0) + if (options.defines.count > 0) { for (const auto& define : options.defines) { D3D_SHADER_MACRO dxMacro; - dxMacro.Name = define.nameWithSig.getBuffer(); - dxMacro.Definition = define.value.getBuffer(); + dxMacro.Name = define.nameWithSig; + dxMacro.Definition = define.value; dxMacrosStorage.add(dxMacro); } D3D_SHADER_MACRO nullTerminator = { 0, 0 }; @@ -278,12 +278,12 @@ SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtif ComPtr<ID3DBlob> diagnosticsBlob; HRESULT hr = m_compile( options.sourceContents.begin(), - options.sourceContents.getLength(), - options.sourceContentsPath.getBuffer(), + options.sourceContents.count, + options.sourceContentsPath, dxMacros, includeHandler, - options.entryPointName.getBuffer(), - options.profileName.getBuffer(), + options.entryPointName, + options.profileName, flags, 0, // unused: effect flags codeBlob.writeRef(), @@ -294,7 +294,7 @@ SlangResult FXCDownstreamCompiler::compile(const CompileOptions& options, IArtif // HRESULT is compatible with SlangResult diagnostics->setResult(hr); - CharSliceAllocator allocator; + SliceAllocator allocator; if (diagnosticsBlob) { |
