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

[Example] compute_shader_game_of_life crashes. #9670

Closed
So1aric opened this issue Sep 2, 2023 · 5 comments · Fixed by #12155
Closed

[Example] compute_shader_game_of_life crashes. #9670

So1aric opened this issue Sep 2, 2023 · 5 comments · Fixed by #12155
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples O-Linux Specific to the Linux desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@So1aric
Copy link

So1aric commented Sep 2, 2023

Bevy version

0.11.2

[Optional] Relevant system information

Rust: 1.70.0
OS: Arch Linux

AdapterInfo { name: "Mesa Intel(R) UHD Graphics 630 (CML GT2)", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }

What you did

cargo run --features wayland --features dynamic_linking --example compute_shader_game_of_life

What went wrong

It crashed:

2023-09-02T13:14:00.305416Z ERROR wgpu_hal::gles::egl: GLES: [ShaderCompiler/Error] ID 1 : 0:9(1): error: image variables of format other than r32f, r32i or r32ui must be qualified `readonly' or `writeonly'
2023-09-02T13:14:00.306334Z 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'


', /home/so1aric/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2/wgpu-0.16.3/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'Compute Task Pool (5)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:143:45
warning: queue 0x55e43da78ed0 destroyed while proxies still attached:
  xdg_wm_base@23 still attached
  wl_output@15 still attached
  wp_fractional_scale_manager_v1@14 still attached
  xdg_activation_v1@13 still attached
  zwp_text_input_manager_v3@12 still attached
  zwp_relative_pointer_manager_v1@11 still attached
  zwp_pointer_constraints_v1@10 still attached
  zxdg_decoration_manager_v1@9 still attached
  wl_seat@8 still attached
  wp_viewporter@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_shm@4 still attached
  wl_registry@2 still attached
@So1aric So1aric added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 2, 2023
@So1aric
Copy link
Author

So1aric commented Sep 2, 2023

2023-09-02T13:22:43.389053Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2023-09-02T13:22:44.395480Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 1 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-09-02T13:22:44.395642Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 1 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-09-02T13:22:44.623244Z ERROR wgpu::backend::direct: Shader translation error for stage ShaderStages(FRAGMENT): gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias
2023-09-02T13:22:44.623279Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga
2023-09-02T13:22:44.623307Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in ShaderStages(FRAGMENT) shader: gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias

', /home/so1aric/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2/wgpu-0.16.3/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'Compute Task Pool (3)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:143:45
warning: queue 0x55730ad944d0 destroyed while proxies still attached:
  xdg_wm_base@23 still attached
  wl_output@15 still attached
  wp_fractional_scale_manager_v1@14 still attached
  xdg_activation_v1@13 still attached
  zwp_text_input_manager_v3@12 still attached
  zwp_relative_pointer_manager_v1@11 still attached
  zwp_pointer_constraints_v1@10 still attached
  zxdg_decoration_manager_v1@9 still attached
  wl_seat@8 still attached
  wp_viewporter@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_shm@4 still attached
  wl_registry@2 still attached

Another example also crashes. I suspect it's my computer's fault😂

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples O-Linux Specific to the Linux desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Sep 4, 2023
@YegorStolyarov
Copy link

YegorStolyarov commented Sep 8, 2023

Example works fine on my system. Got 1 error but program continued running.

 ERROR sctk_adwaita::config: XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme    
2023-09-08T10:51:07.750294Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) UHD Graphics 770 (ADL-S GT1)", vendor: 32902, device: 18048, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.0.4-0ubuntu1~22.04.1", backend: Vulkan }

@s-puig
Copy link
Contributor

s-puig commented Oct 7, 2023

Not particularly knowledgeable about this (someone who knows correct me), but from what i could gather this is reproducible by just forcing GL backend WGPU_BACKEND=opengl cargo run --features wayland --example compute_shader_game_of_life. Someone confirm this error is not Linux-only.

The issue seems to be that GLSL requires textures formats to specify writeonly or readonly unless they are r32* (unsure if said formats still allow both operations though) and the shader has to write and read.

I tried changing the example to r32* but sprite pipeline seems to expect rgba8 format(?).
I guess the alternatives are either use 2 textures to avoid the readwrite requirement or put a warning on the example that GL backend is not supported.

@s-puig
Copy link
Contributor

s-puig commented Oct 7, 2023

On an unrelated issue, running any example on X11 and GL seems to be broken with a different error (invalid surface validation). I will create an issue once i get a bit more info.

@s-puig
Copy link
Contributor

s-puig commented Oct 7, 2023

2023-09-02T13:22:43.389053Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2023-09-02T13:22:44.395480Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 1 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-09-02T13:22:44.395642Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 1 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-09-02T13:22:44.623244Z ERROR wgpu::backend::direct: Shader translation error for stage ShaderStages(FRAGMENT): gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias
2023-09-02T13:22:44.623279Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga
2023-09-02T13:22:44.623307Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in ShaderStages(FRAGMENT) shader: gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias

', /home/so1aric/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2/wgpu-0.16.3/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'Compute Task Pool (3)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:143:45
warning: queue 0x55730ad944d0 destroyed while proxies still attached:
  xdg_wm_base@23 still attached
  wl_output@15 still attached
  wp_fractional_scale_manager_v1@14 still attached
  xdg_activation_v1@13 still attached
  zwp_text_input_manager_v3@12 still attached
  zwp_relative_pointer_manager_v1@11 still attached
  zwp_pointer_constraints_v1@10 still attached
  zxdg_decoration_manager_v1@9 still attached
  wl_seat@8 still attached
  wp_viewporter@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_shm@4 still attached
  wl_registry@2 still attached

Another example also crashes. I suspect it's my computer's fault😂

I believe this is related to #7320

github-merge-queue bot pushed a commit that referenced this issue Feb 27, 2024
…rm (#12155)

# Objective

- Fixes #9670 
- Avoid a crash in CI due to
```
thread 'Compute Task Pool (0)' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/backend/wgpu_core.rs:3009:5:
wgpu error: Validation Error

Caused by:
    In Device::create_bind_group
    The adapter does not support read access for storages texture of format Rgba8Unorm
```

## Solution

- Use an `R32Float` texture instead of an `Rgba8Unorm` as it's a tier 1
texture format gpuweb/gpuweb#3838 and is more
supported
- This should also improve support for webgpu in the next wgpu version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples O-Linux Specific to the Linux desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants