Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fallbacking when creating context fails. #1155

Closed
sarna opened this issue May 11, 2019 · 7 comments
Closed

Fix fallbacking when creating context fails. #1155

sarna opened this issue May 11, 2019 · 7 comments

Comments

@sarna
Copy link

sarna commented May 11, 2019

Hi!

I'm getting the same error with every example I try to run. The shortest code that triggers it, after deleting a bunch of lines from the window example:

mod support;

use glutin::event::{Event, WindowEvent};
use glutin::event_loop::{ControlFlow, EventLoop};
use glutin::window::WindowBuilder;
use glutin::ContextBuilder;
use glutin::GlRequest;
use glutin::GlProfile;
use glutin::Api;

fn main() {
    let el = EventLoop::new();
    let wb = WindowBuilder::new().with_title("A fantastic window!");

    let windowed_context =
        ContextBuilder::new().with_gl(GlRequest::Specific(Api::OpenGl, (3, 2))).build_windowed(wb, &el).unwrap();
}

The error itself:

sarna@ub:~/git/glutin$ RUST_BACKTRACE=1 cargo run --example window
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/examples/window`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CreationErrors([OpenGlVersionNotSupported, OpenGlVersionNotSupported])', src/libcore/result.rs:999:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   6: rust_begin_unwind
             at src/libstd/panicking.rs:308
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::result::unwrap_failed
             at /rustc/8dd4aae9a83964cc08505da92d07ec68a3a2341d/src/libcore/macros.rs:18
   9: core::result::Result<T,E>::unwrap
             at /rustc/8dd4aae9a83964cc08505da92d07ec68a3a2341d/src/libcore/result.rs:800
  10: window::main
             at glutin_examples/examples/window.rs:16
  11: std::rt::lang_start::{{closure}}
             at /rustc/8dd4aae9a83964cc08505da92d07ec68a3a2341d/src/libstd/rt.rs:64
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:293
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:85
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:272
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  15: std::rt::lang_start
             at /rustc/8dd4aae9a83964cc08505da92d07ec68a3a2341d/src/libstd/rt.rs:64
  16: main
  17: __libc_start_main
  18: _start

Changing the profile doesn't work. Same thing happens when I request (3,2). And I'm requesting a specific API, because if I don't, I end up with (Api::OpenGlEs, None) for some reason.

My specs and more info here: ggez/ggez#626

@goddessfreya
Copy link
Contributor

goddessfreya commented May 11, 2019

Can you run a git bisect to identify the first commit to break the window example?

@felixrabe
Copy link
Contributor

felixrabe commented May 11, 2019

Some specs from the referenced issue (ggez/ggez#626):

My setup:
GPU: Nvidia GeForce GT 240
Drivers: version 340.107 from nvidia-349 (proprietary, tested)
OS: Ubuntu LTS 18.04
WM: Gnome

@goddessfreya
Copy link
Contributor

goddessfreya commented May 11, 2019

Yes, I saw. Can you run a git bisect to identify the first commit to break the window example?

https://git-scm.com/docs/git-bisect

Post the results here: https://github.com/rust-windowing/glutin#contact-us

@goddessfreya goddessfreya added this to the 0.22 milestone May 11, 2019
@goddessfreya
Copy link
Contributor

After hours of us debugging, this was tracked down to two things:

This line, which I accidentally left in and was planning to remove in my next commit:
https://github.com/rust-windowing/glutin/blob/master/glutin/src/platform_impl/unix/x11.rs#L323

And the NVIDIA proprietary driver's lack of support for EGL.

The solution is simple, either remove the line mentioned above (recommended) or switch to Nouveau.

@goddessfreya goddessfreya reopened this May 11, 2019
@goddessfreya goddessfreya changed the title OpenGlVersionNotSupported with OpenGL 3.2/3.3 Fix fallbacking when creating context fails. May 11, 2019
@goddessfreya
Copy link
Contributor

Nevertheless, the EGL fall backing code is pretty sad. In fact, I think all the impls of Latest are broken, so, yeah. Something to fix for the next release.

@goddessfreya
Copy link
Contributor

Should be noted, the original bug got fixed here: 0926279

@goddessfreya
Copy link
Contributor

goddessfreya commented Feb 16, 2020

In v0.24, you must now specify the exact version you want. Version fallbacking code is left for clients to implement. See #1271 for details on the API changes. Closing.

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

No branches or pull requests

3 participants