Skip to content

fix: Lazily initialize Mesh in draw commands for webgl2 compat #1020

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

Merged
merged 1 commit into from
Mar 16, 2025

Conversation

mitchmindtree
Copy link
Member

@mitchmindtree mitchmindtree commented Mar 16, 2025

WebGL appears to have a requirement that initialised buffers must have a non-zero length (or something along these lines). This changes our draw logic to lazily initialise the mesh to work around this requirement.

Closes #998.

cc @tychedelia does this solution look OK?

WebGL appears to have a requirement that initialised buffers must have a
non-zero length (or something along these lines). This changes our draw
logic to lazily initialise the mesh to work around this requirement.
Copy link
Collaborator

@tychedelia tychedelia left a comment

Choose a reason for hiding this comment

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

Yes! This totally makes sense and is definitely the correct implementation with respect to this. The "mono mesh" is potentially a weird optimization but seemed to work pretty well. If we wanted in the future, it might make sense to optimize further by retaining vertex buffers, but in general these kinds of optimizations are really hard to do with the imperative drawing model as the order and number of draw commands can be totally arbitrary frame to frame. Tysm for tracking this down!

@tychedelia tychedelia merged commit 1112e75 into nannou-org:bevy-refactor Mar 16, 2025
14 checks passed
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.

2 participants