Giter Club home page Giter Club logo

blade's Introduction

Blade

Matrix Build Status Docs Crates.io Crates.io Crates.io

Blade is an innovative rendering solution for Rust. It starts with a lean low-level GPU abstraction focused at ergonomics and fun. It then grows into a high-level rendering library that utilizes hardware ray-tracing. It's accompanied by a task-parallel asset pipeline together with egui support, turning into a minimal rendering engine. Finally, the top-level Blade engine combines all of this with Rapier3D-based physics and hides them behind a concise API.

architecture

Examples

scene editor particle example vehicle example sponza scene

Instructions

Just the usual 🦀 workflow. E.g. to run the bunny-mark benchmark run:

cargo run --release --example bunnymark

Platforms

The full-stack Blade Engine can only run on Vulkan with hardware Ray Tracing support. However, on secondary platforms, such as Metal and GLES/WebGL2, one can still use Blde-Graphics and Blade-Egui.

blade's People

Contributors

berkus avatar conradirwin avatar kvark avatar lukaslihotzki avatar skejeton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blade's Issues

Sporadic GPU crashes on load

Seeing them occasionally as VK_ERROR_DEVICE_LOST coming out of vkQueueSubmit.
Symptoms:

  • only happens on Sponza, which is a giant scene.
  • once it starts happening, it keeps happening. Once it works, it keeps working.
  • seems to be more likely when on battery?
  • seems to be more likely in debug mode?
  • often falls on the first or second frame rendered with UI.
  • when I needed to present this on Rust Gamedev meetup, I disabled most of the UI rendering, and it seemed to improve things.
  • Markers from #38 always point to BLAS construction. There is only one BLAS, and it's giant.
  • All primitive/instance/geometry counts are well within limits. All device address alignments are good, too.

panic when resizing window: `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DATE_KHR

I experienced this on Linux + KDE + X11 + nvidia-drivers.

Steps to reproduce:

  • checkout blade latest main (commit cda6127 )
  • cargo run --example particle
  • resize the window (sometimes one or two times)

Result:

thread 'main' panicked at blade-graphics/src/vulkan/init.rs:812:18:
called `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DATE_KHR
Backtrace
$ RUST_BACKTRACE=full cargo run --example particle
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/examples/particle`
thread 'main' panicked at blade-graphics/src/vulkan/init.rs:812:18:
called `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DATE_KHR
stack backtrace:
   0:     0x55bc4595ff16 - std::backtrace_rs::backtrace::libunwind::trace::h92ba5ac126ecc5ad
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x55bc4595ff16 - std::backtrace_rs::backtrace::trace_unsynchronized::hfaa118b6e3a8f31a
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55bc4595ff16 - std::sys_common::backtrace::_print_fmt::h2075f185adf13bbd
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x55bc4595ff16 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c4bd387f9f3f544
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55bc4598cc20 - core::fmt::rt::Argument::fmt::h018ecebdf268b5bb
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/fmt/rt.rs:142:9
   5:     0x55bc4598cc20 - core::fmt::write::h938c332fdab924eb
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/fmt/mod.rs:1120:17
   6:     0x55bc4595c22f - std::io::Write::write_fmt::h4a694b02e44e6363
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/io/mod.rs:1846:15
   7:     0x55bc4595fcf4 - std::sys_common::backtrace::_print::h3595c0f4303f3ccd
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55bc4595fcf4 - std::sys_common::backtrace::print::ha888e6736b0bc71f
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55bc45961447 - std::panicking::default_hook::{{closure}}::he19a7f79f7beab5e
  10:     0x55bc459611a9 - std::panicking::default_hook::h67efe04e9a5d446e
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:292:9
  11:     0x55bc459618d8 - std::panicking::rust_panic_with_hook::h49021cdbc4b22349
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:781:13
  12:     0x55bc459617b2 - std::panicking::begin_panic_handler::{{closure}}::hfbf601f3d8c62d13
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:659:13
  13:     0x55bc45960416 - std::sys_common::backtrace::__rust_end_short_backtrace::h98dd020b6e913806
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x55bc45961504 - rust_begin_unwind
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:647:5
  15:     0x55bc44a26ef5 - core::panicking::panic_fmt::h0d3f1893e38be419
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/panicking.rs:72:14
  16:     0x55bc44a274d3 - core::result::unwrap_failed::h1356562ef8bc898c
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/result.rs:1649:5
  17:     0x55bc45688593 - core::result::Result<T,E>::unwrap::h1f61b8b556d39205
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/result.rs:1073:23
  18:     0x55bc45688593 - blade_graphics::hal::init::<impl blade_graphics::hal::Context>::acquire_frame::hf7a67c78629a41c0
                               at /tmp/blade/blade-graphics/src/vulkan/init.rs:809:13
  19:     0x55bc44aabfcd - particle::Example::render::h7b693e8427a0cf79
                               at /tmp/blade/examples/particle/main.rs:83:21
  20:     0x55bc44ab9644 - particle::main::{{closure}}::h21c28c2be8ab1f5d
                               at /tmp/blade/examples/particle/main.rs:202:29
  21:     0x55bc44ab8e8f - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hc55cbb9bfd64a8e0
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:294:13
  22:     0x55bc44ab8e2f - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h6744f2381e5fee92
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:294:13
  23:     0x55bc44aa4459 - winit::platform_impl::platform::x11::EventLoop<T>::single_iteration::hd9b875802e16b26e
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:602:17
  24:     0x55bc44aa4cc5 - winit::platform_impl::platform::x11::EventLoop<T>::poll_events_with_timeout::h0559171b38495834
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:541:9
  25:     0x55bc44aa280f - winit::platform_impl::platform::x11::EventLoop<T>::pump_events::hefa04aa07b9c4b37
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:447:13
  26:     0x55bc44aa3065 - winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand::hf4eb9ca22711f622
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:408:19
  27:     0x55bc44ab80de - winit::platform_impl::platform::EventLoop<T>::run_on_demand::h815181939650123c
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:829:56
  28:     0x55bc44ab89e6 - winit::platform_impl::platform::EventLoop<T>::run::hf9d70478f409bc90
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:822:9
  29:     0x55bc44a95169 - winit::event_loop::EventLoop<T>::run::hb11f17c0697f4dad
                               at /home/cdruid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:249:9
  30:     0x55bc44aac80a - particle::main::h043935cd00e9f598
                               at /tmp/blade/examples/particle/main.rs:130:5
  31:     0x55bc44acbf4b - core::ops::function::FnOnce::call_once::hee517cd48cebcf88
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:250:5
  32:     0x55bc44a8f50e - std::sys_common::backtrace::__rust_begin_short_backtrace::h3f847eccec982308
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:155:18
  33:     0x55bc44a58941 - std::rt::lang_start::{{closure}}::h14c5f4be63ef514e
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:166:18
  34:     0x55bc45955dd1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he2501730d3d7649e
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:284:13
  35:     0x55bc45955dd1 - std::panicking::try::do_call::h900df580cee6b404
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:554:40
  36:     0x55bc45955dd1 - std::panicking::try::h2835d399792b43db
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:518:19
  37:     0x55bc45955dd1 - std::panic::catch_unwind::hdff7b6e6c35776df
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panic.rs:142:14
  38:     0x55bc45955dd1 - std::rt::lang_start_internal::{{closure}}::h6f12a67e0af11221
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:148:48
  39:     0x55bc45955dd1 - std::panicking::try::do_call::h226d8232820746bf
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:554:40
  40:     0x55bc45955dd1 - std::panicking::try::h7a70dd2f0620aaac
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:518:19
  41:     0x55bc45955dd1 - std::panic::catch_unwind::h4827d3381ec3b157
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panic.rs:142:14
  42:     0x55bc45955dd1 - std::rt::lang_start_internal::hc3f700406209db2c
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:148:20
  43:     0x55bc44a5891a - std::rt::lang_start::h3c69c0426c66f1ee
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:165:17
  44:     0x55bc44aac9de - main
  45:     0x7f602a41ec4a - <unknown>
  46:     0x7f602a41ed05 - __libc_start_main
  47:     0x55bc44a277d1 - _start
  48:                0x0 - <unknown>

