diff options
author | Helena Kotas <hekotas@microsoft.com> | 2024-10-17 17:59:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 17:59:08 -0700 |
commit | 7dbfa7b981417773d01c52b0d716d592870081bb (patch) | |
tree | a48d54c693a9a9de8925ab7255e5f5ad85183d0f /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 7106de9573c29db5d107a2f4ab02d8621eea2510 (diff) | |
download | llvm-7dbfa7b981417773d01c52b0d716d592870081bb.zip llvm-7dbfa7b981417773d01c52b0d716d592870081bb.tar.gz llvm-7dbfa7b981417773d01c52b0d716d592870081bb.tar.bz2 |
[HLSL] Add handle initialization for simple resource declarations (#111207)
Adds `@_init_resource_bindings()` function to module initialization that
includes `handle.fromBinding` intrinsic calls for simple resource
declarations. Arrays of resources or resources inside user defined types
are not supported yet.
While this unblocks our progress on [Compile a runnable shader from
clang](https://github.com/llvm/wg-hlsl/issues/7) milestone, this is
probably not the way we would like to handle resource binding
initialization going forward. Ideally, it should be done via the
resource class constructors in order to support dynamic resource binding
or unbounded arrays if resources.
Depends on PRs #110327 and #111203.
Part 1 of #105076
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b3e805a..9a84a11 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5634,6 +5634,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, getCUDARuntime().handleVarRegistration(D, *GV); } + if (LangOpts.HLSL) + getHLSLRuntime().handleGlobalVarDefinition(D, GV); + GV->setInitializer(Init); if (emitter) emitter->finalize(GV); |