diff options
| author | Xiang Li <python3kgae@outlook.com> | 2022-10-12 17:02:56 -0700 |
|---|---|---|
| committer | Xiang Li <python3kgae@outlook.com> | 2022-10-12 21:17:38 -0700 |
| commit | ebe9c7f3e2da779b984b336dadf37cc4ec2ae260 (patch) | |
| tree | 6d739eb50337f5713790bfcdc8320fe21e5d27d5 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | e231a580139a50aff639296c4b95a65e7d89cf1e (diff) | |
[HLSL] CodeGen hlsl cbuffer/tbuffer.
cbuffer A {
float a;
float b;
}
will be translated to a global variable.
Something like
struct CB_Ty {
float a;
float b;
};
CB_Ty A;
And all use of a and b will be replaced with A.a and A.b.
Only support none-legacy cbuffer layout now.
CodeGen for Resource binding will be in separate patch.
In the separate patch, resource binding will map the resource information to the global variable.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D130131
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9c96195d85cb..efec43069ec2 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -6451,6 +6451,10 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { DI->EmitAndRetainType(getContext().getEnumType(cast<EnumDecl>(D))); break; + case Decl::HLSLBuffer: + getHLSLRuntime().addBuffer(cast<HLSLBufferDecl>(D)); + break; + default: // Make sure we handled everything we should, every other kind is a // non-top-level decl. FIXME: Would be nice to have an isTopLevelDeclKind |