I originally observed this on the Zed editor (reported downstream at zed-industries/zed#9628 ), but was able to reproduce it with just the particle example.

Some software versions in case that ends up being relevant:

blade $ git rev-parse HEAD
cda61274d271b70bc7174849266f0b344000aabf
$ kwin_x11 --version
kwin 5.27.10
$ nvidia-smi -q -u -x | xq -r .nvidia_smi_log.driver_version
545.29.06
$ echo $XDG_SESSION_TYPE 
x11
$ /usr/bin/X -version |& head -2
X.Org X Server 1.21.1.11

Hard to do anything useful on WebGL backend

Without both the vertex buffer (that aren't yet supported/exposed in Blade) or storage buffers (that aren't supported by WebGL2), the only way to get data into a vertex shader is via uniform buffers or textures. If a mesh is non-trivial, putting it into a texture isn't desirable by any means :)

Support multiple windows

In Zed, we are initializing a graphics context for every window. However, if there is more than one window, we are wasting time re-initializing the connection to the graphics driver, recompiling all the pipelines, etc. If we support multiple windows natively, we could save that time.

Temporary buffers

There is often a need to create a buffer knowing that it's going to perish on the next submit. Exposing a nice API for this is, however, not trivial. I could see at least 3 different approaches:

  1. Just add temporary: bool flag to struct BufferDesc and allocate accordingly. This helps with performance of small allocations, but it doesn't have with ergonomics: the user still has to know when to delete the buffers.
  2. Add something like CommandEncoder::create_temporary_buffer, which would automatically manage its lifetime and destroy whenever the underlying command pool is reset. As nice as this sounds from the ergonomics point of view, it has implementation caveats:
    - the logic of tracking temporary buffers is backend-agnostic. We could try moving it into a shared implementation, it's not a lot of code.
    - when inside a transfer pass (or any other), we can't borrow CommandEncoder even immutably... We could re-expose this method on the encoders.
    - in Vulkan backend, the command encoder doesn't have access to memory. Could be exposed?
  3. Expose a buffer belt primitive in a satellite library. Good thing is that it's fairly versatile. Bad thing is that the API is still not as nice.

VRAM statistics

It would be interesting to get statistics on how much video memory is used by ReSTIR

Annoying way to enable Tracy profiling

Everything is great, except for the fact there needs to be this small line:

let _ = profiling::tracy_client::Client::start();

This line can only be done if profiling/profile-with-tracy is enabled, but cargo/rust don't have a mechanism to check for this.
The standard way to solve it is to add a feature to blade itself, such as profile-tracy. I would like to avoid this as possible - the less features we have the easier it is to configure and test.

is_vulkan_portability incorectly set

is_vulkan_portability is only dependent on the instance extension (which may be available)

let is_vulkan_portability =
supported_instance_extensions.contains(&vk::KhrPortabilityEnumerationFn::name());

while the device may not support it

if is_vulkan_portability {
device_extensions.push(vk::KhrPortabilitySubsetFn::name());
}

resulting in: thread 'main' panicked at 'called Result::unwrap() on an Err value: ERROR_EXTENSION_NOT_PRESENT', blade-graphics\src\vulkan\init.rs:340:18 on my pc (Windows 10 RTX 4090)

blade fails to build on FreeBSD

   Compiling blade-graphics v0.3.0 (/usr/ports/editors/zed/blade/blade-graphics)
error[E0583]: file not found for module `hal`
  --> blade-graphics/src/lib.rs:62:1
   |
62 | mod hal;
   | ^^^^^^^^
   |
   = help: to create the module `hal`, create file "blade-graphics/src/hal.rs" or "blade-graphics/src/hal/mod.rs"
   = note: if there is a `mod hal` elsewhere in the crate already, import it with `use crate::...` instead

error[E0412]: cannot find type `Context` in module `super`
  --> blade-graphics/src/shader.rs:11:13
   |
11 | impl super::Context {
   |             ^^^^^^^ not found in `super`
   |
help: consider importing one of these items
   |
1  + use core::task::Context;
   |
1  + use std::task::Context;
   |
help: if you import `Context`, refer to it directly
   |
11 - impl super::Context {
11 + impl Context {
   |

error[E0412]: cannot find type `AccelerationStructure` in the crate root
   --> blade-graphics/src/traits.rs:70:40
    |
70  |         acceleration_structure: crate::AccelerationStructure,
    |                                        ^^^^^^^^^^^^^^^^^^^^^
    |
   ::: blade-graphics/src/lib.rs:449:1
    |
449 | pub struct AccelerationStructureDesc<'a> {
    | ---------------------------------------- similarly named struct `AccelerationStructureDesc` defined here
    |
help: there is an enum variant `crate::ShaderBinding::AccelerationStructure` and 1 other; try using the variant's enum
    |
70  |         acceleration_structure: crate::ShaderBinding,
    |                                 ~~~~~~~~~~~~~~~~~~~~
70  |         acceleration_structure: naga::TypeInner,
    |                                 ~~~~~~~~~~~~~~~
help: a struct with a similar name exists
    |
70  |         acceleration_structure: crate::AccelerationStructureDesc,
    |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `AccelerationStructure` in the crate root
   --> blade-graphics/src/traits.rs:77:40
    |
77  |         acceleration_structure: crate::AccelerationStructure,
    |                                        ^^^^^^^^^^^^^^^^^^^^^
    |
   ::: blade-graphics/src/lib.rs:449:1
    |
449 | pub struct AccelerationStructureDesc<'a> {
    | ---------------------------------------- similarly named struct `AccelerationStructureDesc` defined here
    |
help: there is an enum variant `crate::ShaderBinding::AccelerationStructure` and 1 other; try using the variant's enum
    |
77  |         acceleration_structure: crate::ShaderBinding,
    |                                 ~~~~~~~~~~~~~~~~~~~~
77  |         acceleration_structure: naga::TypeInner,
    |                                 ~~~~~~~~~~~~~~~
help: a struct with a similar name exists
    |
77  |         acceleration_structure: crate::AccelerationStructureDesc,
    |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~

Dynamic backends (or multiple static backends)

Do you have any idea how to make the backends (specifically, GLES or Vulkan) selectable at runtime? For exmaple, by making some object-safe traits? Alternatively, it would help if multiple backends can be activated at the same time (for example, with cargo features, preferably exposed as (non-object-safe) traits too). Then, abstracting over multiple backends could be done by the application.

[meta] Portable Ray Tracing

Stage I: #7

Stage II:

  • metal-rs expose Metal-2 APIs to RT - gfx-rs/metal-rs#256
  • naga MSL support for ray queries
  • Metal support for acceleration structures and RT pipelines
  • Make RT examples portable

Stage III:

  • Support for RT pipelines in Vulkan and Metal-3
  • Add naga support for RT shader stages
  • Example

Switch resource tracking OFF in Metal

This is fairly straightforward - just use new_command_buffer_with_unretained_references instead of new_command_buffer. The user is already responsible for tracking the lifetimes. Should be an easy win, just unclear how big of a win. So we'll need to measure it nicely.

Zed GLES backend panic: create_platform_window_surface during resize

The GLES backend for Zed is crashing for me under both X11 and Wayland. This has been occuring since at least zed-industries/zed#13114 but has probably been present for much longer. This occurs whenever you resize the window (if doing the hello_world example, which has been there the whole time) or at startup if running Zed (though I don't think this has always been the case).

This is what gets printed out:

libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
libEGL warning: DRI3: Screen seems not DRI3 capable
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAlloc" at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:448:18
   0: zed::reliability::init_panic_hook::{{closure}}
             at crates/zed/src/reliability.rs:58:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
      std::panicking::rust_panic_with_hook
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   5: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   6: core::result::unwrap_failed
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
   7: core::result::Result<T,E>::unwrap
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23
      blade_graphics::hal::platform::Context::resize
             at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:442:17
   8: gpui::platform::blade::blade_renderer::BladeRenderer::update_drawable_size
             at crates/gpui/src/platform/blade/blade_renderer.rs:430:13
   9: gpui::platform::linux::x11::window::X11WindowStatePtr::configure
             at crates/gpui/src/platform/linux/x11/window.rs:913:17
  10: gpui::platform::linux::x11::client::X11Client::handle_event
             at crates/gpui/src/platform/linux/x11/client.rs:544:17
  11: gpui::platform::linux::x11::client::X11Client::process_x11_events
             at crates/gpui/src/platform/linux/x11/client.rs:506:17
  12: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::platform::LinuxClient>::run
             at crates/gpui/src/platform/linux/x11/client.rs:1231:17
  13: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
             at crates/gpui/src/platform/linux/platform.rs:153:9
  14: gpui::app::App::run
             at crates/gpui/src/app.rs:140:9
  15: zed::main
             at crates/zed/src/main.rs:382:5
  16: core::ops::function::FnOnce::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
  17: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
  18: std::rt::lang_start::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18
  19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
      std::panicking::try
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
      std::panic::catch_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48
      std::panicking::try::do_call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
      std::panicking::try
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
      std::panic::catch_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
      std::rt::lang_start_internal
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20
  20: std::rt::lang_start
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17
  21: main
  22: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  23: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:360:3
  24: _start
             at /builddir/glibc-2.39/csu/../sysdeps/x86_64/start.S:115

And on wayland I get this:

Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAttribute" at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:448:18
   0: zed::reliability::init_panic_hook::{{closure}}
             at crates/zed/src/reliability.rs:58:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
      std::panicking::rust_panic_with_hook
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   5: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   6: core::result::unwrap_failed
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
   7: core::result::Result<T,E>::unwrap
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23
      blade_graphics::hal::platform::Context::resize
             at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:442:17
   8: gpui::platform::blade::blade_renderer::BladeRenderer::new
             at crates/gpui/src/platform/blade/blade_renderer.rs:370:28
   9: gpui::platform::linux::wayland::window::WaylandWindowState::new
             at crates/gpui/src/platform/linux/wayland/window.rs:167:23
  10: gpui::platform::linux::wayland::window::WaylandWindow::new
             at crates/gpui/src/platform/linux/wayland/window.rs:282:41
  11: <gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::linux::platform::LinuxClient>::open_window
             at crates/gpui/src/platform/linux/wayland/client.rs:588:36
  12: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::open_window
             at crates/gpui/src/platform/linux/platform.rs:256:9
  13: gpui::window::Window::new
             at crates/gpui/src/window.rs:652:35
  14: gpui::app::AppContext::open_window::{{closure}}
             at crates/gpui/src/app.rs:478:19
  15: gpui::app::AppContext::update
             at crates/gpui/src/app.rs:343:22
  16: gpui::app::AppContext::open_window
             at crates/gpui/src/app.rs:475:9
  17: gpui::app::async_context::AsyncAppContext::open_window
             at crates/gpui/src/app/async_context.rs:154:9
  18: workspace::Workspace::new_local::{{closure}}::{{closure}}
             at crates/workspace/src/workspace.rs:1012:17
  19: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/future/future.rs:123:9
  20: <async_task::runnable::Builder<M>::spawn_local::Checked<F> as core::future::future::Future>::poll
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:455:26
  21: async_task::raw::RawTask<F,T,S,M>::run
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:557:17
  22: async_task::runnable::Runnable<M>::run
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
  23: gpui::platform::linux::wayland::client::WaylandClient::new::{{closure}}::{{closure}}
             at crates/gpui/src/platform/linux/wayland/client.rs:418:29
  24: calloop::loop_logic::LoopHandle<Data>::insert_idle::{{closure}}
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:156:17
  25: <core::option::Option<F> as calloop::sources::IdleDispatcher<Data>>::dispatch
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/sources/mod.rs:597:13
  26: calloop::loop_logic::EventLoop<Data>::dispatch_idles
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:542:13
  27: calloop::loop_logic::EventLoop<Data>::dispatch
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:560:9
  28: calloop::loop_logic::EventLoop<Data>::run
             at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:596:13
  29: <gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::linux::platform::LinuxClient>::run
             at crates/gpui/src/platform/linux/wayland/client.rs:655:9
  30: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
             at crates/gpui/src/platform/linux/platform.rs:153:9
  31: gpui::app::App::run
             at crates/gpui/src/app.rs:140:9
  32: zed::main
             at crates/zed/src/main.rs:382:5
  33: core::ops::function::FnOnce::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
  34: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
  35: std::rt::lang_start::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18
  36: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
      std::panicking::try
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
      std::panic::catch_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48
      std::panicking::try::do_call
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
      std::panicking::try
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
      std::panic::catch_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
      std::rt::lang_start_internal
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20
  37: std::rt::lang_start
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17
  38: main
  39: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  40: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:360:3
  41: _start
             at /builddir/glibc-2.39/csu/../sysdeps/x86_64/start.S:115
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 6144 MB
    Total available memory: 6144 MB
    Currently available dedicated video memory: 5259 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 550.90.07
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 550.90.07
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 550.90.07
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

My DE is gnome.

[meta] ReSTIR

  • basic ReSTIR - #14
  • environment importance sampling - #21
  • emission (aka local lights)
  • transparency
  • unbiased reuse - #30
  • LOD computation
  • GGX specular
  • multi-layer materials
  • de-noising - #40, #46
  • motion vectors - #60

Rejected adapter is not printed out

llvmpipe is selected by blade instead of the hardware vulkan capable gpu

vulkaninfo

Devices:
========
GPU0:
	apiVersion         = 1.1.85
	driverVersion      = 32.3.1.0
	vendorID           = 0x10de
	deviceID           = 0x92ba03d7
	deviceType         = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
	deviceName         = NVIDIA Tegra X1 (nvgpu)
	driverID           = DRIVER_ID_NVIDIA_PROPRIETARY
	driverName         = NVIDIA
	driverInfo         = 32.3.1
	conformanceVersion = 1.1.2.0
GPU1:
	apiVersion         = 1.3.274
	driverVersion      = 0.0.1
	vendorID           = 0x10005
	deviceID           = 0x0000
	deviceType         = PHYSICAL_DEVICE_TYPE_CPU
	deviceName         = llvmpipe (LLVM 17.0.6, 128 bits)
	driverID           = DRIVER_ID_MESA_LLVMPIPE
	driverName         = llvmpipe
	driverInfo         = Mesa 24.0.5-1ubuntu1 (LLVM 17.0.6)
	conformanceVersion = 1.3.1.1
	deviceUUID         = 6d657361-3234-2e30-2e35-2d3175627500
	driverUUID         = 6c6c766d-7069-7065-5555-494400000000

bunnymark with logging

gman@switch:/tmp/blade$ RUST_LOG=blade_graphics=debug RUST_BACKTRACE=1 cargo run --example bunnymark
    Finished dev [unoptimized + debuginfo] target(s) in 0.80s
     Running `target/debug/examples/bunnymark`
[2024-04-19T00:05:16Z WARN  blade_graphics::hal::init] Requested layer is not found: "VK_LAYER_KHRONOS_validation"
[2024-04-19T00:05:16Z DEBUG blade_graphics::hal::init] Bugs SystemBugs {
        intel_unable_to_present: false,
    }
[2024-04-19T00:05:16Z WARN  blade_graphics::hal::init] Rejected for device extension "VK_KHR_timeline_semaphore" not supported
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::init] Adapter "llvmpipe (LLVM 17.0.6, 128 bits)"
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::init] No ray tracing extensions are supported
[2024-04-19T00:05:16Z DEBUG blade_graphics::hal::init] Adapter AdapterCapabilities {
        api_version: 4206866,
        properties: PhysicalDeviceProperties {
            api_version: 4206866,
            driver_version: 1,
            vendor_id: 65541,
            device_id: 0,
            device_type: CPU,
            device_name: Ok(
                "llvmpipe (LLVM 17.0.6, 128 bits)",
            ),
            pipeline_cache_uuid: [
                50,
                52,
                46,
                48,
                46,
                53,
                45,
                49,
                117,
                98,
                117,
                110,
                116,
                117,
                49,
                97,
            ],
            limits: PhysicalDeviceLimits {
                max_image_dimension1_d: 16384,
                max_image_dimension2_d: 16384,
                max_image_dimension3_d: 4096,
                max_image_dimension_cube: 32768,
                max_image_array_layers: 2048,
                max_texel_buffer_elements: 134217728,
                max_uniform_buffer_range: 65536,
                max_storage_buffer_range: 134217728,
                max_push_constants_size: 256,
                max_memory_allocation_count: 4294967295,
                max_sampler_allocation_count: 32768,
                buffer_image_granularity: 64,
                sparse_address_space_size: 0,
                max_bound_descriptor_sets: 8,
                max_per_stage_descriptor_samplers: 1000000,
                max_per_stage_descriptor_uniform_buffers: 1000000,
                max_per_stage_descriptor_storage_buffers: 1000000,
                max_per_stage_descriptor_sampled_images: 1000000,
                max_per_stage_descriptor_storage_images: 1000000,
                max_per_stage_descriptor_input_attachments: 1000000,
                max_per_stage_resources: 1000000,
                max_descriptor_set_samplers: 1000000,
                max_descriptor_set_uniform_buffers: 1000000,
                max_descriptor_set_uniform_buffers_dynamic: 1000000,
                max_descriptor_set_storage_buffers: 1000000,
                max_descriptor_set_storage_buffers_dynamic: 1000000,
                max_descriptor_set_sampled_images: 1000000,
                max_descriptor_set_storage_images: 1000000,
                max_descriptor_set_input_attachments: 1000000,
                max_vertex_input_attributes: 32,
                max_vertex_input_bindings: 32,
                max_vertex_input_attribute_offset: 2047,
                max_vertex_input_binding_stride: 2048,
                max_vertex_output_components: 128,
                max_tessellation_generation_level: 64,
                max_tessellation_patch_size: 32,
                max_tessellation_control_per_vertex_input_components: 128,
                max_tessellation_control_per_vertex_output_components: 128,
                max_tessellation_control_per_patch_output_components: 128,
                max_tessellation_control_total_output_components: 4096,
                max_tessellation_evaluation_input_components: 128,
                max_tessellation_evaluation_output_components: 128,
                max_geometry_shader_invocations: 32,
                max_geometry_input_components: 64,
                max_geometry_output_components: 128,
                max_geometry_output_vertices: 1024,
                max_geometry_total_output_components: 1024,
                max_fragment_input_components: 128,
                max_fragment_output_attachments: 8,
                max_fragment_dual_src_attachments: 2,
                max_fragment_combined_output_resources: 104,
                max_compute_shared_memory_size: 32768,
                max_compute_work_group_count: [
                    65535,
                    65535,
                    65535,
                ],
                max_compute_work_group_invocations: 1024,
                max_compute_work_group_size: [
                    1024,
                    1024,
                    1024,
                ],
                sub_pixel_precision_bits: 8,
                sub_texel_precision_bits: 8,
                mipmap_precision_bits: 4,
                max_draw_indexed_index_value: 4294967295,
                max_draw_indirect_count: 4294967295,
                max_sampler_lod_bias: 16.0,
                max_sampler_anisotropy: 16.0,
                max_viewports: 16,
                max_viewport_dimensions: [
                    16384,
                    16384,
                ],
                viewport_bounds_range: [
                    -32768.0,
                    32768.0,
                ],
                viewport_sub_pixel_bits: 0,
                min_memory_map_alignment: 64,
                min_texel_buffer_offset_alignment: 16,
                min_uniform_buffer_offset_alignment: 16,
                min_storage_buffer_offset_alignment: 16,
                min_texel_offset: -32,
                max_texel_offset: 31,
                min_texel_gather_offset: -32,
                max_texel_gather_offset: 31,
                min_interpolation_offset: -2.0,
                max_interpolation_offset: 2.0,
                sub_pixel_interpolation_offset_bits: 8,
                max_framebuffer_width: 16384,
                max_framebuffer_height: 16384,
                max_framebuffer_layers: 2048,
                framebuffer_color_sample_counts: TYPE_1 | TYPE_4,
                framebuffer_depth_sample_counts: TYPE_1 | TYPE_4,
                framebuffer_stencil_sample_counts: TYPE_1 | TYPE_4,
                framebuffer_no_attachments_sample_counts: TYPE_1 | TYPE_4,
                max_color_attachments: 8,
                sampled_image_color_sample_counts: TYPE_1 | TYPE_4,
                sampled_image_integer_sample_counts: TYPE_1 | TYPE_4,
                sampled_image_depth_sample_counts: TYPE_1 | TYPE_4,
                sampled_image_stencil_sample_counts: TYPE_1 | TYPE_4,
                storage_image_sample_counts: TYPE_1 | TYPE_4,
                max_sample_mask_words: 1,
                timestamp_compute_and_graphics: 1,
                timestamp_period: 1.0,
                max_clip_distances: 8,
                max_cull_distances: 8,
                max_combined_clip_and_cull_distances: 8,
                discrete_queue_priorities: 2,
                point_size_range: [
                    0.0,
                    255.0,
                ],
                line_width_range: [
                    1.0,
                    255.0,
                ],
                point_size_granularity: 0.125,
                line_width_granularity: 0.0078125,
                strict_lines: 1,
                standard_sample_locations: 1,
                optimal_buffer_copy_offset_alignment: 128,
                optimal_buffer_copy_row_pitch_alignment: 128,
                non_coherent_atom_size: 64,
            },
            sparse_properties: PhysicalDeviceSparseProperties {
                residency_standard2_d_block_shape: 0,
                residency_standard2_d_multisample_block_shape: 0,
                residency_standard3_d_block_shape: 0,
                residency_aligned_mip_size: 0,
                residency_non_resident_strict: 0,
            },
        },
        queue_family_index: 0,
        layered: false,
        ray_tracing: false,
        buffer_marker: false,
        shader_info: false,
    }
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::init] Using surface present mode MAILBOX
[2024-04-19T00:05:16Z DEBUG blade_graphics::shader] Processing vertex argument: vertex
[2024-04-19T00:05:16Z DEBUG blade_graphics::shader] Assigning location(0) for member 'pos' to be using input 0:0
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::resource] Creating texture 0x55793b9310 of size 1x1x1 and format Rgba8Unorm, name 'texutre', handle 0
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::resource] Creating buffer 0x55793cff60 of size 4, name 'staging', handle 1
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::resource] Creating buffer 0x55794d26d0 of size 32, name 'vertex', handle 2
[2024-04-19T00:05:16Z INFO  blade_graphics::hal::resource] Destroying buffer 0x55793cff60, handle 1
Avg frame time 14.189078ms
[2024-04-19T00:05:17Z INFO  blade_graphics::hal::resource] Destroying buffer 0x55794d26d0, handle 2
[2024-04-19T00:05:17Z INFO  blade_graphics::hal::resource] Destroying texture 0x55793b9310, handle 0

Don't block use of Intel on Nvidia hybrid systems.

The recent commit 30c4fa4 makes it so that things like zed run on the dgpu full time, this is not an acceptable solution for #88 as it causes excessive battery drain, heat, etc.

In that issue I reference gfx-rs/wgpu#4110 because it appears to be a very similar use case.

My own system is currently:

Operating System: Fedora Linux 40
Kernel Version: 6.8.0-rc7+ (64-bit)
Graphics Platform: Wayland
Processors: 32 × Intel® Core™ i9-14900HX
Memory: 62.4 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Strix SCAR 16 G634JYR_G634JYR_000045397
System Version: 1.0

Installed mesa version is: 24.0.0

Installed nvidia version: 550.54.14

I also have older laptops I can test. Plus I have tested on fedora 39 quite fine which used 6.6.x and 6.7.x kernels. The desktop is irrelevant here, I've tested on COSMIC, Gnome, KDE. What is of note however is that I do not use Xorg sessions and haven't done for years.

The proper and expected solution is to find the exact cause of #88 and either fix that, or work around that one specific case. A blanket blocking of all intel/nvidia just handicaps everyone regardless.

Logs

Output from example using Intel:

The VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json wasn't actually required here.

❯ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json RUST_LOG=debug cargo run --example particle
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/examples/particle`
[2024-03-11T04:35:49Z DEBUG egui_winit::clipboard] Initializing arboard clipboard…
[2024-03-11T04:35:49Z DEBUG egui_winit::clipboard] Initializing smithay clipboard…
[2024-03-11T04:35:49Z WARN  blade_graphics::hal::init] Requested layer is not found: "VK_LAYER_KHRONOS_validation"
[2024-03-11T04:35:49Z INFO  blade_graphics::hal::init] Adapter "Intel(R) Graphics (RPL-S)"
[2024-03-11T04:35:49Z INFO  blade_graphics::hal::init] No ray tracing extensions are supported
[2024-03-11T04:35:49Z DEBUG blade_graphics::hal::init] Adapter AdapterCapabilities {
        api_version: 4206866,
        properties: PhysicalDeviceProperties {
            api_version: 4206866,
            driver_version: 100663296,
            vendor_id: 32902,
            device_id: 42888,
            device_type: INTEGRATED_GPU,
            device_name: "Intel(R) Graphics (RPL-S)",
            pipeline_cache_uuid: [
                30,
                116,
                185,
                68,
                191,
                206,
                235,
                242,
                182,
                25,
                50,
                41,
                188,
                127,
                83,
                255,
            ],
            limits: PhysicalDeviceLimits {
                max_image_dimension1_d: 16384,
                max_image_dimension2_d: 16384,
                max_image_dimension3_d: 2048,
                max_image_dimension_cube: 16384,
                max_image_array_layers: 2048,
                max_texel_buffer_elements: 134217728,
                max_uniform_buffer_range: 1073741824,
                max_storage_buffer_range: 4294967295,
                max_push_constants_size: 128,
                max_memory_allocation_count: 4294967295,
                max_sampler_allocation_count: 65536,
                buffer_image_granularity: 1,
                sparse_address_space_size: 17587891077120,
                max_bound_descriptor_sets: 8,
                max_per_stage_descriptor_samplers: 65535,
                max_per_stage_descriptor_uniform_buffers: 64,
                max_per_stage_descriptor_storage_buffers: 65535,
                max_per_stage_descriptor_sampled_images: 65535,
                max_per_stage_descriptor_storage_images: 65535,
                max_per_stage_descriptor_input_attachments: 64,
                max_per_stage_resources: 4294967295,
                max_descriptor_set_samplers: 393210,
                max_descriptor_set_uniform_buffers: 384,
                max_descriptor_set_uniform_buffers_dynamic: 8,
                max_descriptor_set_storage_buffers: 393210,
                max_descriptor_set_storage_buffers_dynamic: 8,
                max_descriptor_set_sampled_images: 393210,
                max_descriptor_set_storage_images: 393210,
                max_descriptor_set_input_attachments: 256,
                max_vertex_input_attributes: 29,
                max_vertex_input_bindings: 31,
                max_vertex_input_attribute_offset: 2047,
                max_vertex_input_binding_stride: 4095,
                max_vertex_output_components: 128,
                max_tessellation_generation_level: 64,
                max_tessellation_patch_size: 32,
                max_tessellation_control_per_vertex_input_components: 128,
                max_tessellation_control_per_vertex_output_components: 128,
                max_tessellation_control_per_patch_output_components: 128,
                max_tessellation_control_total_output_components: 2048,
                max_tessellation_evaluation_input_components: 128,
                max_tessellation_evaluation_output_components: 128,
                max_geometry_shader_invocations: 32,
                max_geometry_input_components: 128,
                max_geometry_output_components: 128,
                max_geometry_output_vertices: 256,
                max_geometry_total_output_components: 1024,
                max_fragment_input_components: 116,
                max_fragment_output_attachments: 8,
                max_fragment_dual_src_attachments: 1,
                max_fragment_combined_output_resources: 131078,
                max_compute_shared_memory_size: 65536,
                max_compute_work_group_count: [
                    65535,
                    65535,
                    65535,
                ],
                max_compute_work_group_invocations: 1024,
                max_compute_work_group_size: [
                    1024,
                    1024,
                    1024,
                ],
                sub_pixel_precision_bits: 8,
                sub_texel_precision_bits: 8,
                mipmap_precision_bits: 8,
                max_draw_indexed_index_value: 4294967295,
                max_draw_indirect_count: 4294967295,
                max_sampler_lod_bias: 16.0,
                max_sampler_anisotropy: 16.0,
                max_viewports: 16,
                max_viewport_dimensions: [
                    16384,
                    16384,
                ],
                viewport_bounds_range: [
                    -32768.0,
                    32767.0,
                ],
                viewport_sub_pixel_bits: 13,
                min_memory_map_alignment: 4096,
                min_texel_buffer_offset_alignment: 16,
                min_uniform_buffer_offset_alignment: 64,
                min_storage_buffer_offset_alignment: 4,
                min_texel_offset: -8,
                max_texel_offset: 7,
                min_texel_gather_offset: -32,
                max_texel_gather_offset: 31,
                min_interpolation_offset: -0.5,
                max_interpolation_offset: 0.4375,
                sub_pixel_interpolation_offset_bits: 4,
                max_framebuffer_width: 16384,
                max_framebuffer_height: 16384,
                max_framebuffer_layers: 2048,
                framebuffer_color_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                framebuffer_depth_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                framebuffer_stencil_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                framebuffer_no_attachments_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                max_color_attachments: 8,
                sampled_image_color_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                sampled_image_integer_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                sampled_image_depth_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                sampled_image_stencil_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                storage_image_sample_counts: TYPE_1,
                max_sample_mask_words: 1,
                timestamp_compute_and_graphics: 1,
                timestamp_period: 52.083332,
                max_clip_distances: 8,
                max_cull_distances: 8,
                max_combined_clip_and_cull_distances: 8,
                discrete_queue_priorities: 2,
                point_size_range: [
                    0.125,
                    255.875,
                ],
                line_width_range: [
                    0.0,
                    8.0,
                ],
                point_size_granularity: 0.125,
                line_width_granularity: 0.0078125,
                strict_lines: 0,
                standard_sample_locations: 1,
                optimal_buffer_copy_offset_alignment: 128,
                optimal_buffer_copy_row_pitch_alignment: 128,
                non_coherent_atom_size: 64,
            },
            sparse_properties: PhysicalDeviceSparseProperties {
                residency_standard2_d_block_shape: 1,
                residency_standard2_d_multisample_block_shape: 0,
                residency_standard3_d_block_shape: 1,
                residency_aligned_mip_size: 0,
                residency_non_resident_strict: 1,
            },
        },
        queue_family_index: 0,
        layered: false,
        ray_tracing: false,
        buffer_marker: true,
        shader_info: false,
    }

Using nvidia

❯ RUST_LOG=debug switcherooctl launch cargo run --example particle
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/examples/particle`
[2024-03-11T04:37:58Z DEBUG egui_winit::clipboard] Initializing arboard clipboard…
[2024-03-11T04:37:58Z DEBUG egui_winit::clipboard] Initializing smithay clipboard…
[2024-03-11T04:37:58Z WARN  blade_graphics::hal::init] Requested layer is not found: "VK_LAYER_KHRONOS_validation"
DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
TU: error: ../src/freedreno/vulkan/tu_knl.cc:232: device /dev/dri/renderD128 (i915) is not compatible with turnip (VK_ERROR_INCOMPATIBLE_DRIVER)
TU: error: ../src/freedreno/vulkan/tu_knl.cc:232: device /dev/dri/renderD129 (nvidia-drm) is not compatible with turnip (VK_ERROR_INCOMPATIBLE_DRIVER)
[2024-03-11T04:37:58Z INFO  blade_graphics::hal::init] Adapter "NVIDIA GeForce RTX 4090 Laptop GPU"
[2024-03-11T04:37:58Z INFO  blade_graphics::hal::init] Ray tracing is supported
[2024-03-11T04:37:58Z DEBUG blade_graphics::hal::init] Ray tracing properties: PhysicalDeviceAccelerationStructurePropertiesKHR {
        s_type: PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR,
        p_next: 0x00007ffc7dbb8d40,
        max_geometry_count: 16777215,
        max_instance_count: 16777215,
        max_primitive_count: 536870911,
        max_per_stage_descriptor_acceleration_structures: 1048576,
        max_per_stage_descriptor_update_after_bind_acceleration_structures: 1048576,
        max_descriptor_set_acceleration_structures: 1048576,
        max_descriptor_set_update_after_bind_acceleration_structures: 1048576,
        min_acceleration_structure_scratch_offset_alignment: 128,
    }
