diff --git a/CHANGELOG.md b/CHANGELOG.md index dd5e01c5296..8b78f5c9baf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,9 @@ By @cwfitzgerald in [#5325](https://github.com/gfx-rs/wgpu/pull/5325). - Fix an issue where command encoders weren't properly freed if an error occurred during command encoding. By @ErichDonGubler in [#5251](https://github.com/gfx-rs/wgpu/pull/5251). +#### Android +- Fix linking error when targeting android without `winit`. By @ashdnazg in [#5326](https://github.com/gfx-rs/wgpu/pull/5326). + ## v0.19.2 (2024-02-29) ### Added/New Features diff --git a/Cargo.lock b/Cargo.lock index b24210301d3..42f60a97df7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4072,6 +4072,7 @@ dependencies = [ "log", "metal", "naga", + "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", "parking_lot", diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 80f28b53662..26ce5b15167 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -154,6 +154,7 @@ libc = "0.2" [target.'cfg(target_os = "android")'.dependencies] android_system_properties = "0.1.1" +ndk-sys = "0.5.0" [dependencies.naga] path = "../naga" diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index d96dcc8dbfd..8b2eb49d6ea 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -50,16 +50,6 @@ type WlEglWindowResizeFun = unsafe extern "system" fn( type WlEglWindowDestroyFun = unsafe extern "system" fn(window: *const raw::c_void); -#[cfg(target_os = "android")] -extern "C" { - pub fn ANativeWindow_setBuffersGeometry( - window: *mut raw::c_void, - width: i32, - height: i32, - format: i32, - ) -> i32; -} - type EglLabel = *const raw::c_void; #[allow(clippy::upper_case_acronyms)] @@ -863,7 +853,12 @@ impl crate::Instance for Instance { .unwrap(); let ret = unsafe { - ANativeWindow_setBuffersGeometry(handle.a_native_window.as_ptr(), 0, 0, format) + ndk_sys::ANativeWindow_setBuffersGeometry( + handle.a_native_window.as_ptr() as *mut ndk_sys::ANativeWindow, + 0, + 0, + format, + ) }; if ret != 0 {