-
Notifications
You must be signed in to change notification settings - Fork 345
Expose the buffer state as an attribute #3014
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
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Previews, as seen when this build job started (b1f0692): |
|
Sketched some possibilities on how to expose this |
|
I thought I remember a discussion that "unmapped" is unclear but couldn't find it again. I made proposal 4 which is proposal 2 but uses the name "unmapped". I think "mappable" would be misleading because some buffers are in the unmapped state but aren't mappable so that enum value would be confusing. IMHO developers will understand that unmapped means "usable on the GPU". The other thing is that I think we should make the distinction between pending and unmapped because otherwise there isn't a way to know if the buffer can be used in a submit. |
|
[Editors]
Most likely there isn't any value in trying to hide this detail from the user, so we should probably expose it. That said, I'm in the middle of trying to work through the detangling of content-private vs content-shared vs device-timeline state and that might provide an answer to this issue. |
|
Another thought: the "locked" state probably isn't necessary. In particular, we wouldn't be guaranteeing that, if a buffer is not "locked", the map will actually succeed. It can still fail due to mapAsync validation (e.g. already mapped, destroyed, doesn't contain usage, etc.) With multithreading, we also don't really need to expose a "locked" state when mapped on another thread - that'll be covered by the existing validation check in mapAsync that checks the buffer isn't mapped already. So revising this proposal to have three states: "unmapped", "pending", and "mapped". |
f514923 to
3ebbf95
Compare
|
Note with this proposal, "destroyed" can be a purely service side state as I have been hoping. In fact, the entire "buffer state" can move to the service side, which I've now gone ahead and done. Note in the multithreaded future, "unmapped" and "pending" mean just on this thread/this GPUBuffer object. It might also be in any state on another thread. |
Revised proposal and skimming the diff, things look good, thanks! |
toji
left a comment
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.
Looks good, but don't we need to transition the mapState back to "unmapped" in the .unmap() algorithm? That's missing here.
Oops, forgot this. That algorithm is kind of nonsensical right now so we also need to fix that soon. Maybe with #3264. |
|
Previews, as seen when this build job started (4219789): |
|
Previews, as seen when this build job started (62b5c10): |
GPU Web meeting 2022-08-02/03 APAC-timed
|
|
Meeting resolution: Agreed but adding to tacit resolution for @litherum to give input at the next meeting (or earlier) |
This comment was marked as duplicate.
This comment was marked as duplicate.
This change tries not to have behavior effects compared to what we have specced now, but since what we have now doesn't quite make sense, it picks just one of several possible interpretations of what we had written. #3271 is open about which one we actually pick. **I'm calling this editorial despite picking an interpretation it leaves an open issue to figure out which one to use.** This is now independent of exposing the buffer state as an attribute (#3014). This change defines a number of content-side states from which that attribute would be defined. The notable changes are: - Server side now has just 2 states: available, unavailable. - Client side has two state variables: - `[[mapping]]` which is either null, or all of the stuff for an actively-mapped buffer (not pending). - `[[map_requests]]` which tracks all map requests that haven't yet gotten a response from the device. - At least in the mapping methods, client states are only accessed on the client, and server states are only accessed on the server. - `unmap()` is rewritten to deinterlace the client and server side steps. - **`unmap()` doesn't reject promises. Instead it marks requests as cancelled so they get rejected when the map request completes.**
62b5c10 to
b4b0589
Compare
b4b0589 to
510d7a8
Compare
|
Previews, as seen when this build job started (510d7a8): |
|
was only waiting for approval from Apple, and got explicit approval so landing now. |
It is added to the WebGPU spec at gpuweb/gpuweb#3014 bug: dawn:1521 Change-Id: If6ed910f8ec0ca0df678c38881188cb25630c437 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4145218 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Takahiro <hogehoge@gachapin.jp> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Cr-Commit-Position: refs/heads/main@{#1090606}
Fixes #3013
Preview | Diff