-
Notifications
You must be signed in to change notification settings - Fork 40
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
Constant buffers language spec - initial draft #419
base: main
Are you sure you want to change the base?
Conversation
third one and \texttt{w} or \texttt{a} is the fourth, and last element of the | ||
vector. | ||
|
||
\p Shader constant that has a structure, array or matrix type must always be |
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.
I'm guessing the answer is "backwards compatibility" but is there a strong argument against something like
Shader constant that has a structure, array or matrix type must always be
16-byte row-aligned. Therefore it may not specify a packoffset-element
My first thought on why not is that it could create "unbalanced" code like
cbuffer MyConstants {
MyStruct Foo : packoffset(c0);
float Foo : packoffset(c1.x);
};
but beyond that I'm not sure. Since its necessary to check x/y/z anyways it seems like the change would complicate implementations
In the end, I guess I'd just like to hear your thoughts on why it was picked to be this. Personally I'm torn because I prefer the language consistency of keeping it but also dislike the idea of language feature that does "nothing"
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.
I have no idea why it was done like that. Maybe @tex3d would know?
|
||
\p For example | ||
\begin{HLSL} | ||
float4 CameraPos : register(c2); |
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.
Mostly asking for historical context. Why is it called a register in $Globasl but packoffset for the rest?
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.
My guess is there was just a single constant buffer $Globals
before cbuffer
blocks and packoffset
were added, and register
was an established annotation at that time. So it just got extended with a 'c' value and new meaning.
@tex3d - please correct me if I am wrong! :)
Adds constant buffers to the language spec.