jgayfer / bevy_light_2d

General purpose 2D lighting for the Bevy game engine.
MIT License
128 stars 5 forks source link

Add support for WebGL2 #7

Closed jgayfer closed 2 months ago

jgayfer commented 2 months ago

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 commented 2 months ago

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

tliron commented 2 months ago

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 commented 2 months ago

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. :)

jgayfer commented 2 months ago

@tliron Great! Thank you for testing :hearts:

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.

tliron commented 2 months ago

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.