Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HLSL] Add ConstantBuffer template definition to HLSLExternalSemaSource and enable direct member access #112993

Open
Tracked by #41
hekota opened this issue Oct 18, 2024 · 0 comments
Assignees
Labels
HLSL HLSL Language Support

Comments

@hekota
Copy link
Member

hekota commented Oct 18, 2024

Add ConstantBuffer 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.

@hekota hekota mentioned this issue Oct 18, 2024
7 tasks
@hekota hekota transferred this issue from llvm/wg-hlsl Oct 18, 2024
@hekota hekota moved this to Planning in HLSL Support Oct 18, 2024
@hekota hekota changed the title Define the ConstantBuffer<...> template in HLSLExternalSemaSource [HLSL] Add ConstantBuffer template definition to HLSLExternalSemaSource Oct 18, 2024
@EugeneZelenko EugeneZelenko added HLSL HLSL Language Support and removed new issue labels Oct 18, 2024
@davidcook-msft davidcook-msft moved this from Planning to Designing in HLSL Support Oct 22, 2024
@hekota hekota changed the title [HLSL] Add ConstantBuffer template definition to HLSLExternalSemaSource [HLSL] Add ConstantBuffer template definition to HLSLExternalSemaSource and enable direct member access Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
Status: Designing
Development

No branches or pull requests

3 participants