[clang] [HLSL][Clang] Support SV_VertexID semantic (PR #184640)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 08:34:24 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/lib/CodeGen/CGHLSLRuntime.cpp clang/lib/Sema/SemaHLSL.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 82aba22d3..7537cf962 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -771,7 +771,9 @@ llvm::Value *CGHLSLRuntime::emitSystemSemanticLoad(
   if (SemanticName == "SV_VERTEXID") {
     if (ST == Triple::EnvironmentType::Vertex) {
       if (CGM.getTarget().getTriple().isSPIRV())
-        return createSPIRVBuiltinLoad(B, CGM.getModule(), Type, Semantic->getAttrName()->getName(), /* BuiltIn::VertexIndex */ 42);
+        return createSPIRVBuiltinLoad(B, CGM.getModule(), Type,
+                                      Semantic->getAttrName()->getName(),
+                                      /* BuiltIn::VertexIndex */ 42);
       else
         return emitDXILUserSemanticLoad(B, Type, Semantic, Index);
     }
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 50933fb8d..b43ddb786 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -1012,7 +1012,8 @@ void SemaHLSL::checkSemanticAnnotation(
     return;
   }
   if (SemanticName == "SV_VERTEXID") {
-    diagnoseSemanticStageMismatch(SemanticAttr, ST, SC.CurrentIOType, {{llvm::Triple::Vertex, IOType::In}});
+    diagnoseSemanticStageMismatch(SemanticAttr, ST, SC.CurrentIOType,
+                                  {{llvm::Triple::Vertex, IOType::In}});
     return;
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/184640


More information about the cfe-commits mailing list