blade icon indicating copy to clipboard operation
blade copied to clipboard

Zed GLES backend panic: create_platform_window_surface during resize

Open someone13574 opened this issue 1 year ago • 13 comments

The GLES backend for Zed is crashing for me under both X11 and Wayland. This has been occuring since at least https://github.com/zed-industries/zed/pull/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.

someone13574 avatar Jul 10 '24 02:07 someone13574

Zed works fine when disabling transparency: https://github.com/zed-industries/zed/issues/13734#issuecomment-2211341786

apricotbucket28 avatar Jul 17 '24 21:07 apricotbucket28

Interesting, so these attributes are incorrect

attributes.push(egl::TRANSPARENT_TYPE);
attributes.push(egl::TRANSPARENT_RGB);

kvark avatar Jul 18 '24 06:07 kvark

Just tried building Zed with the changes in #145 and it still crashes with the same error. Can this be reopened?

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/d4b395e/blade-graphics/src/gles/egl.rs:449: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/d4b395e/blade-graphics/src/gles/egl.rs:443: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

someone13574 avatar Jul 27 '24 18:07 someone13574

If you can build, it would help if you could narrow it down a bit by playing with this section

let mut attributes = vec![
            egl::RENDER_BUFFER,
            // We don't want any of the buffering done by the driver, because we
            // manage a swapchain on our side.
            // Some drivers just fail on surface creation seeing `EGL_SINGLE_BUFFER`.
            if cfg!(any(target_os = "android", target_os = "macos", windows)) {
                egl::BACK_BUFFER
            } else {
                egl::SINGLE_BUFFER
            },
        ];

        //TODO: detect if linear color space is supported
        match inner.egl.srgb_kind {
            SrgbFrameBufferKind::None => {}
            SrgbFrameBufferKind::Core | SrgbFrameBufferKind::Khr => {
                attributes.push(egl::GL_COLORSPACE);
                attributes.push(egl::GL_COLORSPACE_SRGB);
            }
        }

kvark avatar Jul 30 '24 06:07 kvark

Found this note in the documentation:

EGL_BAD_ALLOC is generated if there is already an EGLSurface associated with native_window (as a result of a previous eglCreatePlatformWindowSurface call).

So I tried to add this hotfix:

if let Some(s) = inner.swapchain.take() {
    inner.egl.instance.destroy_surface(inner.egl.display, s.surface).unwrap();
}

This helped on my PC, Zed no longer crashes.

So I guess the proper fix of this issue is implementing //TODO: remove old surface

(however, Zed uses llvmpipe instead of hardware rendering for some reason... but this is a topic for another issue)

(there is another crash BadDisplay at egl.rs:92 after closing one of multiple Zed windows, but this is probably also a topic for another issue)

andreymal avatar Nov 05 '24 13:11 andreymal

Awesome, do you want to submit a PR for this, @andreymal ?

kvark avatar Nov 06 '24 05:11 kvark

No, I actually don't know any GL

andreymal avatar Nov 06 '24 09:11 andreymal

If not a PR, could you drop a patch?

@stkw0 (Plasma Wayland) and me (Sway) are running into what seems to be the same issue on Gentoo. I seem to be able to run it through X11 by unsetting WAYLAND_DISPLAY, but he is not. I am able to run it natively on Wayland with USE=gles, but not with Vulkan. He is not able to run it on either platform, although his GPU doesn't officially support Vulkan.

I know this issue is specific to resize with GLES, although in our case the window won't even open, crashing at:

"<gpui::platform::blade::blade_renderer::BladeRenderer>::new",
"<gpui::platform::linux::wayland::window::WaylandWindowState>::new",
"<gpui::platform::linux::wayland::window::WaylandWindow>::new",
"<gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::linux::platform::LinuxClient>::open_window",
"<gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::Platform>::open_window",

Specifically, the crash is reported to come from .../blade-graphics/src/vulkan/init.rs:864, using =app-editors/zed-0.160.7-r1.

mazunki avatar Jan 02 '25 15:01 mazunki

0.160.7

@mazunki the fix is only available since 0.168 (I haven't tested it yet)

andreymal avatar Jan 02 '25 15:01 andreymal

Zed 0.168.2 with GLES doesn't start :(

{
  "thread": "main",
  "payload": "called `Result::unwrap()` on an `Err` value: BadNativeWindow",
  "location_data": {
    "file": "~/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/091a840/blade-graphics/src/gles/egl.rs",
    "line": 431
  },
  // ...
}

andreymal avatar Jan 09 '25 18:01 andreymal

I’m also seeing the BadNativeWindow on my other computer (radeon igpu + Wayland). Haven’t tested on nvidia yet.

I’ll try bisecting gpui to see how old it is. Are there any non-RT examples in this repo I could test with?

someone13574 avatar Jan 13 '25 13:01 someone13574

The issue of BadNativeWindow might be related of the usage of eglCreatePlatformWindowSurface after making a display using the MESA_platform_surfaceless extension.

There they say that function shouldn't be used, but using the default display doesn't seem to help either.

ewoudje avatar Feb 22 '25 16:02 ewoudje

Has there been any progress?

radiumatic avatar Aug 26 '25 21:08 radiumatic

The issue of BadNativeWindow might be related of the usage of eglCreatePlatformWindowSurface after making a display using the MESA_platform_surfaceless extension.

I've submitted a PR to not use the headless extension if windowed mode is requested: https://github.com/kvark/blade/pull/287

There they say that function shouldn't be used, but using the default display doesn't seem to help either.

Does using a fallback lead to same BadNativeWindow issue or it's a different one?

It appears the X11 & Wayland were specifically removed when Surface API was introduced:

Image

So, in GLES, only ANGLE (win/mac), surfaceless & default fallback are being used.

Vanuan avatar Nov 29 '25 23:11 Vanuan