gfx
gfx copied to clipboard
Strange errors GL on macOS
$ cd examples; cargo run --bin quad --features=gl
Short info header:
- GFX version: master
- OS: macOS 10.14.5 (18F203) (MacBook Pro (15-inch, 2019))
- GPU:
Radeon Pro 555X 4 GB+Intel UHD Graphics 630 1536 MB
Case 1:
GL Profiles Call Stack:
glGetIntegerv(0x000082e8, 0x7ffee333db5c)
Error: GL_INVALID_ENUM
Context: 0x7f9ae8048e00
Virtual Screen: 0/2
kCGLCPCurrentRendererID: 16915465 (0x01021c09)
GL_RENDERER: AMD Radeon Pro 555X OpenGL Engine
GL_VENDOR: ATI Technologies Inc.
GL_VERSION: 4.1 ATI-2.9.26
kCGLCPGPUFragmentProcessing: GL_TRUE
kCGLCPGPUVertexProcessing: GL_TRUE
Function call stack:
0: 0x10cd69587 in glow::native::native_gl::Gl::GetIntegerv::ha95d50fbb0e638c5 at opengl_bindings.rs: 3773
1: 0x10cdc8401 in glow::native::Context::from_loader_function::hc66bcfdf80494969 at native.rs: 30
2: 0x10cda073f in gfx_backend_gl::GlContainer::from_fn_proc::h63b0f42528e11167 at lib.rs: 73
3: 0x10cd72a57 in $LT$gfx_backend_gl..window..glutin..Surface$u20$as$u20$gfx_hal..Instance$GT$::enumerate_adapters::hd011045c10de4dd9 at glutin.rs: 169
4: 0x10c8f566a in quad::main::h9ef991850d6baccd at main.rs: 137
5: 0x10c8e6832 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h72ed3a76b7e7d2c6 at rt.rs: 64
6: 0x10cfb77a8 in std::panicking::try::do_call::h59f29fea64aa61c3 at panicking.rs: 296
7: 0x10cfba20f in _rust_maybe_catch_panic at lib.rs: 90
8: 0x10cfb827e in std::rt::lang_start_internal::h8b28a0c792d1e46f at rt.rs: 48
9: 0x10c8e6812 in std::rt::lang_start::h106170b8b1e19786 at rt.rs: 64
10: 0x10c8fb6e2 in main in <quad>
11: 0x7fff7d60f3d5 in start in <libdyld.dylib>
or
glGetIntegerv(0x000082e8, 0x7ffee333db5c)
Error: GL_INVALID_ENUM
Context: 0x7f9ae8048e00
Virtual Screen: 0/2
kCGLCPCurrentRendererID: 16915465 (0x01021c09)
GL_RENDERER: AMD Radeon Pro 555X OpenGL Engine
GL_VENDOR: ATI Technologies Inc.
GL_VERSION: 4.1 ATI-2.9.26
kCGLCPGPUFragmentProcessing: GL_TRUE
kCGLCPGPUVertexProcessing: GL_TRUE
Function call stack:
0: 0x10cd69587 in glow::native::native_gl::Gl::GetIntegerv::ha95d50fbb0e638c5 at opengl_bindings.rs: 3773
1: 0x10cdc8401 in glow::native::Context::from_loader_function::hc66bcfdf80494969 at native.rs: 30
2: 0x10cda073f in gfx_backend_gl::GlContainer::from_fn_proc::h63b0f42528e11167 at lib.rs: 73
3: 0x10cd72a57 in $LT$gfx_backend_gl..window..glutin..Surface$u20$as$u20$gfx_hal..Instance$GT$::enumerate_adapters::hd011045c10de4dd9 at glutin.rs: 169
4: 0x10c8f566a in quad::main::h9ef991850d6baccd at main.rs: 137
5: 0x10c8e6832 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h72ed3a76b7e7d2c6 at rt.rs: 64
6: 0x10cfb77a8 in std::panicking::try::do_call::h59f29fea64aa61c3 at panicking.rs: 296
7: 0x10cfba20f in _rust_maybe_catch_panic at lib.rs: 90
8: 0x10cfb827e in std::rt::lang_start_internal::h8b28a0c792d1e46f at rt.rs: 48
9: 0x10c8e6812 in std::rt::lang_start::h106170b8b1e19786 at rt.rs: 64
10: 0x10c8fb6e2 in main in <quad>
11: 0x7fff7d60f3d5 in start in <libdyld.dylib>
Error caused [here - get VENDOR string (backend/gl/src/info.rs)[https://github.com/gfx-rs/gfx/blob/master/src/backend/gl/src/info.rs#L165] because unwrap, but before it:
So only err is returning and unwrapping.
When I changed this line (info.rs:128) to monkey-fix if err != Error::NoError && value.len() == 0, so now error is gl function was not loaded with stack trace:
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:214
6: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
7: std::panicking::begin_panic
at /rustc/bc2e84ca0939b73fcf1768209044432f6a15c2e5/src/libstd/panicking.rs:411
8: glow::native::native_gl::missing_fn_panic
at /Users/ak/Developer/Projects/gfx-gl-issue-isolation/gfx/target/debug/build/glow-6949d284a225f4c1/out/opengl_bindings.rs:1528
9: glow::native::native_gl::Gl::DebugMessageCallback
at /Users/ak/Developer/Projects/gfx-gl-issue-isolation/gfx/target/debug/build/glow-6949d284a225f4c1/out/opengl_bindings.rs:3545
10: <glow::native::Context as glow::Context>::debug_message_callback
at /Users/ak/.cargo/git/checkouts/glow-0323f9242b6190b5/abc536c/src/native.rs:1615
11: <gfx_backend_gl::PhysicalDevice as gfx_hal::adapter::PhysicalDevice<gfx_backend_gl::Backend>>::open
at src/backend/gl/src/lib.rs:599
12: gfx_hal::adapter::Adapter<B>::open_with
at /Users/ak/Developer/Projects/gfx-gl-issue-isolation/gfx/src/hal/src/adapter.rs:202
13: quad::main
at examples/quad/main.rs:151
14: std::rt::lang_start::{{closure}}
at /rustc/bc2e84ca0939b73fcf1768209044432f6a15c2e5/src/libstd/rt.rs:64
15: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:49
16: std::panicking::try::do_call
at src/libstd/panicking.rs:296
17: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:82
18: std::panicking::try
at src/libstd/panicking.rs:275
19: std::panic::catch_unwind
at src/libstd/panic.rs:394
20: std::rt::lang_start_internal
at src/libstd/rt.rs:48
21: std::rt::lang_start
at /rustc/bc2e84ca0939b73fcf1768209044432f6a15c2e5/src/libstd/rt.rs:64
22: quad::main
This strange behaviour I can behaviour only with debug build. Release build works perfect works because GL has time to boot. But I don't understand it.
(Just in note. The metal backend works fine of course. But I need both.)
I can repro. Apitrace shows a bunch of errors in CGL stuff:
unsupported CGLReleasePixelFormat call unsupported CGLRetainPixelFormat call unsupported CGLReleasePixelFormat call GL_RENDERER: Intel(R) Iris(TM) Graphics 550 GL_VENDOR: Intel Inc.
I don't think the CGLRetainPixelFormat and CGLReleasePixelFormat warnings are related. I've seen them before with a different application under apitrace, and they don't seem to affect the function of the program.
I'm thinking that we should drop GL support on macOS completely, see #3468