[2024-03-11T04:37:58Z DEBUG blade_graphics::hal::init] Adapter AdapterCapabilities {
        api_version: 4206867,
        properties: PhysicalDeviceProperties {
            api_version: 4206869,
            driver_version: 2307752832,
            vendor_id: 4318,
            device_id: 10071,
            device_type: DISCRETE_GPU,
            device_name: "NVIDIA GeForce RTX 4090 Laptop GPU",
            pipeline_cache_uuid: [
                106,
                157,
                243,
                178,
                252,
                57,
                140,
                51,
                193,
                158,
                239,
                82,
                244,
                219,
                236,
                237,
            ],
            limits: PhysicalDeviceLimits {
                max_image_dimension1_d: 32768,
                max_image_dimension2_d: 32768,
                max_image_dimension3_d: 16384,
                max_image_dimension_cube: 32768,
                max_image_array_layers: 2048,
                max_texel_buffer_elements: 134217728,
                max_uniform_buffer_range: 65536,
                max_storage_buffer_range: 4294967295,
                max_push_constants_size: 256,
                max_memory_allocation_count: 4294967295,
                max_sampler_allocation_count: 4000,
                buffer_image_granularity: 1024,
                sparse_address_space_size: 1099511627775,
                max_bound_descriptor_sets: 32,
                max_per_stage_descriptor_samplers: 1048576,
                max_per_stage_descriptor_uniform_buffers: 1048576,
                max_per_stage_descriptor_storage_buffers: 1048576,
                max_per_stage_descriptor_sampled_images: 1048576,
                max_per_stage_descriptor_storage_images: 1048576,
                max_per_stage_descriptor_input_attachments: 1048576,
                max_per_stage_resources: 4294967295,
                max_descriptor_set_samplers: 1048576,
                max_descriptor_set_uniform_buffers: 1048576,
                max_descriptor_set_uniform_buffers_dynamic: 15,
                max_descriptor_set_storage_buffers: 1048576,
                max_descriptor_set_storage_buffers_dynamic: 16,
                max_descriptor_set_sampled_images: 1048576,
                max_descriptor_set_storage_images: 1048576,
                max_descriptor_set_input_attachments: 1048576,
                max_vertex_input_attributes: 32,
                max_vertex_input_bindings: 32,
                max_vertex_input_attribute_offset: 2047,
                max_vertex_input_binding_stride: 2048,
                max_vertex_output_components: 128,
                max_tessellation_generation_level: 64,
                max_tessellation_patch_size: 32,
                max_tessellation_control_per_vertex_input_components: 128,
                max_tessellation_control_per_vertex_output_components: 128,
                max_tessellation_control_per_patch_output_components: 120,
                max_tessellation_control_total_output_components: 4216,
                max_tessellation_evaluation_input_components: 128,
                max_tessellation_evaluation_output_components: 128,
                max_geometry_shader_invocations: 32,
                max_geometry_input_components: 128,
                max_geometry_output_components: 128,
                max_geometry_output_vertices: 1024,
                max_geometry_total_output_components: 1024,
                max_fragment_input_components: 128,
                max_fragment_output_attachments: 8,
                max_fragment_dual_src_attachments: 1,
                max_fragment_combined_output_resources: 4294967295,
                max_compute_shared_memory_size: 49152,
                max_compute_work_group_count: [
                    2147483647,
                    65535,
                    65535,
                ],
                max_compute_work_group_invocations: 1024,
                max_compute_work_group_size: [
                    1024,
                    1024,
                    64,
                ],
                sub_pixel_precision_bits: 8,
                sub_texel_precision_bits: 8,
                mipmap_precision_bits: 8,
                max_draw_indexed_index_value: 4294967295,
                max_draw_indirect_count: 4294967295,
                max_sampler_lod_bias: 15.0,
                max_sampler_anisotropy: 16.0,
                max_viewports: 16,
                max_viewport_dimensions: [
                    32768,
                    32768,
                ],
                viewport_bounds_range: [
                    -65536.0,
                    65536.0,
                ],
                viewport_sub_pixel_bits: 8,
                min_memory_map_alignment: 64,
                min_texel_buffer_offset_alignment: 16,
                min_uniform_buffer_offset_alignment: 64,
                min_storage_buffer_offset_alignment: 16,
                min_texel_offset: -8,
                max_texel_offset: 7,
                min_texel_gather_offset: -32,
                max_texel_gather_offset: 31,
                min_interpolation_offset: -0.5,
                max_interpolation_offset: 0.4375,
                sub_pixel_interpolation_offset_bits: 4,
                max_framebuffer_width: 32768,
                max_framebuffer_height: 32768,
                max_framebuffer_layers: 2048,
                framebuffer_color_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                framebuffer_depth_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                framebuffer_stencil_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                framebuffer_no_attachments_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                max_color_attachments: 8,
                sampled_image_color_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                sampled_image_integer_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                sampled_image_depth_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                sampled_image_stencil_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8 | TYPE_16,
                storage_image_sample_counts: TYPE_1 | TYPE_2 | TYPE_4 | TYPE_8,
                max_sample_mask_words: 1,
                timestamp_compute_and_graphics: 1,
                timestamp_period: 1.0,
                max_clip_distances: 8,
                max_cull_distances: 8,
                max_combined_clip_and_cull_distances: 8,
                discrete_queue_priorities: 2,
                point_size_range: [
                    1.0,
                    2047.9375,
                ],
                line_width_range: [
                    1.0,
                    64.0,
                ],
                point_size_granularity: 0.0625,
                line_width_granularity: 0.0625,
                strict_lines: 1,
                standard_sample_locations: 1,
                optimal_buffer_copy_offset_alignment: 1,
                optimal_buffer_copy_row_pitch_alignment: 1,
                non_coherent_atom_size: 64,
            },
            sparse_properties: PhysicalDeviceSparseProperties {
                residency_standard2_d_block_shape: 1,
                residency_standard2_d_multisample_block_shape: 1,
                residency_standard3_d_block_shape: 1,
                residency_aligned_mip_size: 0,
                residency_non_resident_strict: 1,
            },
        },
        queue_family_index: 0,
        layered: false,
        ray_tracing: true,
        buffer_marker: true,
        shader_info: false,
   } 

