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: RequestDeviceError(RequestDeviceError) #1074

Open
xiaoshihou514 opened this issue Jul 27, 2022 · 6 comments
Open

Error: RequestDeviceError(RequestDeviceError) #1074

xiaoshihou514 opened this issue Jul 27, 2022 · 6 comments
Labels

Comments

@xiaoshihou514
Copy link

xiaoshihou514 commented Jul 27, 2022

Describe the bug
Hey guys sorry to bother, the issue is a duplicate of #1070.
Error: RequestDeviceError(RequestDeviceError)

To Reproduce

git clone https://github.com/ggez/ggez.git
cd ggez
git switch devel
cargo run --example 01_super_simple

Expected behavior
Example codes compiles.

Screenshots or pasted code
Before switching to devel branch:

Liebknecht@arch ~/P/r/E/ggez (master) [1]> cargo run --example 01_super_simple
    Finished dev [unoptimized + debuginfo] target(s) in 0.66s
     Running `target/debug/examples/01_super_simple`
Error: RenderError("failed to find suitable graphics adapter")

After switching to devel branch:

    Finished dev [unoptimized + debuginfo] target(s) in 1m 53s
    Running `target/debug/examples/01_super_simple`
Failed to initialize graphics, trying secondary backends.. Please mention this if you encounter any bugs!
Error: RequestDeviceError(RequestDeviceError)

Hardware and Software:

  • ggez version: release 0.7.0
  • OS: archlinux with kernel 5.18.14-zen1-1-zen
  • Graphics card: 3rd Gen Core processor Graphics Controller, GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M
  • Graphics card drivers:
Liebknecht@arch ~/P/r/E/ggez (devel)> yay -Qs driver
local/aic94xx-firmware 30-9
    Adaptec SAS 44300, 48300, 58300 Sequencer Firmware for AIC94xx driver
local/libraw1394 2.1.2-3
    Provides an API to the Linux IEEE1394 (FireWire) driver
local/mesa 22.1.3-1
    An open-source implementation of the OpenGL specification
local/ntfs-3g 2022.5.17-1
    NTFS filesystem driver and utilities
local/nvidia 515.57-9
    NVIDIA drivers for linux
local/nvidia-utils 515.57-1
    NVIDIA drivers utilities
local/vulkan-icd-loader 1.3.221-1
    Vulkan Installable Client Driver (ICD) Loader
local/wd719x-firmware 1-7
    Driver for Western Digital WD7193, WD7197 and WD7296 SCSI cards
local/xf86-input-libinput 1.2.1-1 (xorg-drivers)
    Generic input driver for the X.Org server based on libinput
local/xf86-video-vesa 2.5.0-3 (xorg-drivers xorg)
    X.org vesa video driver
local/xorg-xdriinfo 1.0.6-3 (xorg-apps xorg)
    Query configuration information of DRI drivers

Sorry if I'm dumb about anything. I'm probably switching to a windows environment to explore this engine before I know how to fix that :) Great work done by the dev team.

@nobbele
Copy link
Member

nobbele commented Jul 27, 2022

Edited to make it a bit easier to read. Thanks for reporting! I'll take a look at it when I have time

@nobbele
Copy link
Member

nobbele commented Jul 27, 2022

It's likely not using your dedicated GPU but for some reason it crashes with intel graphics too

@nobbele
Copy link
Member

nobbele commented Jul 27, 2022

Our limits might be set higher than needed.

..Default::default()

could you go to line 191 in src/graphics/context.rs and replace Default::default() with wgpu::Limits::downlevel_defaults() or wgpu::Limits::downlevel_webgl2_defaults()?

@nobbele nobbele added the bug label Jul 27, 2022
@xiaoshihou514
Copy link
Author

xiaoshihou514 commented Jul 29, 2022

Our limits might be set higher than needed.

..Default::default()

could you go to line 191 in src/graphics/context.rs and replace Default::default() with wgpu::Limits::downlevel_defaults() or wgpu::Limits::downlevel_webgl2_defaults()?

Changing that as follows:

limits: wgpu::Limits {
                    max_bind_groups: 5,
                    //..Default::default()
		    ..wgpu::Limits::downlevel_defaults()
                },

Output from using <cargo run --example 01_super_simple>:

    Finished dev [unoptimized + debuginfo] target(s) in 21.87s
     Running `target/debug/examples/01_super_simple`
Failed to initialize graphics, trying secondary backends.. Please mention this if you encounter any bugs!
Error: RequestDeviceError(RequestDeviceError)

Output from using wgpu::Limits::downlevel_webgl2_defaults():

    Finished dev [unoptimized + debuginfo] target(s) in 29.32s
     Running `target/debug/examples/01_super_simple`
Failed to initialize graphics, trying secondary backends.. Please mention this if you encounter any bugs!
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_bind_group_layout
    binding 0 entry is invalid
    Downlevel flags VERTEX_STORAGE are required but not supported on the device.
This is not an invalid use of WebGPU: the underlying API or device does not support enough features to be a fully compliant implementation. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to work around this issue, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.

', /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:2273:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I guess that's a rendering API issue? Nevertheless I'm going to post the output with the retracing flag to produce more debug info.

$ export RUST_BACKTRACE=1
$ cargo run --example 01_super_simple

Additinal output as follows:

stack backtrace:
   0: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   2: wgpu::backend::direct::default_error_handler
             at /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:2273:5
   3: core::ops::function::Fn::call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:77:5
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1886:9
   5: wgpu::backend::direct::ErrorSinkRaw::handle_error
             at /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:2259:17
   6: wgpu::backend::direct::Context::handle_error
             at /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:194:9
   7: <wgpu::backend::direct::Context as wgpu::Context>::device_create_bind_group_layout
             at /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:1099:13
   8: wgpu::Device::create_bind_group_layout
             at /home/Liebknecht/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/lib.rs:1794:17
   9: ggez::graphics::gpu::bind_group::BindGroupLayoutBuilder::create_uncached
             at ./src/graphics/gpu/bind_group.rs:67:13
  10: ggez::graphics::gpu::bind_group::BindGroupLayoutBuilder::create::{{closure}}
             at ./src/graphics/gpu/bind_group.rs:61:32
  11: std::collections::hash::map::Entry<K,V>::or_insert_with
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/collections/hash/map.rs:2386:43
  12: ggez::graphics::gpu::bind_group::BindGroupLayoutBuilder::create
             at ./src/graphics/gpu/bind_group.rs:58:9
  13: ggez::graphics::context::GraphicsContext::new_from_instance
             at ./src/graphics/context.rs:310:36
  14: ggez::graphics::context::GraphicsContext::new
             at ./src/graphics/context.rs:121:21
  15: ggez::context::Context::from_conf
             at ./src/context.rs:178:32
  16: ggez::context::ContextBuilder::build
             at ./src/context.rs:343:9
  17: _01_super_simple::main
             at ./examples/01_super_simple.rs:53:33
  18: core::ops::function::FnOnce::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

All that done using the devel branch ofc.
Again, thank you guys for your work and your time to maintain this project! That's why I love open source communities :P Also, I ran the example on my other windows laptop and it's fine, probably hardware issues (the arch laptop is pretty old as you can see).

@nobbele
Copy link
Member

nobbele commented Jul 29, 2022

downlevel_defaults might still be too high but downlevel_webgl2_defaults is too low. Gonna have to check more specific limits. Thanks for testing!

@xiaoshihou514
Copy link
Author

downlevel_defaults might still be too high but downlevel_webgl2_defaults is too low. Gonna have to check more specific limits. Thanks for testing!

Glad to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants