diff options
| author | Yong He <yonghe@outlook.com> | 2025-01-17 08:56:23 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 08:56:23 -0800 |
| commit | e743c17f72ab332f7eb467f02dd9567f3f8d3de0 (patch) | |
| tree | 73a3e9bda58cfff408d813fa34f24cd252121fde | |
| parent | 3666c66e26f90b10031578e9c8b8f2ea118aecf9 (diff) | |
Fix `-capability` arg in SPIRV debug command line output. (#6114)
| -rw-r--r-- | source/slang/slang-compiler-options.cpp | 16 | ||||
| -rw-r--r-- | tests/spirv/cmd-arg-debug-info.slang | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/source/slang/slang-compiler-options.cpp b/source/slang/slang-compiler-options.cpp index 9b7091756..8a27f6fce 100644 --- a/source/slang/slang-compiler-options.cpp +++ b/source/slang/slang-compiler-options.cpp @@ -54,11 +54,21 @@ void CompilerOptionSet::writeCommandLineArgs(Session* globalSession, StringBuild switch (option.key) { case CompilerOptionName::Capability: - for (auto v : option.value) { - sb << " " << optionInfo.names << " " << v.stringValue; + StringBuilder subBuilder; + for (auto v : option.value) + { + if (subBuilder.getLength() != 0) + subBuilder << "+"; + if (v.kind == CompilerOptionValueKind::Int) + subBuilder << capabilityNameToString((CapabilityName)v.intValue); + else + subBuilder << v.stringValue; + } + if (subBuilder.getLength()) + sb << " " << optionInfo.names << " " << subBuilder.produceString(); + break; } - break; case CompilerOptionName::Include: for (auto v : option.value) { diff --git a/tests/spirv/cmd-arg-debug-info.slang b/tests/spirv/cmd-arg-debug-info.slang new file mode 100644 index 000000000..da5cebad0 --- /dev/null +++ b/tests/spirv/cmd-arg-debug-info.slang @@ -0,0 +1,5 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -g3 -emit-spirv-directly -profile sm_6_6+spirv_1_5 +// CHECK: OpString "-target spirv {{.*}} -capability spirv_1_5 +[numthreads(1,1,1)] +void computeMain() +{}
\ No newline at end of file |
