summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-01 17:30:55 -0700
committerGitHub <noreply@github.com>2024-05-01 17:30:55 -0700
commit9043bc5522cc86560ac5d57ddfc6cfa7612c9222 (patch)
tree9804bb8a682386b9f761e8fb164cb43ad5390411 /tools
parent0bb826f8b92aec330875d0b966c1f4a6b99988bf (diff)
Fix compile failures when using debug symbol. (#4069)
* Fix compile failures when using debug symbol. * Various fixes. * Fix intrinsic. * Fix test.
Diffstat (limited to 'tools')
-rw-r--r--tools/render-test/options.cpp4
-rw-r--r--tools/render-test/options.h6
-rw-r--r--tools/render-test/render-test-main.cpp2
-rw-r--r--tools/render-test/slang-support.cpp10
4 files changed, 18 insertions, 4 deletions
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index 1d7c3cc2e..57d4a2641 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -222,6 +222,10 @@ static gfx::DeviceType _toRenderType(Slang::RenderApiType apiType)
//
// TODO: At some point we could warn/error and deprecate this option.
}
+ else if (argValue == "-g0")
+ {
+ outOptions.disableDebugInfo = true;
+ }
else if (argValue == "-allow-glsl")
{
outOptions.allowGLSL = true;
diff --git a/tools/render-test/options.h b/tools/render-test/options.h
index 5a46c4000..6ea166833 100644
--- a/tools/render-test/options.h
+++ b/tools/render-test/options.h
@@ -71,6 +71,8 @@ struct Options
bool dontAddDefaultEntryPoints = false;
+ bool disableDebugInfo = false;
+
bool allowGLSL = false;
Slang::String entryPointName;
@@ -83,11 +85,7 @@ struct Options
Slang::DownstreamArgs downstreamArgs; ///< Args to downstream tools. Here it's just slang
-#if defined(SLANG_CONFIG_DEFAULT_SPIRV_DIRECT)
bool generateSPIRVDirectly = true;
-#else
- bool generateSPIRVDirectly = false;
-#endif
Options() { downstreamArgs.addName("slang"); }
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index fcdd4b54d..50d99c155 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -1415,6 +1415,8 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
desc.slang.lineDirectiveMode = SLANG_LINE_DIRECTIVE_MODE_NONE;
if (options.generateSPIRVDirectly)
desc.slang.targetFlags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY;
+ else
+ desc.slang.targetFlags = 0;
List<const char*> requiredFeatureList;
for (auto& name : options.renderFeatures)
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index dd0394fdf..f76e83937 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -120,6 +120,8 @@ void ShaderCompilerUtil::Output::reset()
spSetTargetProfile(slangRequest, 0, spFindProfile(out.session, input.profile.getBuffer()));
if (options.generateSPIRVDirectly)
spSetTargetFlags(slangRequest, 0, SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY);
+ else
+ spSetTargetFlags(slangRequest, 0, 0);
slangRequest->setAllowGLSLInput(options.allowGLSL);
@@ -212,6 +214,14 @@ void ShaderCompilerUtil::Output::reset()
spSetLineDirectiveMode(slangRequest, SLANG_LINE_DIRECTIVE_MODE_NONE);
}
+ if (options.generateSPIRVDirectly)
+ {
+ if (options.disableDebugInfo)
+ spSetDebugInfoLevel(slangRequest, SLANG_DEBUG_INFO_LEVEL_NONE);
+ else
+ spSetDebugInfoLevel(slangRequest, SLANG_DEBUG_INFO_LEVEL_STANDARD);
+ }
+
const SlangResult res = spCompile(slangRequest);
if (auto diagnostics = spGetDiagnosticOutput(slangRequest))