Skip to content

Commit a96fbec

Browse files
authored
Fix header-implementation incongruencies (#463)
1 parent 5ecb155 commit a96fbec

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/lib.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ pub unsafe extern "C" fn wgpuAdapterGetLimits(
723723
pub unsafe extern "C" fn wgpuAdapterGetInfo(
724724
adapter: native::WGPUAdapter,
725725
info: Option<&mut native::WGPUAdapterInfo>,
726-
) {
726+
) -> native::WGPUStatus {
727727
let adapter = adapter.as_ref().expect("invalid adapter");
728728
let info = info.expect("invalid return pointer \"info\"");
729729
let context = adapter.context.as_ref();
@@ -739,6 +739,8 @@ pub unsafe extern "C" fn wgpuAdapterGetInfo(
739739
info.adapterType = map_adapter_type(result.device_type);
740740
info.vendorID = result.vendor;
741741
info.deviceID = result.device;
742+
743+
native::WGPUStatus_Success
742744
}
743745

744746
#[no_mangle]
@@ -3880,7 +3882,7 @@ pub unsafe extern "C" fn wgpuSurfaceGetCapabilities(
38803882
surface: native::WGPUSurface,
38813883
adapter: native::WGPUAdapter,
38823884
capabilities: Option<&mut native::WGPUSurfaceCapabilities>,
3883-
) {
3885+
) -> native::WGPUStatus {
38843886
let (adapter_id, context) = {
38853887
let adapter = adapter.as_ref().expect("invalid adapter");
38863888
(adapter.id, &adapter.context)
@@ -3893,7 +3895,10 @@ pub unsafe extern "C" fn wgpuSurfaceGetCapabilities(
38933895
Err(
38943896
wgc::instance::GetSurfaceSupportError::FailedToRetrieveSurfaceCapabilitiesForAdapter,
38953897
) => wgt::SurfaceCapabilities::default(),
3896-
Err(cause) => handle_error_fatal(cause, "wgpuSurfaceGetCapabilities"),
3898+
Err(cause) => {
3899+
log::warn!("Surface Capabilities error: {}", cause);
3900+
return native::WGPUStatus_Error;
3901+
}
38973902
};
38983903

38993904
capabilities.usages =
@@ -3949,6 +3954,8 @@ pub unsafe extern "C" fn wgpuSurfaceGetCapabilities(
39493954
capabilities.alphaModes = std::ptr::null_mut();
39503955
capabilities.alphaModeCount = 0;
39513956
}
3957+
3958+
native::WGPUStatus_Success
39523959
}
39533960

39543961
#[no_mangle]

0 commit comments

Comments
 (0)