-
Hey there! I'm trying to see if I can get the GL backend working with Bevy. So far I've gotten Bevy compiling with WGPU master and the vulkan backend can run the Bevy PBR examples. When I run with the GL backend, though, I get an error:
I've traced the failure to this point in code: wgpu/wgpu-hal/src/gles/device.rs Lines 380 to 382 in e5142b3 It seems to be trying to create a buffer and getting a null pointer instead, at which point it concludes that the device has been lost. I was wondering whether it might be possible that the error is related to Bevy's multithreading. Looking around a little bit in the new GLES backend implementation it seems like there isn't anything stopping you from using In the older gfx GL backend we had this If that's the case, could we have the GL backend spawn a thread that it would use to completely manage the GL context and then make the Not sure if that makes sense or if I'm misunderstanding something or maybe this is another issue entirely. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi! You are correct, the GL backend currently assumes that the device, buffers, and the queue are used on one thread, at least one at a time. Do you have Your idea with a dedicated thread is worth considering. It's not clear, for example, how would a method like It's possible that EGL would be fine with us accessing the context from different threads at least as long as this access is externally synchronized. In this case, we'd add wrap the context in a Finally, the last way to proceed would be to just document the multi-threading restrictions on the GLES backend. Maybe even turn it into a downlevel feature?.. |
Beta Was this translation helpful? Give feedback.
Hi! You are correct, the GL backend currently assumes that the device, buffers, and the queue are used on one thread, at least one at a time.
Do you have
env_logger
hooked up? By default, we route GL's debug logging tolog
, so it would tell us what went wrong with buffer mapping that returned NULL.Your idea with a dedicated thread is worth considering. It's not clear, for example, how would a method like
create_texture
return a texture if the actual execution happens on another thread. Rolling out the full client-server ID management (like wgpu does in Gecko, for example), is a bit too heavy handed of a solution.It's possible that EGL would be fine with us accessing the context from dif…