19
19
#include " slang-gcc-compiler-util.h"
20
20
#include " slang-nvrtc-compiler.h"
21
21
#include " slang-fxc-compiler.h"
22
+ #include " slang-dxc-compiler.h"
22
23
23
24
namespace Slang
24
25
{
@@ -158,6 +159,26 @@ Index DownstreamDiagnostics::getCountBySeverity(Diagnostic::Severity severity) c
158
159
return count;
159
160
}
160
161
162
+ void DownstreamDiagnostics::requireErrorDiagnostic ()
163
+ {
164
+ // If we find an error, we don't need to add a generic diagnostic
165
+ for (const auto & msg : diagnostics)
166
+ {
167
+ if (Index (msg.severity ) >= Index (DownstreamDiagnostic::Severity::Error))
168
+ {
169
+ return ;
170
+ }
171
+ }
172
+
173
+ DownstreamDiagnostic diagnostic;
174
+ diagnostic.reset ();
175
+ diagnostic.severity = DownstreamDiagnostic::Severity::Error;
176
+ diagnostic.text = " Generic error during compilation" ;
177
+
178
+ // Add the diagnostic
179
+ diagnostics.add (diagnostic);
180
+ }
181
+
161
182
Int DownstreamDiagnostics::countByStage (Diagnostic::Stage stage, Index counts[Int(Diagnostic::Severity::CountOf)]) const
162
183
{
163
184
Int count = 0 ;
@@ -655,24 +676,6 @@ const DownstreamCompiler::Desc& DownstreamCompilerUtil::getCompiledWithDesc()
655
676
}
656
677
}
657
678
658
- static SlangResult _locateDXCCompilers (const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set)
659
- {
660
- // First try dxil, so it's loaded from the same path if it's there
661
- ComPtr<ISlangSharedLibrary> dxil;
662
- DefaultSharedLibraryLoader::load (loader, path, " dxil" , dxil.writeRef ());
663
-
664
- ComPtr<ISlangSharedLibrary> sharedLibrary;
665
- if (SLANG_SUCCEEDED (DefaultSharedLibraryLoader::load (loader, path, " dxcompiler" , sharedLibrary.writeRef ())))
666
- {
667
- // Can we determine the version?
668
- DownstreamCompiler::Desc desc (SLANG_PASS_THROUGH_DXC);
669
- RefPtr<DownstreamCompiler> compiler (new SharedLibraryDownstreamCompiler (desc, sharedLibrary));
670
-
671
- set->addCompiler (compiler);
672
- }
673
- return SLANG_OK;
674
- }
675
-
676
679
static SlangResult _locateGlslangCompilers (const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set)
677
680
{
678
681
#if SLANG_UNIX_FAMILY
@@ -697,7 +700,7 @@ static SlangResult _locateGlslangCompilers(const String& path, ISlangSharedLibra
697
700
outFuncs[int (SLANG_PASS_THROUGH_CLANG)] = &GCCDownstreamCompilerUtil::locateClangCompilers;
698
701
outFuncs[int (SLANG_PASS_THROUGH_GCC)] = &GCCDownstreamCompilerUtil::locateGCCCompilers;
699
702
outFuncs[int (SLANG_PASS_THROUGH_NVRTC)] = &NVRTCDownstreamCompilerUtil::locateCompilers;
700
- outFuncs[int (SLANG_PASS_THROUGH_DXC)] = &_locateDXCCompilers ;
703
+ outFuncs[int (SLANG_PASS_THROUGH_DXC)] = &DXCDownstreamCompilerUtil::locateCompilers ;
701
704
outFuncs[int (SLANG_PASS_THROUGH_FXC)] = &FXCDownstreamCompilerUtil::locateCompilers;
702
705
outFuncs[int (SLANG_PASS_THROUGH_GLSLANG)] = &_locateGlslangCompilers;
703
706
}
0 commit comments