in all cases the example presented fine.

Resize warnings on Linux/X11

It looks like the surface doesn't get its size updated, as far as Vulkan is concerned:

VUID-VkSwapchainCreateInfoKHR-pNext-07781(ERROR / SPEC): msgNum: 1284057537 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-pNext-07781 ] | MessageID = 0x4c8929c1 | vkCreateSwapchainKHR(): pCreateInfo->imageExtent (1025, 659), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (800,600), minImageExtent = (800,600), maxImageExtent = (800,600). The Vulkan spec states: If a VkSwapchainPresentScalingCreateInfoEXT structure was not included in the pNext chain, or it is included and VkSwapchainPresentScalingCreateInfoEXT::scalingBehavior is zero then imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-pNext-07781)

Zed: Thread "main" panicked with "Unexpected descriptor allocation error: ERROR_FRAGMENTED_POOL"

Hard to say what the cause is, but it started happening in the last day where I think there was a blade update.

Caused by:
    expected value at line 1 column 1
Thread "main" panicked with "Unexpected descriptor allocation error: ERROR_FRAGMENTED_POOL" at /home/luke/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/9c9cabf69e86/blade-graphics/src/vulkan/descriptor.rs:85:27
   0: Zed::reliability::init_panic_hook::{{closure}}
             at Projects/zed/crates/zed/src/reliability.rs:54:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
      std::panicking::rust_panic_with_hook
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   5: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   6: blade_graphics::hal::descriptor::<impl blade_graphics::hal::Device>::allocate_descriptor_set
             at .cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/9c9cabf69e86/blade-graphics/src/vulkan/descriptor.rs:85:27
   7: blade_graphics::hal::command::<impl blade_graphics::traits::PipelineEncoder for blade_graphics::hal::PipelineEncoder>::bind
             at .cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/9c9cabf69e86/blade-graphics/src/vulkan/command.rs:706:22
      blade_graphics::hal::command::<impl blade_graphics::hal::PipelineEncoder>::bind
             at .cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/9c9cabf69e86/blade-graphics/src/vulkan/command.rs:695:1
      gpui::platform::blade::blade_renderer::BladeRenderer::draw
             at Projects/zed/crates/gpui/src/platform/blade/blade_renderer.rs:635:33
   8: <gpui::platform::linux::wayland::window::WaylandWindow as gpui::platform::PlatformWindow>::draw
             at Projects/zed/crates/gpui/src/platform/linux/wayland/window.rs:803:9
   9: gpui::window::WindowContext::present
             at Projects/zed/crates/gpui/src/window.rs:1393:9
      gpui::window::Window::new::{{closure}}::{{closure}}::{{closure}}
             at Projects/zed/crates/gpui/src/window.rs:695:33
      <gpui::app::AppContext as gpui::Context>::update_window::{{closure}}
             at Projects/zed/crates/gpui/src/app.rs:1339:26
      gpui::app::AppContext::update
             at Projects/zed/crates/gpui/src/app.rs:361:22
      <gpui::app::AppContext as gpui::Context>::update_window
             at Projects/zed/crates/gpui/src/app.rs:1330:9
      <gpui::app::async_context::AsyncAppContext as gpui::Context>::update_window
             at Projects/zed/crates/gpui/src/app/async_context.rs:91:14
      gpui::window::AnyWindowHandle::update
             at Projects/zed/crates/gpui/src/window.rs:4487:9
      gpui::window::Window::new::{{closure}}::{{closure}}
             at Projects/zed/crates/gpui/src/window.rs:693:30

