-
Notifications
You must be signed in to change notification settings - Fork 335
Rename GPUVertexFormat members to match GPUTextureFormat #1322
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
Conversation
See recent discussion on gpuweb#206
I like this but we don't have consensus here yet. |
Proposal from @toji in meeting: Consider having these match the vec types in WGSL (for both vertex and texture), somehow, instead. |
Problem I just thought of with this is we have to add something to describe the notions that are not expressed in WGSL:
|
Point I expressed on the call: both D3D ( |
Because of prior art I have a relatively strong preference to reuse pixel formats, and also because of prior art I don't think this will be a major source of confusion for people. People are pretty good at analogies! |
IMHO this change isn't super necessary as the vertex formats work well as is and adding semantics with color names doesn't make things more understandable. Color channels make sense for textures because of all the special cases and the opaque-layout, but the vertex buffers are just linear memory. We're basically churning names because we can, not because we have to. Given our timeline I think we should have an increased bar for breaking API changes so we can get to a v1 in finite time. |
Oh wow, hold on. This is the time to do breaking changes, why would we want to increase the bar for it now? The names are inconsistent and confusing to some extent. They increase the API complexity for no reason, we should fix em. |
As we're getting closer to a v1, it's natural that the bar should increase and bikeshedding decrease. IMHO this change is at most a very minor improvement (or even not an improvement at all) so it's the type of bikeshedding we should stop doing very soon. |
I think the core question is whether this is a non-negligible improvement or not. I think it's worth the change. I'm not sure whether we should do this or something like
It still matches nicely with the texture formats, just replacing |
Fwiw I prefer the |
We talked about this with @kvark on Monday and one reason to make both vertex and texture format enums match would be that it makes it clear that the layout is the same when fetching vertex data and when doing copies from buffers to textures. I'm now neutral on this change. |
Agreed. I actually don't think they're strictly speaking ambiguous - these days they have well defined meanings - and that's why I was okay with these names when we first landed it. But I consider the |
I really don't like this. I don't think many people are confused by the fact that vertex data uses different type names from texture formats. Also, vertex data is almost always going to have a position attribute. It doesn't make sense that that should be an I suggest we put a table in the spec explaining that e.g. "float4" is comparable to "rgba32float". |
If we can't use rgba32float for both, I might rather have xyzw32float. (and rgba32float) None of these are wholly satisfying to me. |
I guess I poorly explained my goal - it's really not to make the names the same. I agree I don't think that is really a source of confusion. My goal is to make them more consistent with one another - in particular get rid of these outlying My current thought is that flipping things around to make |
That sounds like an easier stepping stone to get consensus for. |
Pushed a commit trying out some new names, but I'm not sold on them at all. But they give something to contemplate. |
The new names seem ok for vertex formats but look completely alien for texture formats. It's weird to move from RGB nomenclature for texture as everyone is super used to these names. |
It's falling apart on texture formats :) But on vertex formats - it's definitely an improvement, since it addresses the inconsistency of naming by using the same "unorm" and the bitcount semantic. @kainino0x could we get the texture formats back, and proceed with only the vertex format changes? |
One thing to consider before we land on a change is how would we represent vertex formats that aren't so simple? For example, Metal has the following:
D3D12 also has optional 5-6-5 and 5-6-5-1 vertex formats. Vulkan also allows VK_FORMAT_A8B8G8R8_{U,S}{INT,NORM}_PACK32. (Admittedly I have no clue how this is different from R8G8B8A8 though. Maybe the bits are reversed?) Another question is whether the order of parts of the name should match the texture formats. E.g. instead of "unorm8x4", "4x8unorm" (to match "rgba8unorm"). I think that's kind of weird though, and not that necessary. |
I don't really have an opinion whether to take this PR or not, but |
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.
Agreed with @Kangz's feedback that the x1
feels unnecessary, but I wouldn't block on it. Otherwise this LGTM
I disagree actually. Imagine code that says: |
I don't know that I'm super comfortable leaning on IDE features to supply API readability. Modern editors are pretty amazing at it but JS is a notoriously finicky language to autocomplete in the best of situations and I find that frequently built-in APIs like this can lag in editor support. I've moved from "supportive" to "apathetic" regarding dropping the |
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.
Glad we don't have rgba
in our vertex formats :)
So we have approvals from Google, Mozilla, and Apple now. Can we just proceed without waiting another week for a call? |
Yes |
@kvark what's your opinion about |
@kainino0x no strong opinion. Arguments from both sides are reasonable, and it only affects 3 formats anyway. |
Last meeting we asked people to chime in if they had concerns (apart from the |
Yep, let's not keep this floating any longer. |
Filed #1434 to follow-up |
1235: Update VertexFormat variants r=grovesNL a=kvark **Connections** Matches gpuweb/gpuweb#1322 and gpuweb/gpuweb#1469 **Description** Just updates us to recent upstream API. Also breaks lots of user code! **Testing** Not functional Co-authored-by: Dzmitry Malyshau <[email protected]>
This does the changes to follow: - gpuweb/gpuweb#1322 and - gpuweb/gpuweb#1469
This does the changes to follow: - gpuweb/gpuweb#1322 and - gpuweb/gpuweb#1469
This PR adds unimplemented stubs for the `modf` builtin. Issue: gpuweb#1229 gpuweb#1228 gpuweb#1227 gpuweb#1226
See recent discussion on #206.
Investigation below on what vertex formats we might need to express in the future.
Preview | Diff