Skip to content

Commit

Permalink
[spirv] reject VFACE semantic
Browse files Browse the repository at this point in the history
VFACE is not obsolete. See microsoft#3494.
  • Loading branch information
jaebaek committed Mar 25, 2021
1 parent 3bbcc69 commit 1493c32
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/clang/lib/SPIRV/DeclResultIdMapper.cpp
Expand Up @@ -2143,7 +2143,12 @@ bool DeclResultIdMapper::createStageVars(
// should have semantics attached;
// * If the current decl is not a struct, it should have semantic attached.

const auto loc = decl->getLocation();
auto thisSemantic = getStageVarSemantic(decl);
if (thisSemantic.str.equals("VFACE")) {
emitError("'VFACE' semantics is no longer supported", loc);
return false;
}

// Which semantic we should use for this decl
auto *semanticToUse = &thisSemantic;
Expand All @@ -2159,7 +2164,6 @@ bool DeclResultIdMapper::createStageVars(
semanticToUse = inheritSemantic;
}

const auto loc = decl->getLocation();
if (semanticToUse->isValid() &&
// Structs with attached semantics will be handled later.
!type->isStructureType()) {
Expand Down
8 changes: 8 additions & 0 deletions tools/clang/test/CodeGenSPIRV/var.vface.interface.hlsl
@@ -0,0 +1,8 @@
// Run: %dxc -T ps_6_0 -E main

// CHECK: error: 'VFACE' semantics is no longer supported

float4 main(float4 color : COLOR, float vface : VFACE) : SV_TARGET
{
return (vface > 0) ? color : (color*2);
}
4 changes: 4 additions & 0 deletions tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp
Expand Up @@ -208,6 +208,10 @@ TEST_F(FileTest, GlobalsCBufferError) {
runFileTest("var.globals.error.hlsl", Expect::Failure);
}

TEST_F(FileTest, VarVFACEInterface) {
runFileTest("var.vface.interface.hlsl", Expect::Failure);
}

// For prefix/postfix increment/decrement
TEST_F(FileTest, UnaryOpPrefixIncrement) {
runFileTest("unary-op.prefix-inc.hlsl");
Expand Down

0 comments on commit 1493c32

Please sign in to comment.