Can't find vulkan layer?

I'd never heard of blade until zed merged it in. Unsure what environment you use, but for me nothing works:

Operating System: Fedora Linux 40
KDE Plasma Version: 5.93.0
KDE Frameworks Version: 5.249.0
Qt Version: 6.6.1
Kernel Version: 6.7.4-666.rog.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13980HX
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Strix G634JZ_G634JZ_00016247D
System Version: 1.0

Fails also with attempt to offload to Nvidia dgpu.

❯ RUST_BACKTRACE=full cargo run --example bunnymark
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/examples/bunnymark`
thread 'main' panicked at blade-graphics/src/vulkan/init.rs:281:55:
called `Result::unwrap()` on an `Err` value: ERROR_LAYER_NOT_PRESENT
stack backtrace:
   0:     0x562d657cc56c - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x562d657cc56c - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x562d657cc56c - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x562d657cc56c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed7f999df88cc644
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x562d657f8f30 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
   5:     0x562d657f8f30 - core::fmt::write::h3a39390d8560d9c9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
   6:     0x562d657c97ff - std::io::Write::write_fmt::h5fc9997dfe05f882
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
   7:     0x562d657cc354 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x562d657cc354 - std::sys_common::backtrace::print::h23a2d212c6fff936
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x562d657cd867 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
  10:     0x562d657cd5cf - std::panicking::default_hook::h6038f2eba384e475
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
  11:     0x562d657cdd58 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:779:13
  12:     0x562d657cdc3e - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
  13:     0x562d657cca36 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x562d657cd9a2 - rust_begin_unwind
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
  15:     0x562d657f6905 - core::panicking::panic_fmt::hbf0e066aabfa482c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
  16:     0x562d657f6ed3 - core::result::unwrap_failed::hddb4fea594200c52
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
  17:     0x562d6551d61e - core::result::Result<T,E>::unwrap::h7a2493d53caee515
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23
  18:     0x562d65532694 - blade_graphics::hal::init::<impl blade_graphics::hal::Context>::init_impl::hf4f189f691033b16
                               at /home/luke/Projects/blade/blade-graphics/src/vulkan/init.rs:281:13
  19:     0x562d64d48443 - blade_graphics::hal::init::<impl blade_graphics::hal::Context>::init_windowed::h1696d837165f130f
                               at /home/luke/Projects/blade/blade-graphics/src/vulkan/init.rs:562:9
  20:     0x562d64d80e31 - bunnymark::Example::new::h7959c649ee3bf0e5
                               at /home/luke/Projects/blade/examples/bunnymark/main.rs:57:13
  21:     0x562d64d82b14 - bunnymark::main::hc32685f80d6861d9
                               at /home/luke/Projects/blade/examples/bunnymark/main.rs:306:23
  22:     0x562d64da525b - core::ops::function::FnOnce::call_once::heb158917feda7b80
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
  23:     0x562d64d4360e - std::sys_common::backtrace::__rust_begin_short_backtrace::hfba5955c6345884a
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:154:18
  24:     0x562d64d580b1 - std::rt::lang_start::{{closure}}::h3527050a22ae0255
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:167:18
  25:     0x562d657c41b7 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd95060ecd5e1ca24
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
  26:     0x562d657c41b7 - std::panicking::try::do_call::h6e8cf51db32a6e4b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  27:     0x562d657c41b7 - std::panicking::try::h3a52eefe24fe3c29
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  28:     0x562d657c41b7 - std::panic::catch_unwind::h24c28c23c02c3841
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  29:     0x562d657c41b7 - std::rt::lang_start_internal::{{closure}}::h705d3c9cbc06ef47
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
  30:     0x562d657c41b7 - std::panicking::try::do_call::ha21f52ba13158470
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  31:     0x562d657c41b7 - std::panicking::try::h5581346bf6aeb1f8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  32:     0x562d657c41b7 - std::panic::catch_unwind::h7919645a6b72e25b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  33:     0x562d657c41b7 - std::rt::lang_start_internal::h12de51168669836e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  34:     0x562d64d5808a - std::rt::lang_start::h17af736eef4d3cce
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:166:17
  35:     0x562d64d82f5e - main
  36:     0x7fb189c87088 - __libc_start_call_main
  37:     0x7fb189c8714b - __libc_start_main_impl
  38:     0x562d64d43535 - _start
  39:                0x0 - <unknown>
warning: queue 0x562d6696b5e0 destroyed while proxies still attached:
  xdg_wm_base@24 still attached
  wl_output@15 still attached
  zwp_text_input_manager_v3@14 still attached
  xdg_activation_v1@13 still attached
  wl_subcompositor@12 still attached
  zwp_relative_pointer_manager_v1@11 still attached
  zwp_pointer_constraints_v1@10 still attached
  wl_seat@9 still attached
  wl_shm@8 still attached
  wp_fractional_scale_manager_v1@7 still attached
  wp_viewporter@6 still attached
  zxdg_decoration_manager_v1@5 still attached
  wl_compositor@4 still attached
  wl_registry@2 still attached

wgpu works fine.

egui image loader fails to recognize png with blade-egui

Using blade and attempting to draw an image similar to in eframe results with:
egui_extras::install_image_loaders(ctx); ui.add(Image::new(include_image!("assets/logo.png"));
Using image/egui_extras results in the image loader not registering (works with eframe)

ERROR_INITIALIZATION_FAILED on Linux

Hello, I am getting the error in the title when attempting to run Blade. Got this when testing zed, but tried to run blade-graphics examples directly and they receive the same error. I am able to successfully run vkcube, wgpu apps and a custom vulkan example correctly. I don't really see anything off about the line it's erroring on (just a simple swapchain setup)

I am currently using the nvidia-open drivers, which might have to do with it, due to a system error in arch under 550, but I assume a lot of us are doing this right now.

Attached the full error and my vulkaninfo, but will continue to look
error.txt
vulkaninfo.txt

Panics in submit when running under X11

After the zed launch, we're seeing a number of crashes in ::submit:

  • Aquire image error ERROR_SURFACE_LOST_KHR
  • GPU has crashed, and no debug information is available.

It seems like these are exclusive (or at least very much more common) on Zed's X11 implementation vs the Wayland one, so I wonder if we've messed something up on our side.

I haven't seen this locally, but it happens across a wide range of linux distributions in the wild.

Do you have an idea for what I should look for to try and debug this?

Example won't compile because of broken del-msh dependency

$ cargo run --release --example bunnymark
   Compiling del-msh v0.1.17
   Compiling ron v0.8.1
   Compiling egui-gizmo v0.12.0
   Compiling egui_plot v0.23.0
error[E0425]: cannot find function `nearest_to_point3_` in module `tri3`
   --> /home/rsaarelm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/del-msh-0.1.17/src/trimesh3_search.rs:55:40
    |
55  |               let (pn, _r0, _r1) = tri3::nearest_to_point3_(
    |                                          ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `nearest_to_point3`
    |
   ::: /home/rsaarelm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/del-geo-0.1.14/src/tri3.rs:197:1
    |
197 | / pub fn nearest_to_point3<T>(
198 | |     q0: &nalgebra::Vector3<T>,
199 | |     q1: &nalgebra::Vector3<T>,
200 | |     q2: &nalgebra::Vector3<T>,
...   |
203 | |     where T: nalgebra::RealField + Copy + 'static,
204 | |           f64: AsPrimitive<T>
    | |_____________________________- similarly named function `nearest_to_point3` defined here

error[E0277]: the size for values of type `[_]` cannot be known at compilation time
  --> /home/rsaarelm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/del-msh-0.1.17/src/trimesh3_search.rs:55:18
   |
55 |             let (pn, _r0, _r1) = tri3::nearest_to_point3_(
   |                  ^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `[_]`
   = note: all local variables must have a statically known size
   = help: unsized locals are gated as an unstable feature

Some errors have detailed explanations: E0277, E0425.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `del-msh` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

$ rustc --version
rustc 1.74.0 (79e9716c9 2023-11-13) (built from a source tarball)
$ git rev-parse HEAD
53d8e88763d529edb343a081e530e1661901a4e8

[Zed] ERROR_INCOMPATIBLE_DRIVER

Arch Linux, up to date| linux 6.9.2 | Wayland | GNOME 46 | Ryzen 5 5600U with integrated Radeon graphics

Zed installed through the zed-editor-git AUR package. This package do works as I'm using it daily on another computer. I originally tried to transfer the compiled archive from my main computer to this one, and then built it directly. Same result for both:

$ Zed
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: ERROR_INCOMPATIBLE_DRIVER" at [scrubbed]/blade-b2bcd1de1cf7ab6a/bdaf8c5/blade-graphics/src/vulkan/init.rs:346:55

Since it is related to a blade assertion, I thought it would be faster to start the issue here.
I honestly don't know much about graphics stack and so on, so I'm a little lost on the information required here.

Window transparency support

There is a bit of a portability problem: Vulkan/Mesa supports VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR, while Metal supports VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR.

We don't want to do an extra full-screen pass, and we don't control the pipelines of the user.
So perhaps we could request transparency and then get one of the modes back:

#[derive(Debug)]
pub struct SurfaceConfig {
    ...
    transparent: bool,
}


enum AlphaMode {
  Ignored,
  PreMultiplied,
  PostMultiplied,
}

struct SurfaceInfo {
  format: TextureFormat,
  alpha: AlphaMode,
}

fn resize(&self, config: SurfaceConfig) -> SurfaceInfo {...}

Then the user of the library can do the pre (or post) multiplication themselves in the shader.

Full Ray Traced Scene

We need to demonstrate an ability to load whole 3D scenes and render them in real-time with ray-tracing.
Even though #6 has paved the way to ray tracing, and there is a ray query example now, there is still a few hard steps to make for this to work on complex scenes.

Main steps:

  • blade-render crate with Renderer API
  • provide all geometry data to the shader
  • glTF loader
  • environment map - importance sampling
  • lighting model

Bonus:

  • asset cache (potentially with distill)
  • taskification (likely with choir)

First of all, there needs to be a blade-render crate that takes care of scene resources, BLAS/TLAS, pipelines, and associated buffers. The user would still be in control of encoding the commands, but the renderer would do all the heavy lifting of ray-tracing.

Secondly, we need to find a way for the ray intersection code to fetch the associated object data: vertex/index buffers, material parameters, etc. This is generally done via the device address buffer (and potentially SBT) in Vulkan, but here we have to also make it compatible with Metal. So far, it looks like the only way there is via converting everything to use Metal Argument Buffers. So we'd start by doing the work on Naga side.

Potentially, we'd first get Vulkan running with blade-render, and then focus on ramping up Metal side. There is still a question of what type would be used for the array bindings, since &[BufferPiece; N] is apparently not liked by the orphan rules:

error[E0119]: conflicting implementations of trait `HasShaderBinding` for type `&[BufferPiece; _]`
   --> blade-graphics\src\lib.rs:443:1
    |
429 | impl<T: bytemuck::Pod> HasShaderBinding for T {
    | --------------------------------------------- first implementation here
...
443 | impl<'a, const N: usize> HasShaderBinding for &'a [BufferPiece; N] {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&[BufferPiece; _]`
    |
    = note: upstream crates may add a new impl of trait `bytemuck::Pod` for type `&[BufferPiece; _]` in future versions

Windows: Disable exclusive fullscreen mode

I was working on a fullscreen implementation at zed-industries/zed#9728 and ran into a problem where it would automatically go into exclusive fullscreen mode, and it needed to use VK_EXT_full_screen_exclusive to fix this.

kazatsuyu@662787b
This is my quick implementation and I have confirmed that it works, but I don't know much about blade internals and don't have a lot of knowledge of Vulkan, so I would need to consult with you on how to implement it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.