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

Add OpenGL Support #74

Closed
osa1 opened this issue Jan 28, 2020 · 22 comments
Closed

Add OpenGL Support #74

osa1 opened this issue Jan 28, 2020 · 22 comments
Labels
enhancement New feature or request

Comments

@osa1
Copy link

osa1 commented Jan 28, 2020

Backtrace in debug build:

Xlib:  extension "NV-GLX" missing on display ":0.0".
thread 'main' panicked at 'Failed to create renderer: VkError(ERROR_INITIALIZATION_FAILED)', src/libcore/result.rs:1188:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: rust_begin_unwind
             at src/libstd/panicking.rs:375
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
  13: core::result::unwrap_failed
             at src/libcore/result.rs:1188
  14: core::result::Result<T,E>::expect
             at /rustc/0de96d37fbcc54978458c18f5067cd9817669bc8/src/libcore/result.rs:983
  15: neovide::window::ui_loop
             at src/window.rs:58
  16: neovide::main
             at src/main.rs:23
  17: std::rt::lang_start::{{closure}}
             at /rustc/0de96d37fbcc54978458c18f5067cd9817669bc8/src/libstd/rt.rs:67
  18: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  19: std::panicking::try::do_call
             at src/libstd/panicking.rs:292
  20: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  21: std::panicking::try
             at src/libstd/panicking.rs:270
  22: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  23: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  24: std::rt::lang_start
             at /rustc/0de96d37fbcc54978458c18f5067cd9817669bc8/src/libstd/rt.rs:67
  25: main
  26: __libc_start_main
  27: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@cjnucette
Copy link

I'm getting the same error:

thread 'main' panicked at 'Failed to create renderer: VkError(ERROR_INITIALIZATION_FAILED)', src/libcore/result.rs:1165:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: ::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:464
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:373
  12: rust_begin_unwind
             at src/libstd/panicking.rs:302
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:139
  14: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  15: core::result::Result::expect
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libcore/result.rs:960
  16: neovide::window::ui_loop
             at src/window.rs:58
  17: std::rt::lang_start::{{closure}}
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libstd/rt.rs:61
  18: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:48
  19: std::panicking::try::do_call
             at src/libstd/panicking.rs:287
  20: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  21: std::panicking::try
             at src/libstd/panicking.rs:265
  22: std::panic::catch_unwind
             at src/libstd/panic.rs:396
  23: std::rt::lang_start_internal
             at src/libstd/rt.rs:47
  24: main
  25: __libc_start_main
  26: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@ghost
Copy link

ghost commented Jan 28, 2020

Similar error for me

