Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gles: allow clearing index buffers #2740

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

grovesNL
Copy link
Collaborator

@grovesNL grovesNL commented Jun 6, 2022

Connections
Noticed while testing WebGL manually, noticed it was referenced by some other projects too, e.g. iced-rs/iced#1241

Description
On some browsers like Chrome, it seems like ELEMENT_ARRAY_BUFFER can't be used as a destination for copy_buffer_sub_data if the source is COPY_READ_BUFFER, so we can't copy from zero_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 cached Vec.

Testing
Tested manually on my own project and the warning disappears. We should probably check it against all wgpu WebGL examples though.

@grovesNL grovesNL force-pushed the clear-element-buffer branch from d120593 to 129fd26 Compare June 6, 2022 23:10
@grovesNL grovesNL force-pushed the clear-element-buffer branch from 129fd26 to b3fcf40 Compare June 6, 2022 23:11
@grovesNL
Copy link
Collaborator Author

grovesNL commented Jun 6, 2022

I've tested the existing WebGL examples and they seem ok.

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've committed worse sins

@cwfitzgerald cwfitzgerald merged commit be625f9 into gfx-rs:master Jun 7, 2022
@expenses
Copy link
Contributor

Just saw this! I've been dealing with trying to get index buffer to index buffer copies to work. I suppose you could implement that by mapping the source buffer memory and doing buffer_sub_data_u8_slice from that right? It'd be pretty (very?) slow, but would at least be implemented.

@expenses
Copy link
Contributor

Just saw this! I've been dealing with trying to get index buffer to index buffer copies to work. I suppose you could implement that by mapping the source buffer memory and doing buffer_sub_data_u8_slice from that right? It'd be pretty (very?) slow, but would at least be implemented.

Hmm, it seems I don't actually need to do this. NVM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants