-
Notifications
You must be signed in to change notification settings - Fork 40
Add initial proposal for cbuffer contexts #497
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
base: main
Are you sure you want to change the base?
Conversation
This adds an initial rough proposal for simplifying cbuffers in HLSL 202x.
[FXC @ ShaderPlayground](https://shader-playground.timjones.io/22396dd8aec3318b3e9a598c612f156e) | ||
[DXC @ Compiler Explorer](https://godbolt.org/z/WYK7jvvfP) | ||
|
||
In DXC, `a` and `b` are referenced directly with no namespace qualifications, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually possible to reference a
and b
in DXC by both qualified and unqualifies names as long as the namespace contains more than just a cbuffer
: https://godbolt.org/z/Ph57WYexr. Which is clearly a bug.
(filed in microsoft/DirectXShaderCompiler#4514 and microsoft/DirectXShaderCompiler#7322)
A `cbuffer` may only be declared at translation unit or namespace scope. A | ||
`cbuffer` may only contain variable (or empty) declarations. All declarations | ||
within a `cbuffer` declare names in the immediate enclosing scope. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth to enumerate types of declarations that will no longer be allowed? Functions, records, static & groupshared var decls...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe add a note at the beginning that cbuffer
should be a collection of constants provided for the shader and that other declarations do not make sense to be included in this context.
This adds an initial rough proposal for simplifying cbuffers in HLSL 202x.