Skip to content

Commit 786268e

Browse files
authored
[spirv] Emit error message when -Gec flag is used (microsoft#5526)
The -Gec option is not supported by the SPIR-V backend so emit an explicit error when it is used in combination with -spirv. Closes microsoft#3890
1 parent 715e8e8 commit 786268e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/DxcSupport/HLSLOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ static bool hasUnsupportedSpirvOption(const InputArgList &args,
328328
// Note: The options checked here are non-exhaustive. A thorough audit of
329329
// available options and their current compatibility is needed to generate a
330330
// complete list.
331-
std::vector<OptSpecifier> unsupportedOpts = {OPT_Fd, OPT_Fre,
332-
OPT_Qstrip_reflect, OPT_Gis};
331+
std::vector<OptSpecifier> unsupportedOpts = {OPT_Fd, OPT_Fre, OPT_Gec,
332+
OPT_Gis, OPT_Qstrip_reflect};
333333

334334
for (const auto &id : unsupportedOpts) {
335335
if (Arg *arg = args.getLastArg(id)) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %dxc -T ps_6_0 -E main -spirv -Gec
2+
3+
void main() {}
4+
5+
// CHECK: -Gec is not supported with -spirv

tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,5 +3246,8 @@ TEST_F(FileTest, SpirvOptFre) {
32463246
TEST_F(FileTest, SpirvOptQStripReflect) {
32473247
runFileTest("spirv.opt.qstripreflect.hlsl", Expect::Failure);
32483248
}
3249+
TEST_F(FileTest, SpirvOptGec) {
3250+
runFileTest("spirv.opt.gec.hlsl", Expect::Failure);
3251+
}
32493252

32503253
} // namespace

0 commit comments

Comments
 (0)