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

Document constant buffers in the language spec #357

Open
Tracked by #41
hekota opened this issue Dec 3, 2024 · 0 comments
Open
Tracked by #41

Document constant buffers in the language spec #357

hekota opened this issue Dec 3, 2024 · 0 comments
Assignees
Labels
language-spec Issue with completed spec

Comments

@hekota
Copy link
Member

hekota commented Dec 3, 2024

We need to add constant buffers to the HLSL language spec.
That includes documenting the different ways to declare a constant buffer (cbuffer vs. ConstantBuffer), cbuffer and packoffset grammar, and rules on what exactly is allowed inside a cbuffer declaration.

DXC currently supports quite a few more or less unusual constructs such as:

  • nested cbuffer declarations
  • multiple cbuffer declarations with the same name
  • constants defined outside of cbuffer context (to be placed in $Globals constant buffer and bound to first register b0)
  • namespace declarations inside cbuffer context
  • function definitions inside cbuffer context

The spec should clarify which of these are we going to support in Clang.

@tex3d put together an example that these various interesting cases here:
https://godbolt.org/z/E4cdx7xj8

Same shader with FXC:
https://shader-playground.timjones.io/39c0683735c0cd79b5970b5116765940

One difference between FXC and DXC in the nested cbuffer case. FXC binds outer cbuffer declaration before the nested one while DXC binds it after.

@hekota hekota added the language-spec Issue with completed spec label Dec 3, 2024
@damyanp damyanp moved this to Designing in HLSL Support Dec 3, 2024
@damyanp damyanp moved this from Designing to Planning in HLSL Support Dec 3, 2024
@davidcook-msft davidcook-msft moved this from Planning to Ready in HLSL Support Dec 17, 2024
@hekota hekota mentioned this issue Jan 13, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-spec Issue with completed spec
Projects
None yet
Development

No branches or pull requests

1 participant