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

conrod_glium fails backend.is_current() on MacOS #1281

Closed
alberdingk-thijm opened this issue May 30, 2019 · 2 comments · Fixed by #1282
Closed

conrod_glium fails backend.is_current() on MacOS #1281

alberdingk-thijm opened this issue May 30, 2019 · 2 comments · Fixed by #1282

Comments

@alberdingk-thijm
Copy link
Contributor

alberdingk-thijm commented May 30, 2019

I get the following panic when trying to run some code that calls glium::Display::new(window, context, &events_loop) on MacOS.

thread 'main' panicked at 'assertion failed: backend.is_current()', /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:647:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   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:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:491
   5: <alloc::collections::CollectionAllocErr as core::convert::From<core::alloc::AllocErr>>::from
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:425
   6: glium::context::Context::get_version
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:647
   7: glium::context::default_debug_callback::{{closure}}
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:951
   8: glium::texture::buffer_texture::BufferTextureRef::get_texture_type
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:217
   9: glium::backend::glutin::Display::new_inner
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:115
  10: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:94
  11: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:79
  12: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/tim/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:71
  13: merx_conrod::start
             at frontends/conrod/src/main.rs:76
  14: merx_conrod::main
             at frontends/conrod/src/main.rs:232
  15: std::rt::lang_start::{{closure}}
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
  16: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
  17: panic_unwind::dwarf::eh::read_encoded_pointer
             at src/libpanic_unwind/lib.rs:102
  18: std::panicking::update_count_then_panic
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  19: std::rt::lang_start
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
  20: merx_conrod::main

This appears to be related to this issue in glium: #1721, where the solution requires changing to glium = "0.24".
Unfortunately, doing so here causes version mismatch errors, as conrod_glium uses glium = "0.23", which is what I currently have in my Cargo.toml.
Changing to 0.24 leads to a series of bounds and types errors:

error[E0277]: the trait bound `glium::backend::glutin::Display: glium::backend::Facade` is not satisfied
  --> frontends/conrod/src/main.rs:88:24
   |
88 |     let mut renderer = Renderer::new(&display.0)?;
   |                        ^^^^^^^^^^^^^ the trait `glium::backend::Facade` is not implemented for `glium::backend::glutin::Display`
   |
   = note: required by `conrod_glium::Renderer::new`

error[E0308]: mismatched types
   --> frontends/conrod/src/main.rs:186:57
    |
186 |             if let Some(event) = support::convert_event(event.clone(), &display) {
    |                                                         ^^^^^^^^^^^^^ expected enum `winit::events::Event`, found a different enum `winit::events::Event`
    |
    = note: expected type `winit::events::Event` (enum `winit::events::Event`)
               found type `winit::events::Event` (enum `winit::events::Event`)
note: Perhaps two different versions of crate `winit` are being used?
   --> frontends/conrod/src/main.rs:186:57
    |
186 |             if let Some(event) = support::convert_event(event.clone(), &display) {
    |                                                         ^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> frontends/conrod/src/main.rs:162:23
    |
162 |         renderer.fill(display, primitives.walk(), &image_map);
    |                       ^^^^^^^ expected struct `glium::backend::glutin::Display`, found a different struct `glium::backend::glutin::Display`
    |
    = note: expected type `&glium::backend::glutin::Display` (struct `glium::backend::glutin::Display`)
               found type `&glium::backend::glutin::Display` (struct `glium::backend::glutin::Display`)
note: Perhaps two different versions of crate `glium` are being used?
   --> frontends/conrod/src/main.rs:162:23
    |
162 |         renderer.fill(display, primitives.walk(), &image_map);
    |                       ^^^^^^^

error[E0271]: type mismatch resolving `<glium::texture::texture2d::Texture2d as std::ops::Deref>::Target == glium::texture::any::TextureAny`
   --> frontends/conrod/src/main.rs:162:18
    |
162 |         renderer.fill(display, primitives.walk(), &image_map);
    |                  ^^^^ expected struct `glium::texture::any::TextureAny`, found a different struct `glium::texture::any::TextureAny`
    |
    = note: expected type `glium::texture::any::TextureAny` (struct `glium::texture::any::TextureAny`)
               found type `glium::texture::any::TextureAny` (struct `glium::texture::any::TextureAny`)
note: Perhaps two different versions of crate `glium` are being used?
   --> frontends/conrod/src/main.rs:162:18
    |
162 |         renderer.fill(display, primitives.walk(), &image_map);
    |                  ^^^^
    = note: required because of the requirements on the impl of `conrod_glium::TextureDimensions` for `glium::texture::texture2d::Texture2d`

error[E0277]: the trait bound `glium::backend::glutin::Display: glium::backend::Facade` is not satisfied
   --> frontends/conrod/src/main.rs:165:18
    |
165 |         renderer.draw(display, &mut target, &image_map).unwrap();
    |                  ^^^^ the trait `glium::backend::Facade` is not implemented for `glium::backend::glutin::Display`

error[E0277]: the trait bound `glium::Frame: glium::Surface` is not satisfied
   --> frontends/conrod/src/main.rs:165:18
    |
165 |         renderer.draw(display, &mut target, &image_map).unwrap();
    |                  ^^^^ the trait `glium::Surface` is not implemented for `glium::Frame`

error[E0277]: the trait bound `for<'a> glium::uniforms::sampler::Sampler<'a, glium::texture::texture2d::Texture2d>: glium::uniforms::AsUniformValue` is not satisfied
   --> frontends/conrod/src/main.rs:165:18
    |
165 |         renderer.draw(display, &mut target, &image_map).unwrap();
    |                  ^^^^ the trait `for<'a> glium::uniforms::AsUniformValue` is not implemented for `glium::uniforms::sampler::Sampler<'a, glium::texture::texture2d::Texture2d>`
    |
    = help: the following implementations were found:
              <glium::uniforms::sampler::Sampler<'a, glium::texture::compressed_srgb_texture1d_array::CompressedSrgbTexture1dArray> as glium::uniforms::AsUniformValue>
              <glium::uniforms::sampler::Sampler<'a, glium::texture::compressed_srgb_texture3d::CompressedSrgbTexture3d> as glium::uniforms::AsUniformValue>
              <glium::uniforms::sampler::Sampler<'a, glium::texture::depth_texture1d::DepthTexture1d> as glium::uniforms::AsUniformValue>
              <glium::uniforms::sampler::Sampler<'a, glium::texture::depth_texture2d_multisample_array::DepthTexture2dMultisampleArray> as glium::uniforms::AsUniformValue>
            and 55 others

error: aborting due to 7 previous errors

Some errors occurred: E0271, E0277, E0308.
For more information about an error, try `rustc --explain E0271`.
error: Could not compile `merx_conrod`.

To learn more, run the command again with --verbose.
@alberdingk-thijm
Copy link
Contributor Author

For what it's worth, glutin 0.20 also uses winit 0.19, so that would also need to be updated.

@bugeats
Copy link

bugeats commented Jun 4, 2019

It appears there's been lot of changes in glium 0.24, including a fix for this issue. The conrod_glium backend hasn't been updated in six months (as of this writing).

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

Successfully merging a pull request may close this issue.

2 participants