[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:22:35 PST 2025


================
@@ -759,11 +767,14 @@ void CGHLSLRuntime::emitSystemSemanticStore(IRBuilder<> &B, llvm::Value *Source,
                                             std::optional<unsigned> Index) {
 
   std::string SemanticName = Semantic->getAttrName()->getName().upper();
-  if (SemanticName == "SV_POSITION")
-    createSPIRVBuiltinStore(B, CGM.getModule(), Source,
-                            Semantic->getAttrName()->getName(),
-                            /* BuiltIn::Position */ 0);
-  else
+  if (SemanticName == "SV_POSITION") {
+    if (CGM.getTarget().getTriple().isDXIL())
+      emitDXILUserSemanticStore(B, Source, Semantic, Index);
+    else if (CGM.getTarget().getTriple().isSPIRV())
+      createSPIRVBuiltinStore(B, CGM.getModule(), Source,
+                              Semantic->getAttrName()->getName(),
+                              /* BuiltIn::Position */ 0);
+  } else
     llvm_unreachable("non-handled system semantic. FIXME.");
----------------
Keenuts wrote:

changed the pattern so missed cases all goes down to the unreachable.

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


More information about the llvm-commits mailing list