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

Error when trying to create render 3d shapes in version 11.0 and 12.0-dev #9405

Open
paul-james-charles opened this issue Aug 10, 2023 · 8 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Linux Specific to the Linux desktop operating system O-OpenGL Specific to the OpenGL render API P-Crash A sudden unexpected crash S-Blocked This cannot move forward until something else changes

Comments

@paul-james-charles
Copy link

Bevy version

I have the same issue on both version 11.0 and 12-dev...This is an issue that did not appear on version 8.0 or 9.0

Relevant system information

See below

  • rustc 1.71.1 (eb26296b5 2023-08-03)
  • cargo 1.71.1 (7f1d04c00 2023-07-29)
  • OS: SystemInfo { os: "Linux 23.04 Ubuntu", kernel: "6.2.0-26-generic", cpu: "Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz", core_count: "4", memory: "19.5 GiB" }

2023-08-10T09:30:00.576695Z INFO bevy_render::renderer: AdapterInfo { name: "NVE4", vendor: 65541, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }

What you did

You can easily recreate the issue by running: -

cargo run --example "3d_shapes" --features wayland

What went wrong

Panic with the following error message

This is from build

commit e87d3cc

Error message

2023-08-10T09:30:00.786651Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-08-10T09:30:00.786835Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_ENUM in glTexStorage2DMultisample(target=GL_TEXTURE_2D)
2023-08-10T09:30:01.048552Z ERROR wgpu::backend::direct: Shader translation error for stage ShaderStages(FRAGMENT): gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias
2023-08-10T09:30:01.048598Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga
2023-08-10T09:30:01.048636Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (1)' 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/paul/.cargo/registry/src/index.crates.io-6f17d22bba15001f/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 (1)' panicked at 'called Result::unwrap() on an Err value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:143:45

@paul-james-charles paul-james-charles added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 10, 2023
@paul-james-charles
Copy link
Author

Note that this appears to break between 0.9.1 and 0.10.0

@nicopap
Copy link
Contributor

nicopap commented Aug 10, 2023

NVE4 is the "Kepler" series of NVIDIA GPUs. The Archlinux wiki has some interesting info: https://wiki.archlinux.org/title/NVIDIA (search for "kepler" keyword)

Kepler should support Vulkan, I'm not sure why wgpu is defaulting to GL. Can you run WGPU_BACKEND=vulkan cargo run to see if it changes anything?

Independently I'm fairly certain we have a GL issue. I can reproduce the error with WGPU_BACKEND=gl on my end.
Edit: #7320 tells the fix is to use the --features webgl2 with the gl backend (open gl), it does work. But regardless, you should prefer the vulkan backend as it has more features.

@nicopap nicopap added A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash O-Linux Specific to the Linux desktop operating system O-OpenGL Specific to the OpenGL render API and removed S-Needs-Triage This issue needs to be labelled labels Aug 10, 2023
@paul-james-charles
Copy link
Author

I will admit this is my first time giving something back to Open Source...But I have identified that the issue appeared on commit 5ee57ff.

It appears they changed the default backend for WgpuSettings from Backends::all() to Backends::PRIMARY.

The fix for 3d_shapes example is to add the following

    .add_plugins(DefaultPlugins
        .set(RenderPlugin { 
            wgpu_settings: WgpuSettings {
                backends: Some(Backends::PRIMARY),
                ..Default::default()
            } 
        })

However it may be worth looking if this default value should be changed back in the future...or technote added about the issue

@paul-james-charles
Copy link
Author

Also I agree that using WGPU_BACKEND=vulkan cargo run appears to fix the issue

@nicopap nicopap added the S-Blocked This cannot move forward until something else changes label Aug 10, 2023
@nicopap
Copy link
Contributor

nicopap commented Aug 10, 2023

This needs to be escalated to wgpu https://github.com/gfx-rs/wgpu. As far as I can tell, this is an issue with wgpu's feature detection and heuristic for choosing the backend. Do you see any supsicious warnings when running with WGPU_BACKEND=vulkan? Since you seem to be able to run vulkan, wgpu should have chosen it over open gl.

@paul-james-charles
Copy link
Author

No warnings when running with WGPU_BACKEND=vulkan. Just one note I am running the Ubuntu driver for the Nvidia card, as the nvidia native drivers do not work since upgrading Ubuntu to the latest does not work

@nicopap
Copy link
Contributor

nicopap commented Aug 11, 2023

The open source reverse-engineered NVIDIA nouveau drivers are notoriously broken. To the point people will tell you to use the proprietary nvidia drivers rather than try to fix your issue (because if you can't reproduce the bug with proprietary nvidia drivers, it means the bug is in the nouveau drivers). This may explain things. I'm surprised it's even capable of running a bevy app. It's actually impressive.

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 O-Linux Specific to the Linux desktop operating system O-OpenGL Specific to the OpenGL render API P-Crash A sudden unexpected crash S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

No branches or pull requests

2 participants