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

Add support for WebGL2 #7

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Add support for WebGL2 #7

merged 1 commit into from
Jun 10, 2024

Conversation

jgayfer
Copy link
Owner

@jgayfer jgayfer commented Jun 9, 2024

Summary

Pretty sure we're taking some shortcuts for supporting large numbers of point lights, but I believe this gets us to a point where we can run on WebGL2.

Closes #6.

@jgayfer
Copy link
Owner Author

jgayfer commented Jun 9, 2024

@tliron I think I've managed to get things going on WebGL2. Would love to hear if this is working for you!

@jgayfer jgayfer force-pushed the webgl2 branch 2 times, most recently from 8c970cc to d4943ce Compare June 9, 2024 05:00
@tliron
Copy link

tliron commented Jun 10, 2024

Hm, is it merged into main? Using this:

bevy_light_2d = { git = "https://github.com/jgayfer/bevy_light_2d", rev = "284bc5b" }

I get this error (Firefox on Linux):

panicked at /home/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.4/src/backend/wgpu_core.rs:3006:5:
wgpu error: Validation Error

Caused by:
    In Device::create_bind_group_layout
      note: label = `lighting_bind_group_layout`
    Too many bindings of type StorageBuffers in Stage ShaderStages(FRAGMENT), limit is 0, count was 1. Check the limit `max_storage_buffers_per_shader_stage` passed to `Adapter::request_device`

@tliron
Copy link

tliron commented Jun 10, 2024

Nevermind, didn't notice the branch name in the references on this issue. With the webgl2 branch it worked immediately. :) Great job!

I hope to contribute more to this project when I have some time from my other zillion Bevy crate drafts. :)

Adds limited support for wasm builds against WebGL2.

The max number of point lights is fixed at a modest amount of lights as
we're only using a single binding of a fixed length array, but we can
increase this if necessary with more uniform bindings.
@jgayfer jgayfer marked this pull request as ready for review June 10, 2024 04:51
@jgayfer
Copy link
Owner Author

jgayfer commented Jun 10, 2024

@tliron Great! Thank you for testing ♥️

I'm going to merge this into main, but it might not get a release until Bevy 0.14 lands? I'm still undecided!

I don't love the idea of sliding in another change to 0.2 of bevy_light_2d when I've already cut a release candidate.

@jgayfer jgayfer merged commit e054874 into main Jun 10, 2024
6 checks passed
@tliron
Copy link

tliron commented Jun 10, 2024

Your library is very young. I sincerely doubt anybody is clamoring to release a game with it very soon, so I humbly suggest not to worry too much and make the right decision for your peace of mind. As for little old me, I'm fine using the dev branch for now, letting you progress as you see fit.

I'll also be diving into the code. My hope is to have a lighting implementation that can be blockable by level terrain (inspired by the gorgeous effect in Animal Well), perhaps I can help make that happen.

@jgayfer jgayfer deleted the webgl2 branch August 6, 2024 03:30
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.

WebGL2 Support
2 participants