-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
Milestone
Description
Currently, unmap() validates that the buffer is currently mapped or pending. This seems unnecessary, as unmap() can be treated as idempotent, i.e. a no-op on buffers that aren't mapped.
Right now, there's a bit of an issue with the state. Unmap does the following:
- Terminate access to the mapping from JS, and get the data out of the ArrayBuffer to send. <- State validation hasn't happened yet here, so this has to work regardless of the state.
- Send the updated data to the GPU process to update the buffer, and mark it as available to the GPU again. <- sending a message to the GPU process is entirely unnecessary if the content process already knows it's going to fail.
An alternative would be to make this an exception instead of a no-op. However, I don't think an exception is necessary. Either way is fine because unmap() still does validation before messaging the GPU process.
Also note: This is the only validation error generated from a method of GPUBuffer, which forces GPUBuffer to know what GPUDevice (error scope stack) to report errors back to. (May interact with #3250.)
Metadata
Metadata
Assignees
Labels
No labels