-
Notifications
You must be signed in to change notification settings - Fork 186
Update Location Chapter for matrix #321
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -128,16 +128,14 @@ Some shader stages, like geometry shaders, have an array around its interface ma | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| == Matrix | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| A matrix is viewed as an array, which consume all 4 components. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| So something like | ||||||||||||||||||||||||||
| A matrix is viewed as an array of vector, this means something like | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [source,glsl] | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
| layout(location = 0) in mat3x2 a; | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| From a `Location`/`Component` point-of-view looks like | ||||||||||||||||||||||||||
| from a `Location`/`Component` point-of-view looks like | ||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [source,glsl] | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
|
|
@@ -146,14 +144,21 @@ From a `Location`/`Component` point-of-view looks like | |||||||||||||||||||||||||
| layout(location = 0) in vec2 a[3]; | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| As stated above, arrays consume the whole `Location` so the following is **not** allowed. | ||||||||||||||||||||||||||
| Just like vector, depending on the size, it may not consume the whole `Location`. This means the following is allowed. | ||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also the "Arrays consume whole location" comment above is wrong - where did that come from? |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [source,glsl] | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
| layout(location = 0) in mat3x2 a; | ||||||||||||||||||||||||||
| layout(location = 2, component = 2) in float b; | ||||||||||||||||||||||||||
| layout(location = 1, component = 2) in float b; | ||||||||||||||||||||||||||
| layout(location = 2, component = 2) in float c; | ||||||||||||||||||||||||||
| ---- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `float b` is invalid because the implicit array of the matrix consumes all of `Location` 2. | ||||||||||||||||||||||||||
| The `b` and `c` float are still valid here. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| image::{images}location_example_matrix.svg[location_example_matrix] | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [NOTE] | ||||||||||||||||||||||||||
| ==== | ||||||||||||||||||||||||||
| You don't need to worry about things going "in front" of a matrix because the `Component` decoration | ||||||||||||||||||||||||||
| link:https://godbolt.org/z/f81PvP538[can not be applied on a matrix type]. | ||||||||||||||||||||||||||
|
Comment on lines
+162
to
+163
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe? "In front" seems overly vague to me. |
||||||||||||||||||||||||||
| ==== | ||||||||||||||||||||||||||
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.
"Viewed as" implies something else.