ggez: ggez doesn't work with optimus (`optirun`)

Describe the bug Ggez seems to not work on optimus systems on discrete GPU. Program fails on call ContextBuilder::build (NOTE: build don’t return error, program just fails)

To Reproduce

  1. create a simple project with this in main.rs:
fn main() {
    let cb = ggez::ContextBuilder::new("ggez_optimus", "Waffle");
    println!("before build");
    cb.build().unwrap();
    println!("after build");
}
  1. build it: cargo build
  2. run it with optirun: optirun -v target/debug/ggez_optimus the output will be like that:
[28698.115643] [INFO]Response: Yes. X is active.

[28698.115677] [INFO]Running application using virtualgl.
before build

Hardware and Software:

  • ggez version: 0.5.0-rc.2
  • OS: Arch Linux
  • Graphics card: GeForce MX150 and Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) I guess
  • Graphics card drivers: nvidia / Mesa

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 57 (4 by maintainers)

Most upvoted comments

Okay, the patch appears to work as intended. I’ll be sure to upstream it today/tomorrow. I’m back porting the commit in https://github.com/rust-windowing/glutin/pull/1199, when it’s merged and the new version is released, this should be fixed. Thanks.

Can you test mesa-git-gentz with the patch applied, with glutin but without the fix in 600030ac41abdb7a03e0ed735a179ea10e249a4f?

(gdb) run
Starting program: /home/waffle/projects/repos/reverse_cat/target/release/reverse_cat
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
error: GameError WindowCreationError(OsError("`glXQueryExtensionsString` found no glX extensions"))
Error: WindowCreationError(OsError("`glXQueryExtensionsString` found no glX extensions"))
[Inferior 1 (process 2531) exited with code 01]