gles: allow clearing index buffers #2740
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Noticed while testing WebGL manually, noticed it was referenced by some other projects
too,
e.g. iced-rs/iced#1241Description
On some browsers like Chrome, it seems like
ELEMENT_ARRAY_BUFFER
can't be used as a destination forcopy_buffer_sub_data
if the source isCOPY_READ_BUFFER
, so we can't copy fromzero_buffer
. Instead we workaround this by uploading zeroes.We could also consider caching a
Vec
filled with zeroes if we'd like to avoid an allocation, but it might result in several uploads depending on the size of the cachedVec
.Testing
Tested manually on my own project and the warning disappears. We should probably check it against all wgpu WebGL examples though.