Gfx: Example quad can't run under backend OPENGL

Created on 27 Jun 2018  Â·  5Comments  Â·  Source: gfx-rs/gfx

Short info header:

  • GFX version:master
  • OS: macOS 10.13.2
  • GPU:Intel Iris Pro 1536 MB
    there is some detail :
    thread 'main' panicked at 'calledOption::unwrap()on aNonevalue', libcore/option.rs:335:21 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: std::sys_common::backtrace::print at libstd/sys_common/backtrace.rs:71 at libstd/sys_common/backtrace.rs:59 2: std::panicking::default_hook::{{closure}} at libstd/panicking.rs:207 3: std::panicking::default_hook at libstd/panicking.rs:223 4: std::panicking::begin_panic at libstd/panicking.rs:402 5: std::panicking::try::do_call at libstd/panicking.rs:349 6: std::panicking::try::do_call at libstd/panicking.rs:325 7: core::ptr::drop_in_place at libcore/panicking.rs:72 8: core::ptr::drop_in_place at libcore/panicking.rs:51 9: <core::option::Option<T>>::unwrap at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:20 10: gfx_backend_gl::device::Device::combine_seperate_images_and_samplers at src/backend/gl/src/device.rs:358 11: gfx_backend_gl::device::Device::compile_shader at src/backend/gl/src/device.rs:404 12: <gfx_backend_gl::device::Device as gfx_hal::device::Device<gfx_backend_gl::Backend>>::create_graphics_pipeline::{{closure}}::{{closure}} at src/backend/gl/src/device.rs:591 13: <core::option::Option<T>>::map at /Users/travis/build/rust-lang/rust/src/libcore/option.rs:404 14: <gfx_backend_gl::device::Device as gfx_hal::device::Device<gfx_backend_gl::Backend>>::create_graphics_pipeline::{{closure}} at src/backend/gl/src/device.rs:590 15: <core::iter::FilterMap<I, F> as core::iter::iterator::Iterator>::next at /Users/travis/build/rust-lang/rust/src/libcore/iter/mod.rs:1593 16: <alloc::vec::Vec<T>>::extend_desugared at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1900 17: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1797 18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1792 19: <alloc::vec::Vec<T> as core::iter::traits::FromIterator<T>>::from_iter at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1692 20: core::iter::iterator::Iterator::collect at /Users/travis/build/rust-lang/rust/src/libcore/iter/iterator.rs:1372 21: gfx_backend_gl::device::Device::compile_shader at src/backend/gl/src/device.rs:587 22: quad::swapchain_stuff at examples/quad/main.rs:756 23: quad::main at examples/quad/main.rs:359 24: std::rt::lang_start::{{closure}} at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74 25: std::panicking::try::do_call at libstd/rt.rs:59 at libstd/panicking.rs:306 26: panic_unwind::dwarf::eh::read_encoded_pointer at libpanic_unwind/lib.rs:102 27: <std::io::Write::write_fmt::Adaptor<'a, T> as core::fmt::Write>::write_str at libstd/panicking.rs:285 at libstd/panic.rs:361 at libstd/rt.rs:58 28: std::rt::lang_start at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74 29: quad::swapchain_stuff
OpenGL easy user OSX ready for work bug high

Most helpful comment

@ZeGentzy Now It works well on my machine

All 5 comments

Now this example can run ,but it still has some wrong:

image

cc @ZeGentzy - does this ring a bell?

Hi @InMath, I'm sorry for causing these issues for you. Your old issue must've been fixed by this PR: https://github.com/gfx-rs/gfx/pull/2186. Your new one, I'm not sure.

Can you do me a couple things in the following order:

  • See if resizing the window fixes the view port. (Even if it does, continue with the following steps)
  • Apply the patch bellow and see if it fixes your problem. (Even if it does, continue with the following steps)
  • Run the program with RUST_LOG=debug RUST_BACKTRACE=1 cargo run --bin quad --features gl and post the logs somewhere.
  • Post your monitor's dpi

My apologizes for being unable to test this myself, sadly I have no access to any macs.

diff --git a/examples/quad/main.rs b/examples/quad/main.rs
index 02ae289b..c078d0c2 100644
--- a/examples/quad/main.rs
+++ b/examples/quad/main.rs
@@ -387,7 +387,6 @@ fn main() {
     //
     let mut running = true;
     let mut recreate_swapchain = false;
-    let mut first = true;
     while running {
         events_loop.poll_events(|event| {
             if let winit::Event::WindowEvent { event, .. } = event {
@@ -401,16 +400,14 @@ fn main() {
                         ..
                     }
                     | winit::WindowEvent::CloseRequested => running = false,
-                    winit::WindowEvent::Resized(_width, _height) => {
-                        if !first {
-                            recreate_swapchain = true;
-                        }
+                    winit::WindowEvent::Resized(width, height) => {
+                        println!("Gentz says: w,h = {:?} {:?}", width, height);
+                        recreate_swapchain = true;
                     }
                     _ => (),
                 }
             }
         });
-        first = false;

         if recreate_swapchain {
             device.wait_idle().unwrap();
@@ -587,6 +584,7 @@ fn swapchain_stuff(
             let window = surface.get_window();

             let window_size = window.get_inner_size().unwrap();
+            println!("Gentz says: ws = {:?}", window_size);
             let mut extent = hal::window::Extent2D { width: window_size.0, height: window_size.1 };

             extent.width = extent.width.max(caps.extents.start.width).min(caps.extents.end.width);

@InMath Feel free to reopen if the bug is still present. I've added to diffrent fixes that I'm sure probably fix it. Please report back if the OpenGL backend works on your mac.

@ZeGentzy Now It works well on my machine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kvark picture kvark  Â·  4Comments

mjadczak picture mjadczak  Â·  4Comments

kvark picture kvark  Â·  3Comments

kvark picture kvark  Â·  5Comments

Michael-Lfx picture Michael-Lfx  Â·  5Comments