[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 6 10:27:24 PDT 2025
================
@@ -384,6 +384,28 @@ static Value *buildVectorInput(IRBuilder<> &B, Function *F, llvm::Type *Ty) {
return B.CreateCall(F, {B.getInt32(0)});
}
+static void addBuiltinDecoration(llvm::GlobalVariable *GV, unsigned BuiltIn) {
+ LLVMContext &Ctx = GV->getContext();
+ IRBuilder<> B(GV->getContext());
+ MDNode *Operands =
+ MDNode::get(Ctx, {ConstantAsMetadata::get(B.getInt32(11)),
+ ConstantAsMetadata::get(B.getInt32(BuiltIn))});
+ MDNode *Decoration = MDNode::get(Ctx, {Operands});
+ GV->addMetadata("spirv.Decorations", *Decoration);
----------------
farzonl wrote:
hmm should this metadata be guarded with a conditional for the spirv target?
https://github.com/llvm/llvm-project/pull/141759
More information about the cfe-commits
mailing list