thread 'main' panicked at 'Failed to create renderer: CreateInstanceError(InstanceError(VkError(ERROR_EXTENSION_NOT_PRESENT)))', src/libcore/result.rs:1192:5
stack backtrace:
   0:     0x55fc47f81f44 - backtrace::backtrace::libunwind::trace::h1393a318dfd785ea
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x55fc47f81f44 - backtrace::backtrace::trace_unsynchronized::h001a99fe2c87221d
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x55fc47f81f44 - std::sys_common::backtrace::_print_fmt::hf769031536017ed5
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x55fc47f81f44 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he3c9e53700734965
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x55fc47fa685c - core::fmt::write::hcd08c83acba6c425
                               at src/libcore/fmt/mod.rs:1057
   5:     0x55fc47f7edc7 - std::io::Write::write_fmt::h4291e43d7b57aae6
                               at src/libstd/io/mod.rs:1426
   6:     0x55fc47f840de - std::sys_common::backtrace::_print::had5ba0d81f073d84
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x55fc47f840de - std::sys_common::backtrace::print::h83ea4480e87cfef8
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55fc47f840de - std::panicking::default_hook::{{closure}}::hd22bbc98c5f65734
                               at src/libstd/panicking.rs:195
   9:     0x55fc47f83dd1 - std::panicking::default_hook::hc01a6e6e7f1744cd
                               at src/libstd/panicking.rs:215
  10:     0x55fc47f847bb - std::panicking::rust_panic_with_hook::h38c0c004796fb7be
                               at src/libstd/panicking.rs:472
  11:     0x55fc47f8436e - rust_begin_unwind
                               at src/libstd/panicking.rs:376
  12:     0x55fc47fa47ee - core::panicking::panic_fmt::h7062b1b36f95f132
                               at src/libcore/panicking.rs:84
  13:     0x55fc47fa4877 - core::result::unwrap_failed::h5a37ed780b02bc13
                               at src/libcore/result.rs:1192
  14:     0x55fc472e5648 - core::result::Result<T,E>::expect::h2d543b2f970f659a
                               at /rustc/c5840f9d252c2f5cc16698dbf385a29c5de3ca07/src/libcore/result.rs:991
  15:     0x55fc4723fac8 - neovide::window::ui_loop::h801ff10f717c97da
                               at src/window.rs:58
  16:     0x55fc471a3e12 - neovide::main::hef39fa2f7c244171
                               at src/main.rs:23
  17:     0x55fc47250000 - std::rt::lang_start::{{closure}}::h8dc0b07e96602e84
                               at /rustc/c5840f9d252c2f5cc16698dbf385a29c5de3ca07/src/libstd/rt.rs:67
  18:     0x55fc47f84203 - std::rt::lang_start_internal::{{closure}}::h9fbdf15893927ffc
                               at src/libstd/rt.rs:52
  19:     0x55fc47f84203 - std::panicking::try::do_call::h5b4d124740b0e432
                               at src/libstd/panicking.rs:296
  20:     0x55fc47f8ca9a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:79
  21:     0x55fc47f84d10 - std::panicking::try::h926108bf724b7469
                               at src/libstd/panicking.rs:272
  22:     0x55fc47f84d10 - std::panic::catch_unwind::ha2093bad0f69c221
                               at src/libstd/panic.rs:394
  23:     0x55fc47f84d10 - std::rt::lang_start_internal::hb35b2221ef6d46d6
                               at src/libstd/rt.rs:51
  24:     0x55fc4724ffd9 - std::rt::lang_start::hd4297eb6178d06ce
                               at /rustc/c5840f9d252c2f5cc16698dbf385a29c5de3ca07/src/libstd/rt.rs:67
  25:     0x55fc471a3e4a - main
  26:     0x7fe1249c7b97 - __libc_start_main
  27:     0x55fc471a0d3a - _start
  28:                0x0 - <unknown>

Looks like there's something unstable with either our envs or the dependencies.

@Kethku
Copy link
Member

Kethku commented Jan 28, 2020

This feels like an issue with your graphics driver setup. Neovide uses vulkan which has shaky support on some systems.

A quick search shows up https://askubuntu.com/questions/67567/how-to-fix-error-xlib-extension-nv-glx-missing-on-display which seems relevant. Unfortunately I am not an expert on linux systems :(

@Kethku Kethku added the bug Something isn't working label Jan 28, 2020
@Kethku
Copy link
Member

Kethku commented Jan 28, 2020

I have some thoughts for how to abstract the renderer in order to target more systems. Thats a pretty large task however. There are a couple of avenues. Skulpin used Vulkan, but skia does support opengl so it would be interesting to try to make an equivalent library on top of opengl. Maybe extend Skulpin to support opengl via a flag... Personally I like Vulkan on windows systems because it is well supported and gives strong control over the rendering, but it seems like opengl might be more stable on linux or macos.

Like I said above though I don't have easy access to a linux box, especially not one with a modern gpu, so I would need someone to push this forward. If I can find a collaborator for this effort I will for sure help in any way I can.

@ghost
Copy link

ghost commented Jan 28, 2020

I'll try to play around with it to see what is exactly wrong. Probably old drivers, hopefully I'll get this working, for now I plan on to reinstall graphic drivers and Vulkan SDK.
I'll update you if there's any progress on this issue.

From good news: app runs perfectly fine on MacOS.

@Kethku
Copy link
Member

Kethku commented Jan 28, 2020

aclysma/skulpin#37

I have brought the issue up with the upstream skulpin library. We'll see

@ghost
Copy link

ghost commented Jan 28, 2020

