KhronosGroup / KhronosGroup/WebGL
Why do most functions require ArrayBufferView?
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
Functions like `bufferData` were extended in WebGL2 to accept offset/length parameters, presumably to avoid having to create temporary views that affect garbage collection, but these functions do not accept `ArrayBuffer` as the data source and instead require a view.
What is the rationale behind this limitation? Is there a technical limitation that makes it more difficult to fetch raw buffer data at a given offset? If I only have an ArrayBuffer to work with, these "optimized" functions are useless to me as I have to create a view anyway.
For instance, WebAssembly memory only exposes an ArrayBuffer, and since it can dynamically resize (changing the underlying buffer), I would have to do extra comparisons every time to make sure my view is up to date.
Contributor guide
Research direction
Start by reading the WebGL2 bufferData API and the ArrayBufferView requirement described in the issue, then compare how WebAssembly memory exposes an ArrayBuffer. Done means establishing whether accepting ArrayBuffer with offset and length is technically feasible and documenting the rationale or a concrete API change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, wasm
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100