Open Alphapage opened 5 months ago
Initial triage: I can reproduce this on my M1 Macbook. The workaround is pretty easy, AFAICT: just request a redraw, even before the create_surface
call:
diff --git a/src/main.rs b/src/main.rs
index a260b1e..5dcfeaa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -15,9 +15,9 @@ impl ApplicationHandler for App {
let window_attributes = Window::default_attributes()
.with_title("&self.title")
.with_inner_size(winit::dpi::LogicalSize::new(800, 600));
- self.window = Some(Arc::new(
- event_loop.create_window(window_attributes).unwrap(),
- ));
+ let window = Arc::new(event_loop.create_window(window_attributes).unwrap());
+ window.request_redraw();
+ self.window = Some(window);
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default());
let surface = instance
This is an interesting intersection-of-platforms question, though. I don't see any explicit guarantees on the winit
end that a redraw request event will be emitted after its initial creation in winit
0.30.0 docs. However, it seems obvious that most upstream examples (i.e., OP's example from root module docs., pump_events
, control_flow
) actually depend on this behavior to work correctly.
I don't have the time to work out why an event's delivery to the winit::App::window_event
callback in this case, but perhaps this is a bug on our end?
Nice work around to solve the problem +1 Maybe if it is the correct behaviour, hello_world example should be updated quickly I think. Thank you very much @ErichDonGubler
Switch to winit 0.30 is inprogress over here
Hello,
I am trying to upgrade to win 0.30 without success:
If you comment the
create_surface
, then RedrawRequested is raised as expected.Am I doing something wrong with this Arc ?
Thank you in advance for your help.