-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Description
While discussing #708 there was some concern by @kvark that mapAsync
didn't show clearly in the place where it was called if it was for reading and writing, and given the semantics of the two are very different, this can be confusing.
The two proposed solutions are:
- Splitting into two different entrypoints
mapReadAsync
andmapWriteAsync
:
partial interface GPUBuffer {
Promise<void> mapReadAsync(
optional GPUSize64 offset = 0,
optional GPUSize64 size = 0);
Promise<void> mapWriteAsync(
optional GPUSize64 offset = 0,
optional GPUSize64 size = 0);
// getMappedRange and unmap are unchanged
}
- Adding map flags (@jdashg's idea) that could later be used to extend
mapAsync
with more modes:
typedef [EnforceRange] unsigned long GPUMappingFlags;
interface GPUMapping {
const GPUMappingFlags READ = 0x01;
const GPUMappingFlags WRITE = 0x02;
};
partial interface GPUBuffer {
Promise<void> mapAsync(
GPUMappingFlags flags,
optional GPUSize64 offset = 0,
optional GPUSize64 size = 0);
}
I think either solution would work well, and don't have an opinion either way, but resolution of this is blocking our implementation of the new mapping so it would be nice to decide.
kvark
Metadata
Metadata
Assignees
Labels
No labels