JFLib

plat/apple_ios_gpu.rs#

Source: lib/plat/apple_ios_gpu.rs

apple_ios_gpu -- the GPU's layer of the only window on iOS (AP6e, docs/APPLE.md): a CAMetalLayer as a
sublayer of JFView's layer (apple_ios.rs makes it and keeps it at the view's bounds and scale), above
the picture of the CPU path.  The counterpart of android_gpu.rs on Android.

  win_native(w)          the layer, shown (a program that draws its window with the GPU alone)
  win_gpu_child(w)       the layer for the UI's output, hidden until win_gpu_child_show; only window 0
                         and only while nothing else shows on the canvas (popups and tool windows are
                         composed there, below the layer)
  win_gpu_child_show     the layer shows the window, or the canvas again

A program without UIKit's host (simctl spawn, tests without a window) has no layer: None.  A scene
that is not active does no GPU work (apple_ios.rs gpu_hold: win_state says WST_HIDDEN, the output goes
back to the CPU path before iOS would refuse the command buffers of a background app).
  • struct NativeWindow the window's GPU layer (a CAMetalLayer, retained: released when this goes) and the window's size in pixels when it was taken (lib/gpu builds swapchains on a worker)

    • layer: usize
    • size: (i32, i32)
  • fn win_native(w: i32) -> Option<NativeWindow> (gpu) the window's GPU layer, shown: the GPU draws the whole window

  • fn win_gpu_child(w: i32) -> Option<NativeWindow> (gpu) the UI output's layer, hidden until win_gpu_child_show

  • fn win_gpu_child_later(w: i32) -> bool (gpu) no layer for window w now, but it may come: when the canvas shows nothing else

  • fn win_gpu_child_alone(w: i32) -> bool (gpu) the window still shows on the layer alone: nothing else came on the canvas

  • fn win_gpu_child_show(w: i32, on: bool) (gpu) the layer shows the window, or the canvas again (the frame that takes it there is whole)

  • fn win_release_kept(w: i32) (gpu) the frame is on the layer: the canvas's copy of the window goes (it comes back whole)

  • fn gpu_thread_spawn(stack: usize, f: alloc::boxed::Box<dyn FnOnce() + Send>) -> Option<crate::Thread> (gpu) a thread for the GPU output's job

  • fn gpu_out_state(_state: u32) (gpu) how the output came up: Android keeps it across runs

  • fn gpu_wait(_deadline_us: u64) (gpu) UIKit's loop calls the host's tick: nothing waits here

  • fn win_in_sizemove() -> bool (gpu) no live resize loop on iOS

  • fn win_display_adapter(_w: i32) -> Option<(u32, u32)> (gpu) one GPU on an iPhone or iPad

  • fn win_remote_session() -> bool (gpu) no remote sessions on iOS

WT_PIXEL: u32 = 1
WT_POPUP_RECT: u32 = 2
WT_MOVE: u32 = 3
WT_SHOW: u32 = 4
WT_DPI: u32 = 5
WT_REDRAW: u32 = 6
WT_NOANIM: u32 = 16
WT_FROM_POINT: u32 = 17
  • fn win_test(op: u32, _w: i32, _a: [i32; 4]) -> i64 -1: nothing to say about the pixel or the scale; 0 for the rest

  • fn win_test_image(_w: i32) -> Option<(i32, i32, Vec<u8>)>

  • fn win_test_composed(_w: i32) -> Option<(i32, i32, Vec<u8>)>

  • fn win_test_screen(_x: i32, _y: i32, _w: i32, _h: i32) -> Option<Vec<u8>>

  • fn win_test_send(_w: i32, _msg: u32, _wp: usize, _lp: isize) -> isize

  • fn gpu_test_presented() -> Vec<(u64, u64)> (bench: Wayland's presentation feedback) nothing here

Source: docs/API.md in the JFLib repository.