Skip to content

Commit 2d8d045

Browse files
authored
wgpu-hal: add ndk-sys dependency to fix linking error. (#5326)
1 parent aaf6db6 commit 2d8d045

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ By @cwfitzgerald in [#5325](https://github.com/gfx-rs/wgpu/pull/5325).
136136
- Fix registry leaks with de-duplicated resources. By @nical in [#5244](https://github.com/gfx-rs/wgpu/pull/5244)
137137
- Fix behavior of integer `clamp` when `min` argument > `max` argument. By @cwfitzgerald in [#5300](https://github.com/gfx-rs/wgpu/pull/5300).
138138
- Fix missing validation for `Device::clear_buffer` where `offset + size buffer.size` was not checked when `size` was omitted. By @ErichDonGubler in [#5282](https://github.com/gfx-rs/wgpu/pull/5282).
139+
- Fix linking when targeting android. By @ashdnazg in [#5326](https://github.com/gfx-rs/wgpu/pull/5326).
139140

140141
#### glsl-in
141142

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wgpu-hal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ libc = "0.2"
166166

167167
[target.'cfg(target_os = "android")'.dependencies]
168168
android_system_properties = "0.1.1"
169+
ndk-sys = "0.5.0"
169170

170171
[dependencies.naga]
171172
path = "../naga"

wgpu-hal/src/gles/egl.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ type WlEglWindowResizeFun = unsafe extern "system" fn(
5050

5151
type WlEglWindowDestroyFun = unsafe extern "system" fn(window: *const raw::c_void);
5252

53-
#[cfg(target_os = "android")]
54-
extern "C" {
55-
pub fn ANativeWindow_setBuffersGeometry(
56-
window: *mut raw::c_void,
57-
width: i32,
58-
height: i32,
59-
format: i32,
60-
) -> i32;
61-
}
62-
6353
type EglLabel = *const raw::c_void;
6454

6555
#[allow(clippy::upper_case_acronyms)]
@@ -864,7 +854,12 @@ impl crate::Instance<super::Api> for Instance {
864854
.unwrap();
865855

866856
let ret = unsafe {
867-
ANativeWindow_setBuffersGeometry(handle.a_native_window.as_ptr(), 0, 0, format)
857+
ndk_sys::ANativeWindow_setBuffersGeometry(
858+
handle.a_native_window.as_ptr() as *mut ndk_sys::ANativeWindow,
859+
0,
860+
0,
861+
format,
862+
)
868863
};
869864

870865
if ret != 0 {

0 commit comments

Comments
 (0)