summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-05-19 15:57:11 -0400
committerGitHub <noreply@github.com>2021-05-19 12:57:11 -0700
commit61e9154cb797cffe19cfbf3205b4a5a614e8b552 (patch)
tree94270d53c8189d25e6d11dee14860704759b7129 /tools
parentd5e8044d0a9723bb0bbd7ae1738d1157265da783 (diff)
Glslang as DownstreamCompiler (#1846)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP Fxc as downstream compiler. * First pass FXC downstream compiler working. * GCC compile fix. * Fix FXC parsing issue. * Special case filesystem access. * Use StringUtil getSlice. * Fix isses with not emitting source for FXC. * WIP on DXC. * Small fixes for DXBC handling. * Removed DXC from ParseDiagnosticUtil (can use generic) Try to improve output for notes from DXC. * FIrst pass of Glslang as DownstreamCompiler * Fix some problems with parsing for glslang replacement. * Add slang-glslang-compiler.cpp/.h * Fix downstream for spir-v output. * dissassemble -> disassemble * Fix typo and improve some naming/comments. * Remove getSharedLibrary from DownstreamCompiler * Removed some no longer used diagnostics.
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/parse-diagnostic-util.cpp48
-rw-r--r--tools/slang-test/parse-diagnostic-util.h6
2 files changed, 6 insertions, 48 deletions
diff --git a/tools/slang-test/parse-diagnostic-util.cpp b/tools/slang-test/parse-diagnostic-util.cpp
index c3c1669f1..552a0924b 100644
--- a/tools/slang-test/parse-diagnostic-util.cpp
+++ b/tools/slang-test/parse-diagnostic-util.cpp
@@ -15,30 +15,7 @@
using namespace Slang;
-/* static */ SlangResult ParseDiagnosticUtil::parseGlslangLine(const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, DownstreamDiagnostic& outDiagnostic)
-{
- /* ERROR: tests/diagnostics/syntax-error-intrinsic.slang:13: '@' : unexpected token */
-
- if (lineSlices.getCount() < 4)
- {
- return SLANG_FAIL;
- }
- {
- const UnownedStringSlice severitySlice = lineSlices[0].trim();
- outDiagnostic.severity = DownstreamDiagnostic::Severity::Error;
- if (severitySlice.caseInsensitiveEquals(UnownedStringSlice::fromLiteral("warning")))
- {
- outDiagnostic.severity = DownstreamDiagnostic::Severity::Warning;
- }
- }
-
- outDiagnostic.filePath = lineSlices[1];
-
- SLANG_RETURN_ON_FAIL(StringUtil::parseInt(lineSlices[2], outDiagnostic.fileLine));
- outDiagnostic.text = UnownedStringSlice(lineSlices[3].begin(), line.end());
- return SLANG_OK;
-}
/* static */SlangResult ParseDiagnosticUtil::parseGenericLine(const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, DownstreamDiagnostic& outDiagnostic)
{
@@ -183,8 +160,8 @@ static bool _isSlangDiagnostic(const UnownedStringSlice& line)
tests/diagnostics/accessors.slang(11): error 31101: accessors other than 'set' must not have parameters
*/
- // Need to determine where the path is located, and that depends on the compiler
- const Int pathIndex = (compilerIdentity == CompilerIdentity::make(SLANG_PASS_THROUGH_GLSLANG)) ? 1 : 0;
+ // The index where the path starts
+ const Int pathIndex = 0;
// Now we want to fix up a path as might have drive letter, and therefore :
// If this is the situation then we need to have a slice after the one at the index
@@ -254,19 +231,12 @@ static SlangResult _findDownstreamCompiler(const UnownedStringSlice& slice, Slan
/* static */ParseDiagnosticUtil::LineParser ParseDiagnosticUtil::getLineParser(const CompilerIdentity& compilerIdentity)
{
- if (compilerIdentity.m_type == CompilerIdentity::Slang)
- {
- return &parseSlangLine;
- }
- else if (compilerIdentity.m_type == CompilerIdentity::DownstreamCompiler)
+ switch (compilerIdentity.m_type)
{
- switch (compilerIdentity.m_downstreamCompiler)
- {
- case SLANG_PASS_THROUGH_GLSLANG: return &parseGlslangLine;
- default: return &parseGenericLine;
- }
+ case CompilerIdentity::Slang: return &parseSlangLine;
+ case CompilerIdentity::DownstreamCompiler: return &parseGenericLine;
+ default: return nullptr;
}
- return nullptr;
}
static bool _isWhitespace(const UnownedStringSlice& slice)
@@ -290,16 +260,10 @@ static bool _isWhitespace(const UnownedStringSlice& slice)
return SLANG_OK;
}
- // TODO(JS):
- // As it stands output of downstream compilers isn't standardized. This can be improved upon - and if so
- // we should have a function that will parse the standardized output
- // Currently dxc/fxc/glslang, use a different downstream path
-
CompilerIdentity compilerIdentity;
SLANG_RETURN_ON_FAIL(ParseDiagnosticUtil::identifyCompiler(inText, compilerIdentity));
UnownedStringSlice linePrefix;
-
if (compilerIdentity.m_type == CompilerIdentity::Type::DownstreamCompiler)
{
linePrefix = TypeTextUtil::getPassThroughAsHumanText(compilerIdentity.m_downstreamCompiler);
diff --git a/tools/slang-test/parse-diagnostic-util.h b/tools/slang-test/parse-diagnostic-util.h
index 4c4aaa75c..b9f81bfe8 100644
--- a/tools/slang-test/parse-diagnostic-util.h
+++ b/tools/slang-test/parse-diagnostic-util.h
@@ -60,12 +60,6 @@ struct ParseDiagnosticUtil
/// Given a compiler identity returns a line parsing function.
static LineParser getLineParser(const CompilerIdentity& compilerIdentity);
- /// For DXC lines
- static SlangResult parseDXCLine(const Slang::UnownedStringSlice& line, Slang::List<Slang::UnownedStringSlice>& lineSlices, Slang::DownstreamDiagnostic& outDiagnostic);
-
- /// For GLSL lines
- static SlangResult parseGlslangLine(const Slang::UnownedStringSlice& line, Slang::List<Slang::UnownedStringSlice>& lineSlices, Slang::DownstreamDiagnostic& outDiagnostic);
-
/// For a 'generic' (as in uses DownstreamCompiler mechanism) line parsing
static SlangResult parseGenericLine(const Slang::UnownedStringSlice& line, Slang::List<Slang::UnownedStringSlice>& lineSlices, Slang::DownstreamDiagnostic& outDiagnostic);