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

GL backend crashing #7320

Open
computermouth opened this issue Jan 21, 2023 · 7 comments
Open

GL backend crashing #7320

computermouth opened this issue Jan 21, 2023 · 7 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-OpenGL Specific to the OpenGL render API

Comments

@computermouth
Copy link

Bevy version

v0.9.1

[Optional] Relevant system information

Debian 11

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

rustc 1.65/1.67

What you did

WGPU_BACKEND=gl cargo run --example custom_skinned_mesh

I was trying to use the gl backend, as I'm encountering issue gfx-rs/naga#1908, with all examples in vulkan seemingly continuing to run in the background, after I close my x11 window with alt+f4.

What went wrong

2023-01-21T22:43:14.498423Z ERROR wgpu::backend::direct: Shader translation error for stage FRAGMENT: gsamplerCubeArrayShadow isn't supported in textureGrad, textureLod or texture with bias    
2023-01-21T22:43:14.498458Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga    
2023-01-21T22:43:14.498494Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'main' panicked at 'wgpu error: Validation Error

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

', /home/computermouth/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:2403:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/computermouth/projects/bevy/crates/bevy_tasks/src/task_pool.rs:273:45

The app crashes. I found this: gfx-rs/wgpu#4455, but it doesn't seem like there's really any action to be taken around it.

Based on people's comments it sounds like intel integrated graphics under x11 are problematic with both vulkan and gl.

@computermouth computermouth added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jan 21, 2023
@jakobhellermann jakobhellermann added the A-Rendering Drawing game state to the screen label Jan 21, 2023
@jakobhellermann
Copy link
Contributor

You're right that the root of this issue is gfx-rs/wgpu#4455, which is triggered by

return textureSampleCompareLevel(point_shadow_textures, point_shadow_textures_sampler, frag_ls, i32(light_id), depth);

As you can see this code isn't triggered if NO_ARRAY_TEXTURES_SUPPORT is set, so

WGPU_BACKEND=gl cargo run --example custom_skinned_mesh --features bevy_internal/webgl

or --target wasm-32-unknown-unknown should work.

Unfortunately this is not exposed in a way that can be set at runtime. But maybe we could fix that and enable NO_ARRAY_TEXTUERS_SUPPORT when running on the GL backend.

@jakobhellermann jakobhellermann removed the S-Needs-Triage This issue needs to be labelled label Jan 21, 2023
@computermouth
Copy link
Author

Enabling the webgl feature works on my machine. Though, I'm not exactly sure what the ramifications would be of enabling webgl for running on the desktop.

Curiously, it changes the color of the background from black (vulkan) to grey (gl). Maybe that's an intended consequence though. I'm not really a vulkan/gl/webgl person.

@jakobhellermann
Copy link
Contributor

Enabling the webgl feature works on my machine. Though, I'm not exactly sure what the ramifications would be of enabling webgl for running on the desktop.

The biggest change is using a Cube texture instead of a CubeArray texture, hence only supporting one shadow. The rest is lower defaults and higher alignment, and some hacks:
https://github.com/search?q=repo%3Abevyengine%2Fbevy+%22feature+%3D+%5C%22webgl%5C%22%22&type=code

@BartBM
Copy link

BartBM commented Feb 22, 2024

With issue #5171 fixed the error about the gsamplerCubeArrayShadow is gone now when using the GL backend.
I quickly compiled the latest version of wgpu and used it in some Bevy 3D examples but now the following error occurs:

2024-02-22T11:08:04.893241Z ERROR log: wgpu-hal heuristics assumed that the view dimension will be equal to `Cube` rather than `CubeArray`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`   

It does not crash but there is no coloring on the textures:
image

@SnowdenWintermute
Copy link

@BartBM any luck? I'm getting the same issue in Bevy 0.13.0.
2024-03-12-082414_2560x1600_scrot

My computer is Lenovo P1 Gen 5 with NVIDIA A2000 graphics card running Manjaro i3. Drivers are:

> 0000:01:00.0 (0300:10de:25ba) Display controller nVidia Corporation:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-intel-nvidia-prime            2023.03.23               false            PCI
video-hybrid-intel-nvidia-470xx-prime            2023.03.23               false            PCI
          video-nvidia            2023.03.23               false            PCI
    video-nvidia-470xx            2023.03.23               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI


> 0000:00:02.0 (0300:8086:46a6) Display controller Intel Corporation:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-intel-nvidia-prime            2023.03.23               false            PCI
video-hybrid-intel-nvidia-470xx-prime            2023.03.23               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI

@BartBM
Copy link

BartBM commented Mar 12, 2024

First of all, I have to force Wayland, otherwise I get an error citing 'Invalid surface'.
And yes, there is progress in bevy 0.14.0-dev with the WGPU OpenGL backend configured:

    DefaultPlugins
        .set(RenderPlugin {
            render_creation: RenderCreation::Automatic(WgpuSettings {
                backends: Some(Backends::GL),
                ..default()
            }),
            synchronous_pipeline_compilation: false,
        })
        .set(ImagePlugin::default_nearest()),
)

image
But the console still explodes with these errors at each frame:

2024-03-12T20:34:41.252729Z ERROR log: wgpu-hal heuristics assumed that the view dimension will be equal to `D2` rather than `D2Array`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray` 

The lighting is not how it should be:
image

@SnowdenWintermute
Copy link

SnowdenWintermute commented Mar 14, 2024

2024-03-14-144323_2560x1600_scrot

I get that error when running the examples in 0.13.0 but my lighting looks correct. I think it might have to do with my graphics drivers not working on Manjaro since it is an intel/nvidia laptop with the Prime/optimus switchable graphics technology. I installed with proprietary drivers. I tried running the examples with prime-run and without, both of which give the same result.

EDIT:
I finally got my graphics drivers working and now I no longer get the error messages. The problem was my kernel was out of date so the proprietary Nvidia drivers would not install. Updated the kernel and now it works well.

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-OpenGL Specific to the OpenGL render API
Projects
None yet
Development

No branches or pull requests

5 participants