这是indexloc提供的服务,不要输入任何密码
Skip to content

Pad implicit mapping sizes up to multiples of 4 bytes? #2010

@kainino0x

Description

@kainino0x

Follow-up to #1999.

Right now if you want to create a buffer that isn't a multiple of 4 bytes, the last 1-3 bytes can't be accessed by mapping:

  • using mappedAtCreation makes the createBuffer call invalid
  • mapAsync with the default size fails, so the size must be specified explicitly at a different size

So, what if we just:

  • allow the end of a mapAsync/getMappedRange to go past the end of the buffer, to the next multiple of 4
  • round up the default mapAsync size (undefined) and the mappedAtCreation range to that

TBD what the exact semantics of those 1-3 padding bytes should be. Probably they persist in the mapping shadow allocation, but validation prevents them from ever being used by anything else. However we could potentially also allow copyBufferToBuffer to access those bytes if we also wanted to polish off that rough edge (mentioned in #1999).

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU API

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions