Add ConstantBuffer<T> definition to HLSLExternalSemaSource. The resource definition will contain a handle that will be lowered to a dx.CBuffer target extension type.
Note that members of a struct that is passed as a template argument to ConstantBuffer can be accessed directly as if they are members of the ConstantBuffer class.
struct MyConstants {
int MyConstValue;
};
ConstantBuffer<MyConstants> CB : register(b0);
RWBuffer<int> Buf;
[numthreads(32, 1, 1)]
void main(uint3 dispatch_thread_id : SV_DispatchThreadID) {
Buf[0] = CB.MyConstValue;
}
https://godbolt.org/z/6GdE383j3
Refer to Proposal for mapping resource attributes for resource attribute mapping.
Depends on llvm/wg-hlsl#178