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

Not receiving WindowEvent::RedrawRequested after using Window to create Surface with WGPU #3495

Closed
daxpedda opened this issue Feb 16, 2024 Discussed in #3494 · 1 comment
Labels
B - bug Dang, that shouldn't have happened DS - macos

Comments

@daxpedda
Copy link
Member

Discussed in #3494

Originally posted by BernhardLThomas February 15, 2024
Hello, I've been playing around with winit and wgpu recently and I encountered an issue causing me to no longer receive WindowEvent::RedrawRequested events in the event loop.

Specifically this seems to happen as soon as I pass a reference to the Window to the Instance::create_surface method to create a surface.

I'm on MacOS with the current stable toolchain (1.76.0)

The following is a minimal example which causes the issue:

fn main() {
    let event_loop = winit::event_loop::EventLoop::new().unwrap();
    let window = winit::window::Window::new(&event_loop).unwrap();

    let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
        ..Default::default()
    });
    // this line causes the issue
    let surface = instance.create_surface(window).unwrap();

    event_loop.run(|event, elwt| match event {
        winit::event::Event::WindowEvent { window_id, event } => match event {
            winit::event::WindowEvent::CloseRequested => elwt.exit(),
            winit::event::WindowEvent::Resized(size) => {
                println!("resize: {:?}", size);
            }
            winit::event::WindowEvent::RedrawRequested => {
                println!("redraw_requested");
            }
            _ => (),
        },
        _ => (),
    });
}

Originally posted by BernhardLThomas February 15, 2024
I should clarify, manually calling Window::request_redraw will still result in a WindowEvent::RedrawRequested. What I'm not receiving is redraw requests when resizing the window or similar.

@madsmtm
Copy link
Member

madsmtm commented Sep 11, 2024

This was an issue in WGPU, and has been fixed in gfx-rs/wgpu#6107

@madsmtm madsmtm closed this as completed Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened DS - macos
Development

No branches or pull requests

2 participants