Open edap opened 1 year ago
Some additional infos. On my laptop, I have also an integrated AMD renoir graphics card. If I switch to that graphics card and I restart the laptop, the example simple-triangle
is working.
Also, I can run the glutin example (https://github.com/rust-windowing/glutin/ (cargo run --example window)) with both graphics cards, the nvidia and the integrated AMD.
Thanks for the report! I have a few follow-up questions that should help debug this further:
RUST_LOG=INFO
to see which adapter gets picked?Hello, thanks for your reply. On pop_os, it is possible to select the graphics card from the battery menu. . When I select "integrated graphics", the example works. The example does not work ONLY when I select "Nvidia Graphics" and I restart, as I did to test your suggestions.
egl_device
gives me back the selected graphics card and it looks correctDevice 0: Name: NVIDIA GeForce RTX 2060 with Max-Q Design Vendor: NVIDIA
Device 1: Name: UNKNOWN Vendor: UNKNOWN
Device 2: Name: UNKNOWN Vendor: UNKNOWN
Device 3: Name: UNKNOWN Vendor: UNKNOWN
Picked a config with 8 samples
Running on NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
OpenGL Version 3.3.0 NVIDIA 525.85.05
Shaders version on 3.30 NVIDIA via Cg compiler
Output rendered to: /home/dapx/Sources/rust/glutin/target/debug/build/glutin_examples-c47eefafb2352396/out/egl_device.png
I am not using an external monitor
I do not know how the GPUs are wired internally. My laptop is Asus Rog Zephyrus G14 GA401IV-HE003. As far as I know this model does not have a MUX, as it was introduced in 2022 and my model is from 2021.
This is the output of the command RUST_LOG=INFO cargo run --example hello-triangle
:
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running `target/debug/examples/hello-triangle`
[2023-03-07T10:59:11Z INFO wgpu_hal::vulkan::instance] Unable to find extension: VK_EXT_swapchain_colorspace
[2023-03-07T10:59:11Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-03-07T10:59:11Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-03-07T10:59:11Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Display vendor "NVIDIA", version (1, 5)
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-03-07T10:59:11Z WARN wgpu_hal::gles::egl] No config found!
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] Trying presentation
[2023-03-07T10:59:11Z WARN wgpu_hal::gles::egl] EGL says it can present to the window but not natively
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] EGL context: +robust access
[2023-03-07T10:59:11Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::adapter] Vendor: NVIDIA Corporation
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::adapter] Renderer: NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 NVIDIA 525.85.05
[2023-03-07T10:59:12Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-03-07T10:59:12Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 22.3.4", backend: Vulkan }
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_khronos_validation.so
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x557b93b17bb0, name: ?)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x557b93b17bb0, name: ?)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_MESA_device_select.so
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x557b93b17bb0, name: ?)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x557b93b17bb0, name: ?)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] VALIDATION [UNASSIGNED-cache-file-error (0xf0bb3995)]
Validation Information: [ UNASSIGNED-cache-file-error ] Object 0: handle = 0x557b9483ab10, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf0bb3995 | Cannot open shader validation cache at //tmp//shader_validation_cache-1000.bin for reading (it may not exist yet)
[2023-03-07T10:59:12Z INFO wgpu_hal::vulkan::instance] objects: (type: DEVICE, hndl: 0x557b9483ab10, name: ?)
[2023-03-07T10:59:12Z INFO wgpu_core::device] Created render pipeline Valid((0, 1, Vulkan)) with RenderPipelineDescriptor { label: None, layout: Some((0, 1, Vulkan)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "vs_main" }, buffers: [] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Bgra8UnormSrgb, blend: None, write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
[2023-03-07T10:59:12Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-07T10:59:12Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-07T10:59:12Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-07T10:59:12Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-07T10:59:12Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-07T10:59:12Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
thread 'main' panicked at 'Failed to focus input context: XError { description: "BadMatch (invalid parameter attributes)", error_code: 8, request_code: 149, minor_code: 4 }', /home/dapx/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/event_processor.rs:912:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2023-03-07T11:02:46Z INFO wgpu_core::hub] Dropping Global
[2023-03-07T11:02:46Z INFO wgpu_core::device] Destroying 0 command encoders
Thanks for the details!
It's worth noting that you are now getting a different error "BadMatch (invalid parameter attributes)" instead of the original "BadDrawable (invalid Pixmap or Window parameter)". Did you change anything?
It seems we are trying to use the iGPU (and the dGPU is not available?). Even though you selected "NVIDIA Graphics", the iGPU might still get exposed since it's still needed to copy the frames from the dGPU since the laptop screen is most likely connected to the iGPU.
Could you try running the example again with WGPU_POWER_PREF=high
and RUST_LOG=INFO
?
Could you try the "Hybrid Graphics" setting in the pop-os menu and try running the example with and without __NV_PRIME_RENDER_OFFLOAD=1
(see this link for details)?
I did not notice that the error message has changed in the meantime. I did run an update in my OS, that may be the cause.
This is the output of WGPU_POWER_PREF=high RUST_LOG=INFO cargo run --example hello-triangle
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running `target/debug/examples/hello-triangle`
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] Unable to find extension: VK_EXT_swapchain_colorspace
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Display vendor "NVIDIA", version (1, 5)
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-03-08T09:49:55Z WARN wgpu_hal::gles::egl] No config found!
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Trying presentation
[2023-03-08T09:49:55Z WARN wgpu_hal::gles::egl] EGL says it can present to the window but not natively
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] EGL context: +robust access
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::adapter] Vendor: NVIDIA Corporation
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::adapter] Renderer: NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 NVIDIA 525.85.05
[2023-03-08T09:49:55Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-03-08T09:49:55Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 22.3.5", backend: Vulkan }
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_khronos_validation.so
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55c3a91a3a10, name: ?)
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55c3a91a3a10, name: ?)
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_MESA_device_select.so
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55c3a91a3a10, name: ?)
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
[2023-03-08T09:49:55Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55c3a91a3a10, name: ?)
[2023-03-08T09:49:55Z INFO wgpu_core::device] Created render pipeline Valid((0, 1, Vulkan)) with RenderPipelineDescriptor { label: None, layout: Some((0, 1, Vulkan)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "vs_main" }, buffers: [] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Bgra8UnormSrgb, blend: None, write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
[2023-03-08T09:49:55Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-08T09:49:55Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-03-08T09:49:55Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
thread 'main' panicked at 'Failed to focus input context: XError { description: "BadMatch (invalid parameter attributes)", error_code: 8, request_code: 149, minor_code: 4 }', /home/dapx/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/event_processor.rs:912:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2023-03-08T09:49:55Z INFO wgpu_core::hub] Dropping Global
[2023-03-08T09:49:55Z INFO wgpu_core::device] Destroying 0 command encoders
I have then selected "hybrid mode" from the menu' and I have restarted the laptop. This is the output of : __NV_PRIME_RENDER_OFFLOAD=1 WGPU_POWER_PREF=high RUST_LOG=INFO cargo run --example hello-triangle
, that shows the triangle.
Running `target/debug/examples/hello-triangle`
[2023-03-08T09:57:33Z INFO wgpu_hal::vulkan::instance] Unable to find extension: VK_EXT_swapchain_colorspace
[2023-03-08T09:57:33Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-03-08T09:57:33Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-03-08T09:57:33Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Display vendor "NVIDIA", version (1, 5)
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-03-08T09:57:33Z WARN wgpu_hal::gles::egl] No config found!
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] Trying presentation
[2023-03-08T09:57:33Z WARN wgpu_hal::gles::egl] EGL says it can present to the window but not natively
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] EGL context: +robust access
[2023-03-08T09:57:33Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::adapter] Vendor: NVIDIA Corporation
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::adapter] Renderer: NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 NVIDIA 525.85.05
[2023-03-08T09:57:34Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-03-08T09:57:34Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 22.3.5", backend: Vulkan }
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_khronos_validation.so
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_MESA_device_select.so
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libGLX_nvidia.so.0
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_NV_optimus (libGLX_nvidia.so.0)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] VALIDATION [UNASSIGNED-cache-file-error (0xf0bb3995)]
Validation Information: [ UNASSIGNED-cache-file-error ] Object 0: handle = 0x564072f65a70, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf0bb3995 | Cannot open shader validation cache at //tmp//shader_validation_cache-1000.bin for reading (it may not exist yet)
[2023-03-08T09:57:34Z INFO wgpu_hal::vulkan::instance] objects: (type: DEVICE, hndl: 0x564072f65a70, name: ?)
[2023-03-08T09:57:34Z INFO wgpu_core::device] Created render pipeline Valid((0, 1, Vulkan)) with RenderPipelineDescriptor { label: None, layout: Some((0, 1, Vulkan)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "vs_main" }, buffers: [] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Bgra8UnormSrgb, blend: None, write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
[2023-03-08T09:57:34Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T09:57:34Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T09:57:50Z INFO wgpu_core::hub] Dropping Global
[2023-03-08T09:57:50Z INFO wgpu_core::device] Destroying 1 command encoders
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Unloading layer library libGLX_nvidia.so.0
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Unloading layer library libVkLayer_MESA_device_select.so
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Unloading layer library libVkLayer_khronos_validation.so
[2023-03-08T09:57:50Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x564072573e80, name: ?)
This is the output of WGPU_POWER_PREF=high RUST_LOG=INFO cargo run --example hello-triangle
, that also shows the triangle:
Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/examples/hello-triangle`
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] Unable to find extension: VK_EXT_swapchain_colorspace
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Display vendor "Mesa Project", version (1, 5)
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] EGL context: +robust access EXT
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::adapter] Vendor: AMD
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::adapter] Renderer: RENOIR (renoir, LLVM 15.0.6, DRM 3.49, 6.2.0-76060200-generic)
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 Mesa 22.3.5
[2023-03-08T10:01:18Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-03-08T10:01:18Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 22.3.5", backend: Vulkan }
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_khronos_validation.so
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_MESA_device_select.so
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
[2023-03-08T10:01:18Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
[2023-03-08T10:01:18Z INFO wgpu_core::device] Created render pipeline Valid((0, 1, Vulkan)) with RenderPipelineDescriptor { label: None, layout: Some((0, 1, Vulkan)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "vs_main" }, buffers: [] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Bgra8UnormSrgb, blend: None, write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
[2023-03-08T10:01:18Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T10:01:18Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] }
[2023-03-08T10:01:21Z INFO wgpu_core::hub] Dropping Global
[2023-03-08T10:01:21Z INFO wgpu_core::device] Destroying 1 command encoders
[2023-03-08T10:01:21Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Unloading layer library libVkLayer_MESA_device_select.so
[2023-03-08T10:01:21Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
[2023-03-08T10:01:21Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Unloading layer library libVkLayer_khronos_validation.so
[2023-03-08T10:01:21Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x5638a79bd3b0, name: ?)
Thanks for your time, let me know if there is something else I can do to help you debugging this issue.
Considering this works if you set it to "Hybrid Graphics", I think this might be an issue with the pop-os configuration; I don't think you should be able to select the "Nvidia Graphics" since your laptop's screen is connected to the iGPU which is needed for presentation.
I'm not sure how/why vkcube works though.
Could you post the output of wgpu-info
for all 3 graphics settings (integrated/nvidia/hybrid)? I wonder which devices/drivers pop-os is exposing.
Yes it might be an issue with pop-os, but this would not explain why the glutin example and the vkcube example pick the correct graphics card.
Here the 3 outputs: hybrid.txt integrated.txt nvidia.txt
Looks like the Vulkan adapters exposed are the same for the hybrid and nvidia settings.
I'm out of ideas for now. @cwfitzgerald do you know what might be going on?
@teoxoy maybe it makes sense to change the title from BadDrawable to BadMatch? just inc ase other users have the same problem.
I ran into the same BadMatch
error. Seems related to https://github.com/rust-windowing/winit/issues/748
Setting the driver explicitly did work for me, as described in https://github.com/rust-windowing/winit/issues/748#issuecomment-830817035
My system runs nvidia with optimus-manager
Just to add another data point: I am running into the same issue. I have a CPU with integrated GPU and a dedicated GPU. The desktop is running on the dedicated one, but wgpu chose the integrated GPU, which is the cause of the problem.
For me the error happens when calling winit::Window::inner_size
, actually. It eventually calls winit::platform_impl::platform::x11::window::UnownedWindow::inner_size_physical
which then incorrectly calls unwrap
.
I'm using wgpu::PowerPreference::default()
which defaults to the low power GPU. Even with WGPU_POWER_PREF=high
, the integrated GPU was chosen. With wgpu::PowerPreference::HighPerformance
, the dedicated one was chosen and everything works.
In my RequestAdapterOptions
I'm also of course specifying compatible_surface
. So my guess is that the "adapter choosing" code does not correctly check compatible_surface
because the integrated GPU should be incompatible with the surface I passed.
Hi there,
Has there been an update on this? My desktop has both an Nvidia card and an integrated graphics (Intel), but I only use the former. When running the cube
example, it seems that wgpu uses the Intel integrated graphics instead of nvidia, and then fails.
[2023-09-26T22:02:47Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadDrawable (invalid Pixmap or Window parameter)",
error_code: 9,
request_code: 149,
minor_code: 4,
}
The error above is repeated endlessly.
The compatible surface checks do seem to be wired up correctly in request_adapter all the way down to the vulkan backend, not sure why it's not returning that it's incompatible if it is truly incompatible.
At the moment this is a big problem for everyone on linux with a dedicated card and integrated card. I do not know if this can be of any help, but following @ibaryshnikov advice I have specified the power prefecences and it works, here a short summary:
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface),
force_fallback_adapter: false,
})
.await
.unwrap();
The triangle example works, and it is using, correctly, the dedicated graphics card. This is the output of WGPU_POWER_PREF=high RUST_LOG=INFO cargo run --example hello-triangle
[2023-10-05T07:07:10Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1
[2023-10-05T07:07:14Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-10-05T07:07:14Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-10-05T07:07:14Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Display vendor "Mesa Project", version (1, 5)
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] EGL context: +robust access EXT
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::adapter] Vendor: AMD
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::adapter] Renderer: RENOIR (renoir, LLVM 15.0.7, DRM 3.52, 6.4.6-76060406-generic)
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 Mesa 23.1.3-1pop0~1689084530~22.04~0618746
[2023-10-05T07:07:14Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-10-05T07:07:14Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 23.1.3-1pop0~1689084530~22.04~0618746", backend: Vulkan }
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::default(),
compatible_surface: Some(&surface),
force_fallback_adapter: false,
})
.await
.unwrap();
it works.
Now, If I select from the OS menu the Nvidia Graphics Card and I do restart the laptop, and I try the same example with WGPU_POWER_PREF=high RUST_LOG=INFO cargo run --example hello-triangle
, it crashes.
[2023-10-05T07:18:59Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Display vendor "NVIDIA", version (1, 5)
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-10-05T07:18:59Z WARN wgpu_hal::gles::egl] No config found!
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Trying presentation
[2023-10-05T07:18:59Z WARN wgpu_hal::gles::egl] EGL says it can present to the window but not natively
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] EGL context: +robust access
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::adapter] Vendor: NVIDIA Corporation
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::adapter] Renderer: NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 NVIDIA 535.104.05
[2023-10-05T07:18:59Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-10-05T07:18:59Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Unknown (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 23.1.3-1pop0~1689084530~22.04~0618746", backend: Vulkan }
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_khronos_validation.so
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55aa35be23d0, name: ?)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55aa35be23d0, name: ?)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Loading layer library libVkLayer_MESA_device_select.so
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55aa35be23d0, name: ?)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)]
Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] objects: (type: INSTANCE, hndl: 0x55aa35be23d0, name: ?)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] VALIDATION [UNASSIGNED-cache-file-error (0xf0bb3995)]
Validation Information: [ UNASSIGNED-cache-file-error ] Object 0: handle = 0x55aa36907cd0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf0bb3995 | Cannot open shader validation cache at //tmp//shader_validation_cache-1000.bin for reading (it may not exist yet)
[2023-10-05T07:18:59Z INFO wgpu_hal::vulkan::instance] objects: (type: DEVICE, hndl: 0x55aa36907cd0, name: ?)
[2023-10-05T07:18:59Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Auto, view_formats: [] }
[2023-10-05T07:18:59Z INFO wgpu_core::device] Automatically choosing alpha mode by rule Auto. Chose Opaque
[2023-10-05T07:18:59Z INFO wgpu_core::device] Created render pipeline Valid((0, 1, Vulkan)) with RenderPipelineDescriptor { label: Some("Render Pipeline"), layout: Some((0, 1, Vulkan)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "vs_main" }, buffers: [VertexBufferLayout { array_stride: 24, step_mode: Vertex, attributes: [VertexAttribute { format: Float32x3, offset: 0, shader_location: 0 }, VertexAttribute { format: Float32x3, offset: 12, shader_location: 1 }] }] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: Some(Back), unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Vulkan), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Bgra8UnormSrgb, blend: Some(BlendState { color: BlendComponent { src_factor: One, dst_factor: Zero, operation: Add }, alpha: BlendComponent { src_factor: One, dst_factor: Zero, operation: Add } }), write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
[2023-10-05T07:18:59Z INFO wgpu_core::device] Created buffer Valid((0, 1, Vulkan)) with BufferDescriptor { label: Some("Vertex Buffer"), size: 72, usage: VERTEX, mapped_at_creation: true }
[2023-10-05T07:18:59Z INFO wgpu_core::device] Created buffer Valid((1, 1, Vulkan)) with BufferDescriptor { label: Some("Index Buffer"), size: 8, usage: INDEX, mapped_at_creation: true }
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-10-05T07:18:59Z INFO wgpu_core::device] configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Bgra8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Auto, view_formats: [] }
[2023-10-05T07:18:59Z INFO wgpu_core::device] Automatically choosing alpha mode by rule Auto. Chose Opaque
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
thread 'main' panicked at 'Failed to focus input context: XError { description: "BadMatch (invalid parameter attributes)", error_code: 8, request_code: 149, minor_code: 4 }', /home/dapx/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/event_processor.rs:912:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2023-10-05T07:18:59Z INFO wgpu_core::hub] Dropping Global
[2023-10-05T07:18:59Z INFO wgpu_core::device] Destroying 0 command encoders
But if when I create the adapter I specify to use the high performance power options power_preference: wgpu::PowerPreference::HighPerformance,
, it works.
[2023-10-05T07:22:36Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1
[2023-10-05T07:22:36Z INFO wgpu_hal::vulkan::instance] Instance version: 0x4030cc
[2023-10-05T07:22:36Z INFO wgpu_hal::vulkan::instance] Enabling debug utils
[2023-10-05T07:22:36Z INFO wgpu_hal::vulkan::instance] Enabling device properties2
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Loading Wayland library to get the current display
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Loading X11 library to get the current display
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Using X11 platform
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Enabling EGL debug output
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Display vendor "NVIDIA", version (1, 5)
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] EGL surface: +srgb
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Trying native-render
[2023-10-05T07:22:36Z WARN wgpu_hal::gles::egl] No config found!
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Trying presentation
[2023-10-05T07:22:36Z WARN wgpu_hal::gles::egl] EGL says it can present to the window but not natively
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] EGL context: +debug
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] EGL context: +robust access
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] EGL context: +surfaceless
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Max label length: 256
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::egl] Enabling GLES debug output
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::adapter] Vendor: NVIDIA Corporation
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::adapter] Renderer: NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::adapter] Version: OpenGL ES 3.2 NVIDIA 535.104.05
[2023-10-05T07:22:36Z INFO wgpu_hal::gles::adapter] SL version: OpenGL ES GLSL ES 3.20
[2023-10-05T07:22:36Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "NVIDIA GeForce RTX 2060 with Max-Q Design", vendor: 4318, device: 7954, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.104.05", backend: Vulkan }
So, for my understanding, something is wrong with how the option power_preference
is handled in the creation of the adapter.
But, out of curiosity, I have tried the triangle example in the ash crate. And with the Nvidia Graphics Card selected in the OS it crashes.
INFO:
GENERAL [Loader Message (0)] : Loading layer library libVkLayer_khronos_validation.so
INFO:
GENERAL [Loader Message (0)] : Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
INFO:
GENERAL [Loader Message (0)] : Loading layer library libVkLayer_MESA_device_select.so
INFO:
GENERAL [Loader Message (0)] : Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ERROR_SURFACE_LOST_KHR', examples/src/bin/triangle.rs:436:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ERROR:
VALIDATION [VUID-vkDestroyDevice-device-00378 (1901072314)] : Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x55fffe934930, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0x1e000000001e, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x55fffe934930[], VkBuffer 0x1e000000001e[] has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkDestroyDevice-device-00378)
But if I switch to the integrated graphics card and restart the laptop, it works.
INFO:
GENERAL [Loader Message (0)] : Loading layer library libVkLayer_khronos_validation.so
INFO:
GENERAL [Loader Message (0)] : Inserted device layer VK_LAYER_KHRONOS_validation (libVkLayer_khronos_validation.so)
INFO:
GENERAL [Loader Message (0)] : Loading layer library libVkLayer_MESA_device_select.so
INFO:
GENERAL [Loader Message (0)] : Failed to find vkGetDeviceProcAddr in layer libVkLayer_MESA_device_select.so
INFO:
VALIDATION [UNASSIGNED-cache-file-error (-256165483)] : Validation Information: [ UNASSIGNED-cache-file-error ] Object 0: handle = 0x55fd7f7b4830, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf0bb3995 | Cannot open shader validation cache at //tmp//shader_validation_cache-1000.bin for reading (it may not exist yet)
So, maybe it is an ash bug? could you @ibaryshnikov @ChristopherRabotin @LukasKalbertodt try to run the ash triangle example with your integrated graphics card and with your dedicated graphics card?
Ash is a dependency of wgpu-hal that is a dependency of wgpu
│ ├── wgpu-hal v0.15.1 (/home/dapx/Sources/rust/wgpu/wgpu-hal)
│ │ ├── arrayvec v0.7.2
│ │ ├── ash v0.37.2+1.3.238
Sorry for the late reply. I tested the triangle example of ash, like @edap asked me to. But it worked for me. But keep reading.
I dug a bit deeper. And I think I found the cause(s) of this.
Reminder of my setup: one dedicated GPU (which runs the desktop) and an integrated one. Running wgpu's unmodified hello-triangle
example crashes with BadDrawable
because the integrated GPU was chosen for some reason (which can't present to the surface).
After some debugging, I found that get_physical_device_surface_support
returns Ok(true)
for (integrated GPU, surface). But that's clearly wrong as the GPU cannot present to that surface. This is the relevant code:
You might notice the suspicious // TODO
in the first line. And I think that's one of the problems! Support for a given surface is a function of the surface, the adapter AND a queue family. It might be the case that there are queue families without graphics support (just copy queues, for example) that support the surface. What ash
does in its examples to find a suitable adapter is this:
Iterate over all queue families and take the first one that supports graphics AND the surface. I added some debug output to that code to print some information about my system:
The most interesting part here is that the integrated GPU says in both cases that the surface is supported! Uh oh.
In fact, if I insert a single pdevices.reverse()
before the ash example code linked above, that example crashes as well! With the same error as @dap. It just worked before because the correct (dedicated GPU) is listed first, by chance.
ash
's implementation of get_physical_device_surface_support
is very simple though:
It just calls a function pointer! And I assume that's provided by the system? So... is this just a driver or OS bug?
So in summary:
wgpu has the // TODO
bug because it does not properly iterate through all queue families. That can lead to false positives and false negatives (compare my queue debug output above).
The get_physical_device_surface_support_khr
function pointer (called by ash
) returns true
if asked about my integrated GPU and surface, which is incorrect.
Thank you for the detailed investigation!
- wgpu has the
// TODO
bug because it does not properly iterate through all queue families. That can lead to false positives and false negatives (compare my queue debug output above).
I think the TODO
is actually https://github.com/gfx-rs/wgpu/issues/1066 since we currently only use one (the first) queue.
- The
get_physical_device_surface_support_khr
function pointer (called byash
) returnstrue
if asked about my integrated GPU and surface, which is incorrect.
ash
is a thin rust wrapper for the Vulkan API. vkGetPhysicalDeviceSurfaceSupportKHR
is right here. If it returns true
and it shouldn't that's probably the fault of the driver or system.
Can you give us more info about your system? What is the OS? What is the iGPU and it's driver (+ version)?
It would be good to also look online for similar issues.
Can you give us more info about your system? What is the OS? What is the iGPU and it's driver (+ version)?
Linux 6.1.55-1-MANJARO
amdgpu
kernel driver, driver version as reported by vulkaninfo
: 23.1.9
535.113.01
I'd be curious to know if a buggy vkGetPhysicalDeviceSurfaceSupportKHR
is also the root problem for everyone else in this thread experiencing this problem.
I've been facing the same error output, but the route cause turned out to be different. As others here, I have Intel iGPU and NVidia dGPU, and use High Performance Mode.At some point without any changes to the system or dependencies my project started to fail with the same errors as the others saw:
[2023-10-05T07:18:59Z ERROR winit::platform_impl::platform] X11 error: XError {
description: "BadMatch (invalid parameter attributes)",
error_code: 8,
request_code: 149,
minor_code: 4,
}
The cause for this, sure enough, was that iGPU adapter was selected. Now, the difference start with me trying setting wgpu::PowerPreference::HighPerformance
. In my case this didn't help though. After some debugging, I found out that Instance::enumrate_adapters()
returned only iGPU and CPU in the list, no dGPU to be found.
This gave me hint for solution. Restarting my OS fixed the problem, dGPU is back in the list, and everything works as expected. I have noticed before that sometimes after OS sleep by system becomes slower, so I guess I have found the reason why.
I understand that in my case the issue is not in wgpu, but though I'd write my case here in case anyone else stumbles on a similar case. Although, I wonder, if dGPU is not in the list, shouldn't all systems use iGPU and everything should match?..
Description The example with the triangle crashes.
Repro steps If I run
RUST_BACKTRACE=1 cargo run --example hello-triangle
I have this error.Platform Information about your OS, version of
wgpu
, your tech stack, etc.I am using webgpu 0.15.0, I have just cloned the repo.
My
uname -r -a
output is:Linux pop-os 6.1.11-76060111-generic #202302091138~1675975749~22.04~f771a7f SMP PREEMPT_DYNAMIC Thu F x86_64 x86_64 x86_64 GNU/Linux
The output of
sudo lshw -c video
is:I have already reported the issue to the winit developers, but it looks like it's not a winit problem https://github.com/rust-windowing/winit/issues/2716.