[clang] [HLSL] Implement the SV_InstanceID semantic (PR #221091)

Gregory Roth via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 10:56:57 PDT 2026


================
@@ -1996,6 +2005,23 @@ void SemaHLSL::diagnoseSystemSemanticAttr(Decl *D, const ParsedAttr &AL,
     return;
   }
 
+  if (SemanticName == "SV_INSTANCEID") {
+    uint64_t SizeInBits = SemaRef.Context.getTypeSize(ValueType);
+    // DXIL permits U32 or U16. SPIR-V requires 32-bit scalar per
+    // VUID-InstanceIndex-InstanceIndex-04265.
----------------
pow2clk wrote:

Again, this only worked in PS where it was being treated as user-defined. SPIR-V will complain if used this way in VS https://godbolt.org/z/vrEj63Yq9

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


More information about the cfe-commits mailing list