[clang] [llvm] [HLSL][SPIR-V] Implements SV_Position for VS/PS I/O (PR #168735)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 07:04:45 PST 2025


================
@@ -961,11 +967,14 @@ void SemaHLSL::checkSemanticAnnotation(
   }
 
   if (SemanticName == "SV_POSITION") {
-    // TODO(#143523): allow use on other shader types & output once the overall
-    // semantic logic is implemented.
-    if (ST == llvm::Triple::Pixel)
+    // SV_Position can is I/O for vertex shaders.
+    // For pixel shaders, only valid as input.
+    // Note: for SPIR-V, not backed by a builtin when used as input in a vertex
+    // shaders.
----------------
Keenuts wrote:

For now, it doesn't matter that much. It will become important in sema with the `vk::location` annotation: depending if the semantic is lowered to a builtin or a location decorated I/O, the attribute are mandatory on all fields or not.
(Partial location assignment is not allowed, except if the non-explicit locations are semantics lowered to built-ins).

(I believe this was not a by-design behavior, but a resulting behavior due to the way the vk::location attribute was handled by DXC, white late)
I'll remove  this bit.

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


More information about the llvm-commits mailing list