tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.58k stars 2.36k forks source link

[bug] Inconsistent render order #10155

Open johanholmerin opened 5 days ago

johanholmerin commented 5 days ago

Describe the bug

I'm trying to render a transparent tauri webview on top of wgpu but I'm running into some inconsistencies between platforms. On macOS everything works correctly, but on iOS the wgpu surface is rendered on top of the the webview instead. I'm not sure which is the correct behavior but that it differs between targets seems like a bug to me.

Reproduction

https://github.com/johanholmerin/tauri-v2-wgpu/tree/mobile

Compare cargo tauri dev and cargo tauri ios dev

Expected behavior

macOS: macos

iOS:

(webview is rendered underneath wgpu) ios

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.12.2
    - pnpm: 8.6.12
    - yarn: 1.22.22
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: build
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Stack trace

No response

Additional context

No response

amrbashir commented 3 days ago

The macOS behavior is the correct one. That's probably because we add the webview as a subview on top of the window contentView (Idk if that makes sense, I am not a macOS developer) but we don't do the same on iOS? this is the related code: https://github.com/tauri-apps/wry/blob/39fc82c9276bd039a9130919645db149f067719a/src/wkwebview/mod.rs#L1007-L1054