-
Notifications
You must be signed in to change notification settings - Fork 948
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
Surface lags behind on window resize #3756
Comments
Found the solution: #[cfg(target_os = "macos")]
unsafe {
surface
.surface
.as_hal_mut::<wgpu_hal::api::Metal, _, _>(|surface| {
if let Some(surface) = surface {
surface.present_with_transaction = true
}
});
} |
If it's that easy, perhaps this should be available as a safe operation. Reopen this issue? |
I agree, I feel like this issue has popped up a few times over the last few versions. |
One thing I want to know is if this a problem on different platforms (also how easy it would be to fix for them). I can test on Windows 11 and maybe Linux. In terms of implementation, would it be best to have a field in the |
Another question is whether this should even be configurable, or just be the default. In other words: is there some situation where |
@Ocrap7 there are issues on other platforms as resizing is an inherently racy problem. Afaik, DXGI can't do a truly smooth resize, though you can get close. Unfortunately the solutions will likely be different on each platform as each compositor is different. |
Any update on this? #3626 removed #[allow(invalid_reference_casting)]
unsafe {
surface.as_hal::<wgpu::hal::metal::Api, _, ()>(|surface| {
if let Some(surface_ref) = surface {
// AHH! Converting '&' to '&mut'
let surface_mut = &mut *(surface_ref as *const wgpu::hal::metal::Surface as *mut wgpu::hal::metal::Surface);
surface_mut.present_with_transaction = true;
}
});
} which is obviously not ideal. 😬 |
I've improved the rendering when resizing in #6107, but using Instead of exposing this to the user, perhaps we could enable it automatically when |
Description
When resizing the window, the wpgu surface does not keep up with the size of the window. This is possibly a problem with winit instead.
Repro steps
Run any example in the wgpu/examples folder
Expected vs observed behavior
I expect the surface to resize exactly to the current window dimensions:
Screen.Recording.2023-05-07.at.1.11.19.PM.mov
But instead the surface lags behind the current window size:
Screen.Recording.2023-05-07.at.1.09.50.PM.mov
Platform
This is running on MacOS Ventura (Metal). Using wgpu on v0.16 git
I've not tested on Windows or Linux.
The text was updated successfully, but these errors were encountered: