From ebe9c7f3e2da779b984b336dadf37cc4ec2ae260 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 12 Oct 2022 17:02:56 -0700 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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(D))); break; + case Decl::HLSLBuffer: + getHLSLRuntime().addBuffer(cast(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 -- cgit v1.2.3