-
Notifications
You must be signed in to change notification settings - Fork 49
Description
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 registerb0
) - 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.
Related issues: