[clang] [HLSL] Get the index for resource bindings from the slot (PR #117303)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 09:14:45 PST 2024
================
@@ -588,7 +588,7 @@ llvm::Function *CGHLSLRuntime::createResourceBindingInitFn() {
auto *Slot = llvm::ConstantInt::get(CGM.IntTy, RBA->getSlotNumber());
// FIXME: resource arrays are not yet implemented
auto *Range = llvm::ConstantInt::get(CGM.IntTy, 1);
- auto *Index = llvm::ConstantInt::get(CGM.IntTy, 0);
+ auto *Index = llvm::ConstantInt::get(CGM.IntTy, RBA->getSlotNumber());
----------------
bogner wrote:
If we opt to diverge this by target we should probably not use the matching intrinsic names between dxil and spirv in this case, as that could end up confusing. It might be best to defer that until we're dealing with textures or the binding attribute so we can make sure we're making the right decisions on how to split it up.
I *think* it would be fine to just do this indexing in the backend, since any index that's less than the slot should be invalid anyway. I'll try that out and report back.
https://github.com/llvm/llvm-project/pull/117303
More information about the cfe-commits
mailing list