Skip to content

Commit

Permalink
Add warning for VFACE semantic (#3626)
Browse files Browse the repository at this point in the history
VFACE is obsolete. See #3494.
  • Loading branch information
jaebaek committed Mar 31, 2021
1 parent 09f5b6d commit 530ddf4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/clang/lib/Parse/ParseDecl.cpp
Expand Up @@ -616,6 +616,10 @@ bool Parser::MaybeParseHLSLAttributes(std::vector<hlsl::UnusualAnnotation *> &ta
ConsumeToken(); // consume colon.

StringRef semanticName = Tok.getIdentifierInfo()->getName();
if (semanticName.equals("VFACE")) {
Diag(Tok.getLocation(), diag::warn_unsupported_target_attribute)
<< semanticName;
}
hlsl::SemanticDecl *pUA = new (context) hlsl::SemanticDecl(semanticName);
pUA->Loc = Tok.getLocation();
ConsumeToken(); // consume semantic
Expand All @@ -627,6 +631,7 @@ bool Parser::MaybeParseHLSLAttributes(std::vector<hlsl::UnusualAnnotation *> &ta
return false;
}
}
return true;
}
// HLSL Change Ends

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: warning: Ignoring unsupported 'VFACE' in the target attribute string

float4 main(float4 color : COLOR, float vface : VFACE) : SV_TARGET
{
return (vface > 0) ? color : (color*2);
}
@@ -0,0 +1,8 @@
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck -input=stderr %s

// CHECK: warning: Ignoring unsupported 'VFACE' in the target attribute string

float4 main(float4 color : COLOR, uint 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::Warning);
}

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

0 comments on commit 530ddf4

Please sign in to comment.