Skip to content

Commit 5ecb155

Browse files
authored
change the return type of wgpuSurfacePresent to native::WGPUStatus, fixes #458 (#459)
1 parent f29ebee commit 5ecb155

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/lib.rs

+13-6
Original file line numberDiff line numberDiff line change
@@ -4004,16 +4004,23 @@ pub unsafe extern "C" fn wgpuSurfaceGetCurrentTexture(
40044004
}
40054005

40064006
#[no_mangle]
4007-
pub unsafe extern "C" fn wgpuSurfacePresent(surface: native::WGPUSurface) {
4007+
pub unsafe extern "C" fn wgpuSurfacePresent(surface: native::WGPUSurface) -> native::WGPUStatus {
40084008
let surface = surface.as_ref().expect("invalid surface");
40094009
let context = &surface.context;
40104010

4011-
match context.surface_present(surface.id) {
4012-
Ok(_status) => surface
4013-
.has_surface_presented
4014-
.store(true, atomic::Ordering::SeqCst),
4015-
Err(cause) => handle_error_fatal(cause, "wgpuSurfacePresent"),
4011+
let _status = match context.surface_present(surface.id) {
4012+
Ok(status) => status,
4013+
Err(cause) => {
4014+
log::warn!("Presentation error: {}", cause);
4015+
return native::WGPUStatus_Error;
4016+
}
40164017
};
4018+
4019+
surface
4020+
.has_surface_presented
4021+
.store(true, atomic::Ordering::SeqCst);
4022+
4023+
native::WGPUStatus_Success
40174024
}
40184025

40194026
#[no_mangle]

0 commit comments

Comments
 (0)