aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGHLSLRuntime.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2025-06-20 16:21:47 -0700
committerGitHub <noreply@github.com>2025-06-20 16:21:47 -0700
commit6b9fe9e0bc7421d89f38ade857c91f0ae153ad9c (patch)
tree7a93803c4bce7732aea5fcc099f75ba201599d45 /clang/lib/CodeGen/CGHLSLRuntime.cpp
parentbe7e4113c84317feda055cac68a855429e46e381 (diff)
downloadllvm-6b9fe9e0bc7421d89f38ade857c91f0ae153ad9c.zip
llvm-6b9fe9e0bc7421d89f38ade857c91f0ae153ad9c.tar.gz
llvm-6b9fe9e0bc7421d89f38ade857c91f0ae153ad9c.tar.bz2
[HLSL] Emit a version in the dx.rootsignatures metadata (#145113)
In #144957 the backend was updated to expect a version in the metadata, but since the frontend wasn't updated this breaks compilation. This is a somewhat temporary fix to that until #144813 lands.
Diffstat (limited to 'clang/lib/CodeGen/CGHLSLRuntime.cpp')
-rw-r--r--clang/lib/CodeGen/CGHLSLRuntime.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 34960c3..3103f17 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -72,12 +72,17 @@ void addRootSignature(ArrayRef<llvm::hlsl::rootsig::RootElement> Elements,
llvm::hlsl::rootsig::MetadataBuilder Builder(Ctx, Elements);
MDNode *RootSignature = Builder.BuildRootSignature();
- MDNode *FnPairing =
- MDNode::get(Ctx, {ValueAsMetadata::get(Fn), RootSignature});
+
+ // TODO: We need to wire the root signature version up through the frontend
+ // rather than hardcoding it.
+ ConstantAsMetadata *Version =
+ ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx), 2));
+ MDNode *MDVals =
+ MDNode::get(Ctx, {ValueAsMetadata::get(Fn), RootSignature, Version});
StringRef RootSignatureValKey = "dx.rootsignatures";
auto *RootSignatureValMD = M.getOrInsertNamedMetadata(RootSignatureValKey);
- RootSignatureValMD->addOperand(FnPairing);
+ RootSignatureValMD->addOperand(MDVals);
}
} // namespace