mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
[core] Do not forget to fire user callback in configure (#10686)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 file changed
+20
-23
+20
-23
@@ -1014,7 +1014,7 @@ impl Surface {
|
||||
device.check_is_valid()?;
|
||||
|
||||
let user_callbacks;
|
||||
{
|
||||
let result = {
|
||||
// we keep presentation locked for the entire duration of the configure call,
|
||||
// so that no change can happen in the middle of it.
|
||||
let mut presentation = self.presentation.lock();
|
||||
@@ -1023,33 +1023,30 @@ impl Surface {
|
||||
|
||||
let surface_raw = self.raw(device.backend()).unwrap();
|
||||
match unsafe { surface_raw.configure(device.raw(), &hal_config) } {
|
||||
Ok(()) => (),
|
||||
Err(error) => {
|
||||
return Err(match error {
|
||||
hal::SurfaceError::Outdated
|
||||
| hal::SurfaceError::Lost
|
||||
| hal::SurfaceError::Occluded
|
||||
| hal::SurfaceError::Timeout => E::InvalidSurface,
|
||||
hal::SurfaceError::Device(error) => {
|
||||
E::Device(device.handle_hal_error(error))
|
||||
}
|
||||
hal::SurfaceError::Other(message) => {
|
||||
log::error!("surface configuration failed: {message}");
|
||||
E::InvalidSurface
|
||||
}
|
||||
Ok(()) => {
|
||||
*presentation = Some(Presentation {
|
||||
device: Arc::clone(device),
|
||||
config: config.clone(),
|
||||
acquired_texture: None,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
Err(error) => Err(match error {
|
||||
hal::SurfaceError::Outdated
|
||||
| hal::SurfaceError::Lost
|
||||
| hal::SurfaceError::Occluded
|
||||
| hal::SurfaceError::Timeout => E::InvalidSurface,
|
||||
hal::SurfaceError::Device(error) => E::Device(device.handle_hal_error(error)),
|
||||
hal::SurfaceError::Other(message) => {
|
||||
log::error!("surface configuration failed: {message}");
|
||||
E::InvalidSurface
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
*presentation = Some(Presentation {
|
||||
device: Arc::clone(device),
|
||||
config: config.clone(),
|
||||
acquired_texture: None,
|
||||
});
|
||||
}
|
||||
};
|
||||
user_callbacks.fire();
|
||||
|
||||
Ok(())
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user