bevy
bevy copied to clipboard
example compute_shader_game_of_life doesnt work with GL backend
Bevy version
0.10.0
[Optional] Relevant system information
INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.49, 6.2.2-arch1-1)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux Arch Linux", kernel: "6.2.2-arch1-1", cpu: "AMD Ryzen 7 5800U with Radeon Graphics", core_count: "8", memory: "15.0 GiB" }
What you did
Ran example without vulkan-radeon installed, so it used the GL backend as fallback.
What went wrong
ERROR wgpu_hal::gles::egl: GLES: [ShaderCompiler/Error] ID 2 : 0:9(1): error: image variables of format other than r32f, r32i or r32ui must be qualified `readonly' or `writeonly'
ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default thread 'Compute Task Pool (5)' panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_compute_pipeline
Internal error: 0:9(1): error: image variables of format other than r32f, r32i or r32ui must be qualified `readonly' or `writeonly
Additional information
I fixed the example by using two textures, one for write and one for read, and swapping which texture was used for in/out. I'm not sure a re-write of the example is warranted though since GL is still listed as unsupported in the docs: pub const GL: Backends = Self{ bits: 1 << Backend::Gl as u32,}
Currently unsupported
Even if the texture formats were supported, compute shaders are not supported on the GL backend, which the game_of_life example is built on. I don't think there's any way around this.
Agreed with James. I think this one has to get closed as Can't Fix, but we should note it in the example.
I'm going to trust you that it shouldn't work. But it really looks like it is working? (with my change)

Oh neat! Yes, that appears to be working. Can you PR your change?
It looks like they were added in a later OpenGL (4.3): https://www.khronos.org/opengl/wiki/Compute_Shader