From 9736439a9b356d66a6ac4093b6c5059b3e3f6a17 Mon Sep 17 00:00:00 2001 From: Elie Michel Date: Wed, 25 Sep 2024 00:09:35 +0200 Subject: [PATCH 1/2] Implement wgpuInstanceProcessEvents --- src/lib.rs | 13 +++++++++++++ src/unimplemented.rs | 5 ----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 21911150..fcbf7423 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2658,6 +2658,19 @@ pub unsafe extern "C" fn wgpuInstanceCreateSurface( })) } +#[no_mangle] +pub unsafe extern "C" fn wgpuInstanceProcessEvents(instance: native::WGPUInstance) { + let instance = instance.as_ref().expect("invalid instance"); + let context = &instance.context; + + match context.poll_all_devices(false) { + Ok(_queue_empty) => (), + Err(cause) => { + handle_error_fatal(cause, "wgpuInstanceProcessEvents"); + } + } +} + #[no_mangle] pub unsafe extern "C" fn wgpuInstanceRequestAdapter( instance: native::WGPUInstance, diff --git a/src/unimplemented.rs b/src/unimplemented.rs index f58045f8..db6f2d2f 100644 --- a/src/unimplemented.rs +++ b/src/unimplemented.rs @@ -105,11 +105,6 @@ pub extern "C" fn wgpuInstanceHasWGSLLanguageFeature( unimplemented!(); } -#[no_mangle] -pub extern "C" fn wgpuInstanceProcessEvents(_instance: native::WGPUInstance) { - unimplemented!(); -} - #[no_mangle] pub extern "C" fn wgpuPipelineLayoutSetLabel( _pipeline_layout: native::WGPUPipelineLayout, From 3a2e37a7f8584dac494bfb8224407101ea5e9c54 Mon Sep 17 00:00:00 2001 From: Elie Michel Date: Wed, 25 Sep 2024 00:12:07 +0200 Subject: [PATCH 2/2] Fix formatting --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index fcbf7423..84231f4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2662,7 +2662,7 @@ pub unsafe extern "C" fn wgpuInstanceCreateSurface( pub unsafe extern "C" fn wgpuInstanceProcessEvents(instance: native::WGPUInstance) { let instance = instance.as_ref().expect("invalid instance"); let context = &instance.context; - + match context.poll_all_devices(false) { Ok(_queue_empty) => (), Err(cause) => {