gfx
gfx copied to clipboard
gfx-backend-gl with glutin can sometimes fail with "redraw event in non-redraw phase"
Short info header:
- GFX version: 0.5
- OS: Windows 10
- GPU: Nvidia GeForce GTX 1080
winit appears to fail occasionally on version 0.21, glutin 0.23 uses winit version 0.21, and gfx-backend-gl uses glutin 0.23.
In other words, if you have the following in your cargo.toml, you may occasionally see the error "redraw event in non-redraw phase" on windows:
gfx-backend-gl = { version = "0.5", optional = true, features = ["glutin"] }
It seems like this can be fixed with a glutin version bump.
I'm currently working around this in my own cargo.toml file with something like:
[features]
dx11 = ["gfx-backend-dx11", "winit"]
dx12 = ["gfx-backend-dx12", "winit"]
gl = ["gfx-backend-gl", "winit_gl"]
metal = ["gfx-backend-metal", "winit"]
vulkan = ["gfx-backend-vulkan", "winit"]
[dependencies]
winit = { package = "winit", version = "0.22.2", optional = true}
winit_gl = { package = "winit", version = "0.21", optional = true}
Then, in the root of my crate I have my own winit module, winit.rs with the contents:
#![cfg(any(feature = "winit", feature = "winit_gl",))]
#[cfg(feature = "winit")]
pub use winit::*;
#[cfg(feature = "winit_gl")]
pub use winit_gl::*;
Rather than use winit; throughout my project I'm doing use crate::winit;.
This fixes the problem for other platforms but gl still breaks occasionally.
We can't bump glutin dependency in the released version, since this is a breaking change.
We do update it in master though. If you can't reproduce the problem in master, it will be considered fixed.
Yep, I can check master. I forget to add this but FWIW, this is the winit PR that fixes the issue: https://github.com/rust-windowing/winit/pull/1461