For my case it's clear - hardware does not support Vulkan at all.
You can check your hardware on this page (if its Intels') - list of supported Intel APIs.

It may also be the case for you guys since looks like skuplin will try to run on your integrated graphics card (if I'm not mistaken):

   // window.rs # 58
    let mut skulpin_renderer = RendererBuilder::new()
        .prefer_integrated_gpu()

@cjnucette
Copy link

I think that's the case. My gpu is not supported either.

@Kethku
Copy link
Member

Kethku commented Jan 28, 2020

Yes I set the app to prefer the integrated gpu, but it should fallback to the discrete if it doesn't work.

I think the long term solution is to add opengl support. Which will likely take some time. Like I said above, I would love some help in this area.

@Kethku Kethku added enhancement New feature or request and removed bug Something isn't working labels Feb 1, 2020
@Kethku Kethku changed the title [Linux] "Failed to create renderer" on laptop with multiple GPUs Add OpenGL Support Feb 1, 2020
@Kethku
Copy link
Member

Kethku commented Feb 1, 2020

Upstream opengl support tracked here: aclysma/skulpin#37. Its going to be a while before I can go tackle this. So if somebody wants to take it up that would be great.

@rainerborene
Copy link

I had the same issue described here, and got it working after installing a few packages:

$ sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-utils 

This should work on most Ubuntu-based distributions

@Kethku
Copy link
Member

Kethku commented Mar 13, 2020

Thanks for the suggestion! I will add it to the readme

@max-lv
Copy link

max-lv commented Jun 15, 2020

I had similar error:

thread 'main' panicked at 'Failed to create renderer: VkError(ERROR_INITIALIZATION
_FAILED)', src/window.rs:149:13

And just as @rainerborene, I've solved this by installing vulkan drivers.

My system is:

$ uname -srvmpio
Linux 5.6.15-1-MANJARO #1 SMP PREEMPT Wed May 27 20:38:56 UTC 2020 x86_64 unknown unknown GNU/Linux

and CPU is Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz

I've installed vulkan drivers via:

$ sudo pacman -S vulkan-intel

After that neovide worked immediately without reboot.

@pickfire
Copy link

@max-lv Vulkan is not supported on older devices.

$ uname -a
Linux arch 5.7.2-zen1-1-zen #1 ZEN SMP PREEMPT Wed, 10 Jun 2020 20:36:27 +0000 x86_64 GNU/Linux

I already have vulkan-intel installed and my CPU is Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz.

@j4qfrost
Copy link
Contributor

@pickfire So does neovide work for you or does it not?

@pickfire
Copy link

No, I failed to build from source with some SDL linking issue but I guess the build won't work too since vulkan does not work on my device.

@j4qfrost
Copy link
Contributor

Your system looks more than capable of running Vulkan, though you haven't provided your GPU or the linking error. Arch Linux has a fairly high curve for setting up Vulkan, since there are several different packages you need to install.

@pickfire
Copy link

> lspci | grep -i --color 'vga\|3d\|2d'
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
> ls /usr/share/vulkan/icd.d/
intel_icd.i686.json  intel_icd.x86_64.json
> vulkaninfo
ERROR: [Loader Message] Code 0 : /usr/lib32/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.2.140/vulkaninfo/vulkaninfo.h:240:vkEnumerateInstanceExtensionProperties failed with ERROR_INITIALIZATION_FAILED

Intel HD Graphics 3000

@j4qfrost
Copy link
Contributor

j4qfrost commented Jun 17, 2020

Do you mean this linking issue? #306

Edit: yeah I think it might be a gpu problem. https://www.intel.com/content/www/us/en/support/articles/000005524/graphics.html

@pickfire
Copy link

@j4qfrost Probably, I build from 4643464. Yes, I checked the gpuinfo from arch wiki link also didn't found anything related to Intel HD Graphics 3000.

@JSamir
Copy link

JSamir commented Jan 23, 2021

Does not work on Arch within a vmware workstation player 16 VM too. Not sure if it's because of Arch or the fact that it's running in a VM though.

@Kethku
Copy link
Member

Kethku commented Apr 8, 2021

superseded by #491

@Kethku Kethku closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants