Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gles): support gles backend on openharmony #7085

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ jobs:
tier: 2
kind: native

# OpenHarmony
- name: OpenHarmony aarch64
os: ubuntu-22.04
target: aarch64-unknown-linux-ohos
tier: 2
kind: native

# WebGPU/WebGL
- name: WebAssembly
os: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ By @brodycj in [#6924](https://github.com/gfx-rs/wgpu/pull/6924).

- Stop naga causing undefined behavior when a ray query misses. By @Vecvec in [#6752](https://github.com/gfx-rs/wgpu/pull/6752).

#### Gles

- Support OpenHarmony render with `gles`. By @richerfu in [#7085](https://github.com/gfx-rs/wgpu/pull/7085)

#### Dx12

- Fix HLSL storage format generation. By @Vecvec in [#6993](https://github.com/gfx-rs/wgpu/pull/6993) and [#7104](https://github.com/gfx-rs/wgpu/pull/7104)
Expand Down
20 changes: 13 additions & 7 deletions wgpu-hal/src/gles/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ fn choose_config(
log::warn!("EGL says it can present to the window but not natively",);
}
// Android emulator can't natively present either.
let tier_threshold = if cfg!(target_os = "android") || cfg!(windows) {
1
} else {
2
};
let tier_threshold =
if cfg!(target_os = "android") || cfg!(windows) || cfg!(target_env = "ohos") {
1
} else {
2
};
return Ok((config, tier_max >= tier_threshold));
}
Ok(None) => {
Expand Down Expand Up @@ -956,6 +957,7 @@ impl crate::Instance for Instance {
(Rwh::Xcb(_), _) => {}
(Rwh::Win32(_), _) => {}
(Rwh::AppKit(_), _) => {}
(Rwh::OhosNdk(_), _) => {}
#[cfg(target_os = "android")]
(Rwh::AndroidNdk(handle), _) => {
let format = inner
Expand Down Expand Up @@ -1306,6 +1308,7 @@ impl crate::Surface for Surface {
(WindowKind::Unknown, Rwh::AndroidNdk(handle)) => {
handle.a_native_window.as_ptr()
}
(WindowKind::Unknown, Rwh::OhosNdk(handle)) => handle.native_window.as_ptr(),
(WindowKind::Wayland, Rwh::Wayland(handle)) => {
let library = &self.wsi.display_owner.as_ref().unwrap().library;
let wl_egl_window_create: libloading::Symbol<WlEglWindowCreateFun> =
Expand Down Expand Up @@ -1349,8 +1352,11 @@ impl crate::Surface for Surface {
// We don't want any of the buffering done by the driver, because we
// manage a swapchain on our side.
// Some drivers just fail on surface creation seeing `EGL_SINGLE_BUFFER`.
if cfg!(any(target_os = "android", target_os = "macos"))
|| cfg!(windows)
if cfg!(any(
target_os = "android",
target_os = "macos",
target_env = "ohos"
)) || cfg!(windows)
|| self.wsi.kind == WindowKind::AngleX11
{
khronos_egl::BACK_BUFFER
Expand Down