Skip to content

Commit 9f6cd56

Browse files
authored
[HLSL] Use HLSLToolChain for Vulkan (#110306)
The options are not translated correctly when targeting Vulkan using the dxc driver mode. Resuing the translator used for HLSL. Fixes problem 2 in #108567.
1 parent ac0f64f commit 9f6cd56

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6481,6 +6481,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
64816481
case llvm::Triple::ZOS:
64826482
TC = std::make_unique<toolchains::ZOS>(*this, Target, Args);
64836483
break;
6484+
case llvm::Triple::Vulkan:
64846485
case llvm::Triple::ShaderModel:
64856486
TC = std::make_unique<toolchains::HLSLToolChain>(*this, Target, Args);
64866487
break;

clang/test/CodeGenHLSL/entry.hlsl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// RUN: dxil-pc-shadermodel6.3-compute %s -hlsl-entry foo \
33
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
44

5+
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
6+
// RUN: spirv-unknown-vulkan-compute %s -hlsl-entry foo \
7+
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
8+
59
// Make sure not mangle entry.
610
// CHECK:define void @foo()
711
// Make sure add function attribute and numthreads attribute.

clang/test/Driver/dxc_E.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: not %clang_dxc -Efoo -Tlib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s
2+
// RUN: not %clang_dxc -Efoo -Tlib_6_7 -spirv foo.hlsl -### %s 2>&1 | FileCheck %s
23

34
// Make sure E option flag which translated into "-hlsl-entry".
45
// CHECK:"-hlsl-entry" "foo"

0 commit comments

Comments
 (0)