Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27694243f2 | ||
|
|
e6c00ec4b8 | ||
|
|
2480d203ec | ||
|
|
c4983b6e18 | ||
|
|
13736d2524 | ||
|
|
a069c79c73 | ||
|
|
9ee9355348 | ||
|
|
0a2dbc3140 | ||
|
|
f7108c0ca4 | ||
|
|
21d72e51ef | ||
|
|
222633e462 | ||
|
|
f64c93b338 | ||
|
|
429899d6fc | ||
|
|
f1486609ab | ||
|
|
e35170d4f9 | ||
|
|
80a5c0b6d6 | ||
|
|
63f0125954 | ||
|
|
5e7c07c98e | ||
|
|
00d2b3bf6b | ||
|
|
02c697c2f0 | ||
|
|
511051952c | ||
|
|
dce2362cbb | ||
|
|
6782ace43d | ||
|
|
71447c932f | ||
|
|
45bcc76436 | ||
|
|
1a6c3321a1 | ||
|
|
b21ef9ece6 | ||
|
|
9b3c3b330a | ||
|
|
46d8c5c379 | ||
|
|
76542b53e5 | ||
|
|
088dac8fb6 | ||
|
|
4a511ca6e3 | ||
|
|
35da9c569a | ||
|
|
dec7b2a9ec | ||
|
|
ba1ed72a55 | ||
|
|
ba2ddef525 | ||
|
|
b20591540b | ||
|
|
f3dee5425e | ||
|
|
676b025c5b | ||
|
|
fac72d17c8 | ||
|
|
a2fa6021f5 | ||
|
|
c492e662cb | ||
|
|
ce803340b0 | ||
|
|
4be34d20ca | ||
|
|
a4e8e20fcd | ||
|
|
fc1bee2673 | ||
|
|
ad8847509b | ||
|
|
627c05bf98 | ||
|
|
b82b714165 | ||
|
|
0bfdfbd0e8 | ||
|
|
19addc1570 | ||
|
|
1f35c77a69 | ||
|
|
5973b6c85c | ||
|
|
d74dc1aa61 | ||
|
|
7b14207f81 |
No files matched your search
@@ -159,6 +159,12 @@ jobs:
|
||||
merge-multiple: true
|
||||
- name: Wheel (CLI install via uv tool / pipx / pip, and its self-update)
|
||||
run: uv build --wheel -o out && ls out
|
||||
- name: Videos (docs/media, rendered by the showcase workflow; frameport-<name>.mp4 → FramePort-<name>.mp4)
|
||||
run: |
|
||||
for f in docs/media/frameport-*.mp4; do
|
||||
[ -f "$f" ] || continue
|
||||
n=$(basename "$f" .mp4); cp "$f" "out/FramePort-${n#frameport-}.mp4"
|
||||
done
|
||||
- name: Checksums
|
||||
run: cd out && sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt
|
||||
- name: Publish release
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
name: showcase
|
||||
# Docs screenshots and the videos (the demo tour, the install tutorial, …), rendered from the demo library
|
||||
# (docs/showcase/, scripts/showcase/; see docs/SHOWCASE.md). Opens or updates one pull request (branch
|
||||
# showcase/update) when a picture really changed; the renders are also kept as a workflow artifact either way.
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
videos:
|
||||
description: "Videos to record too: names from docs/showcase/videos (e.g. tour install), all, or empty"
|
||||
type: string
|
||||
default: ""
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/frameport/ui/**"
|
||||
- "src/frameport/locales/**"
|
||||
- "docs/showcase/**"
|
||||
- "scripts/showcase/**"
|
||||
|
||||
concurrency:
|
||||
group: showcase-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
render:
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
PYTHONUTF8: "1"
|
||||
PYTHONIOENCODING: utf-8
|
||||
TZ: UTC
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0 # the push's changed files decide whether the video is recorded again
|
||||
- uses: astral-sh/setup-uv@v10.2.0
|
||||
- name: ffmpeg and fonts
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg fonts-roboto fonts-noto-color-emoji
|
||||
- run: uv sync --extra dev --python 3.12 # the Python the renders are made with locally
|
||||
- name: Chromium for Playwright
|
||||
run: uv run playwright install --with-deps chromium
|
||||
- name: Store art cache (fetched once from the stores the app uses)
|
||||
uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: ~/.cache/frameport-showcase
|
||||
key: showcase-art-${{ hashFiles('docs/showcase/demo-library.yaml') }}
|
||||
restore-keys: showcase-art-
|
||||
|
||||
- name: Docs screenshots
|
||||
run: uv run python scripts/showcase/render_docs.py --keep showcase-out/screenshots
|
||||
|
||||
- name: Videos
|
||||
# a push records the videos whose storyboard (docs/showcase/videos/<name>.yaml) changed, or all of them when
|
||||
# the recorder changed (UI tweaks alone don't re-record ~10 MB files); Run workflow records what it's asked
|
||||
env:
|
||||
INPUT_VIDEOS: ${{ inputs.videos }}
|
||||
BEFORE: ${{ github.event.before }}
|
||||
run: |
|
||||
if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
|
||||
read -ra names <<< "$INPUT_VIDEOS"
|
||||
if [ ${#names[@]} -eq 0 ]; then echo "no videos asked for"; exit 0; fi
|
||||
[ "${names[0]}" = all ] && names=()
|
||||
uv run python scripts/showcase/record_video.py "${names[@]}" --work showcase-out/videos
|
||||
else
|
||||
uv run python scripts/showcase/record_video.py --changed-since "$BEFORE" --work showcase-out/videos
|
||||
fi
|
||||
|
||||
- name: Keep the renders
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: showcase
|
||||
path: |
|
||||
showcase-out/screenshots
|
||||
showcase-out/videos/*/video.json
|
||||
docs/media
|
||||
docs/images/tour-teaser.webp
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- name: What changed
|
||||
id: diff
|
||||
run: |
|
||||
git status --short -- docs/images docs/media
|
||||
if [ -n "$(git status --porcelain -- docs/images docs/media)" ]; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"; fi
|
||||
- name: Pull request
|
||||
if: steps.diff.outputs.changed == 'true' && github.ref == 'refs/heads/main'
|
||||
uses: peter-evans/create-pull-request@v8.1.1
|
||||
with:
|
||||
branch: showcase/update
|
||||
delete-branch: true
|
||||
add-paths: |
|
||||
docs/images/*
|
||||
docs/media/*
|
||||
commit-message: "Docs: update screenshots and videos"
|
||||
title: "Update docs screenshots and videos"
|
||||
body: |
|
||||
Rendered by the `showcase` workflow from the demo library (docs/showcase/demo-library.yaml) with a
|
||||
pretend Frame: only pictures that visibly changed are included. Look them over before merging (the
|
||||
run's `showcase` artifact has every render).
|
||||
|
||||
Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
@@ -10,8 +10,20 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
## Layout
|
||||
- `src/frameport/` — Python package. `pipeline.py` is the API the CLI (`cli.py`) and GUI (`ui/`, Flet 1.0) share.
|
||||
- `ui/` — `app.py` shell (sidebar with Frame connection + activity cards, routing, actions, 30 s connection poll),
|
||||
`theme.py` (dark design tokens; change colours/spacing only there), `components.py` (pill, card, callout,
|
||||
status_row, art_fill, confirm, `update()` = safe update: in Flet 1.0 reading `.page` of an unmounted control
|
||||
`theme.py` (design tokens; change colours/spacing only there. Dark-only colour themes (owner: no light mode):
|
||||
built-ins `portal` (default), `portal_oled` (true black) and `original` (the old violet; alias `classic`). Portal =
|
||||
the logo's dichotomy: orange ACCENT = main action + selection, blue SECONDARY = secondary (outlined) buttons,
|
||||
progress, switch tracks, PC; `dual` themes add the blue→orange sidebar edge, two-colour wordmark (`C.wordmark`) and
|
||||
selected-tab fade (`C.portal_gradient`). Installable theme files `<data>/themes/*.json` (docs/THEMES.md: name,
|
||||
base, dual, any subset of `T.TOKENS`; refused if light/unreadable, `T.ThemeError`), Settings → Appearance: cards
|
||||
switch live via `app.restyle()` (rebuilds the shell, drops cached views; setting `ui.theme`), "Install theme
|
||||
file…", "Copy this theme as a file", bin icon removes. Read tokens as `T.NAME` when building — never as a default argument or module-level constant (they
|
||||
keep the import-time theme; module maps refill through `T.on_change`, `tests/test_theme.py` checks defaults)),
|
||||
`glyphs.py` + `icons/` (the logo `logo.svg`/`logo-solid.svg` = a monitor that comes out of a tilted portal as the
|
||||
Frame, and 24 px line glyphs `fp:frame|port|patch|container|test|pc|sync|live|shot|keys|recipe|link`, copied into
|
||||
the assets dir and shown as tinted `ft.Image`s: pass `G.FRAME` … wherever an icon goes, `C.as_icon` / the button
|
||||
helpers handle both kinds; `src/assets/icon.png` = the bundles' app icon), `components.py` (pill, card, callout,
|
||||
checklist, art_fill, confirm, `update()` = safe update: in Flet 1.0 reading `.page` of an unmounted control
|
||||
raises), `jobs.py` (background FIFO job queue, one at a time, cancel via Reporter; no Flet), `views/`
|
||||
(library: search/filters/tags/sort as pure tested helpers; game: hero + one-click install, patches under
|
||||
"Customize"; frame: device + readiness + installed, or connect wizard; files: the Frame's file manager (persistent
|
||||
@@ -26,7 +38,8 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
launch.sh logs `start/end <unix>` to `<anchor>/plays.log` (upgrade_launchers adds it; Proton launchers exec → start
|
||||
only) and shots are matched by time; thumbnails cached in `<data>/screenshots-cache/<frame>/`, shown by asset URL;
|
||||
delete leaves screenshots.vdf alone (Steam rewrites it at exit); game menu → "Screenshots" = `go("screenshots",
|
||||
pkg)`); live view (`views/live.py` + `install/livestream.py`: the Frame's built-in SteamVR "headset view" webcam
|
||||
pkg)`; Copy image (card hover button, right-click, viewer) = `core/clipboard.copy_image` (Windows/WSL: PowerShell
|
||||
bitmap + file via %TEMP%, macOS osascript PNG, Linux wl-copy/xclip; Flet's set_image only in web mode)); live view (`views/live.py` + `install/livestream.py`: the Frame's built-in SteamVR "headset view" webcam
|
||||
(`steamvr-v4l2cam.service` → v4l2loopback "SteamVR" /dev/video99, see docs/FRAME_RUNTIME.md) + the default
|
||||
output's pulse monitor (sound) → `fp_venc` (`native/venc`, own clean-room V4L2 driver of the Frame's iris
|
||||
hardware encoder: RGB24→NV12 box downscale with NEON, H.264 CBR, one frame per slot of an even fraction of the
|
||||
@@ -53,7 +66,36 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
await a FilePicker) must be coroutine functions or go through `page.run_task`: Flet doesn't await a lambda's
|
||||
coroutine (the Files row Download button silently did nothing). `ui_smoke.py --fake-frame --gestures` drives real
|
||||
mouse drags/right-clicks.
|
||||
Live Frame data comes from one app-owned `app.monitor_hub` (`frame/monitor_hub.py`): subscribers name modules +
|
||||
interval, the hub runs one agent `_monitor` stream (union of modules, fastest interval; per-module collection
|
||||
needs agent v65), reconnects after a lost stream and stops it when nobody subscribes; `_poll` retries an "error".
|
||||
Subscribers: "monitor" (the Monitor tab, everything, only while shown) and "card" = the sidebar's live Frame card
|
||||
(`ui/frame_card.py` helpers: battery ring, "now playing" row with fps + 2-min sparkline → click opens Monitor;
|
||||
games + battery every 5 s, paused while a job's stage is "Upload…", only while connected and setting
|
||||
`ui.live_frame_card` (Settings → Appearance, default on) is on; else the battery comes from the 30 s poll).
|
||||
ui_smoke injects `FakeMonitorSession` as the hub's `session_factory`.
|
||||
User tags live in library entries (`tags`), filters in library setting `ui.library`.
|
||||
Easter eggs (`ui/easter.py`, owner's wish; never mentioned in the UI or docs): seven quick clicks on the sidebar
|
||||
logo (the *wordmark's* portal glows + rings, a cover is tossed out of it and falls across the window on a random
|
||||
arc: `toss_path`, `page.overlay` at the computed window position `_wordmark_portal`; the logo's portal in
|
||||
themes without one), the Monitor's fps number has a mood tooltip (above the number, clear of the pointer) and
|
||||
2.5 minutes within 0.5 fps of target (`PERFECT_SECONDS`) make the game card glow and pulse blue/orange for 5 s,
|
||||
the number grow in the portal gradient and the sparkline take it; the "Perfect pacing" pill + line stay until the
|
||||
rate slips (`PerfectPacing.done`, `_show_perfect`, `Sparkline.portal`), holiday badges on the logo that dance on
|
||||
hover and shower the window on click (`HOLIDAY_MOTION`; `SHOWERS`/`shower_plan`: New Year confetti, winter snow,
|
||||
Valentine hearts, Pi digits, clovers, hopping eggs, bouncing pumpkins; `holiday`: Valentine's
|
||||
heart, Pi Day, St Patrick's clover, Easter Sat-Mon egg (computus), April 1 = the logo upside down until hovered,
|
||||
Halloween pumpkin, Dec 31-Jan 1 party popper, else Dec 20-Jan 2 snowflake; on those days the logo's box grows to
|
||||
hold the badge: Flutter only hit-tests inside a control's bounds; `FRAMEPORT_TODAY` pretends a date),
|
||||
Library search "frameport" (logo spins, "That's me!"), Type on Frame "hello" (keys still go to the Frame; a
|
||||
headset peeks up from the window's corner and waves), the battery ring (only the ring, with a glow behind
|
||||
it; not the percentage) pulses on reaching 100 % plugged (`charged_now`, `ring_pulse`, `ring_glow`), a long upload (>2.5 min, `HOP_AFTER`) makes the transit cover hop, the Live view
|
||||
tab shows a blinking ON AIR sign while streaming
|
||||
(`app.sync_on_air`), install milestones (confetti +
|
||||
message at the 1st/10th/100th *different* game: settings `fun.installed` = game ids, `fun.milestones` = shown;
|
||||
each milestone shows once ever, recorded before it's shown; updates/reinstalls never count; the first use seeds
|
||||
from games already on a Frame and marks passed milestones shown). Setting `ui.easter_eggs` (no UI) turns them
|
||||
off; the showcase demo library has them off (steps hook `easter_eggs` for egg demos). Reduce motion: no animation.
|
||||
**Performance rules** (the app froze before): never put image bytes in controls — artwork is served by URL from the
|
||||
GUI assets dir (= user data dir; `ft.run(assets_dir=…)`), as thumbnails (`artwork/thumbs.py`, Pillow); the
|
||||
library view is persistent, streams cards in batches from a background thread and filters by toggling visibility;
|
||||
@@ -61,10 +103,31 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
**Never recreate clickable controls on progress ticks** (sidebar, activity tiles): update their properties —
|
||||
replacing them 5×/s swallowed clicks (couldn't leave the Library during an upload).
|
||||
Labelled switches: `C.switch(label, …)` (Material's default label colour is dark on our dark theme).
|
||||
Cover cards (Library grid + shelf): `library.card_hover`/`hover_motion` (lift, art zoom inside the clipped frame,
|
||||
radial `scrim`, accent-tinted shadow) and `C.CoverButton` (frosted round button, accent under the pointer; Play =
|
||||
blue then orange ring ripple + "Starting on Frame…" pill for STARTING_S; its `.status` layer must sit *below*
|
||||
the button in the Stack, else it takes the clicks); the game page's Play turns into "Starting on …" with a spinner
|
||||
(`GameView._starting`). Reduce motion: no lift/zoom/rings. Filled buttons use a glyph's `-solid` variant
|
||||
(`glyphs.solid`, e.g. `frame-solid.svg`: the outline glyph faded into the orange).
|
||||
Empty states (`C.empty_state(..., features=[(icon, heading, sentence)])`): with features the portal is bigger, a
|
||||
soft portal light (`C.portal_glow`) fills the screen and `C.feature_row` says what the screen will show (the
|
||||
not-connected Files/Screenshots/Live/Type/Monitor tabs and the empty Library); the idle Live view is a framed
|
||||
"screen" with its own Start button + `live_features()`, Type on Frame shows `keyboard_tips()` under the box.
|
||||
Setup checklists (Frame → Ready to play, Settings → Tools / This PC) = `C.checklist([C.Check(ok, title, detail,
|
||||
help, fix=(label, icon, handler), extra=control)])`: ok True/False/"warn"/None (= spinner); the fix button shows
|
||||
inline only while an item isn't ready — wire existing actions only. Motion: `app.body` holds an
|
||||
`ft.AnimatedSwitcher` (`app._show_view`): a new route gets a new wrapper (150 ms fade), a same-route redraw swaps
|
||||
the wrapper's content (no animation; persistent views just remount); the wordmark's portal (`wordmark().data`)
|
||||
pulses once when frame_state turns "connected"; both off with setting `ui.reduce_motion` (Settings → Appearance
|
||||
"Reduce motion", `app.reduce_motion`). Settings has a fixed index column (`settings.SECTIONS` order, Appearance
|
||||
first, Remove FramePort last): entries scroll the section column via `scroll_to(scroll_key=…)` (sections wrapped
|
||||
in Containers with `ft.ScrollKey`), the header stays; `app.settings_view.show_section(key)` (ui_smoke
|
||||
`settings-index`).
|
||||
Help hints: wording for non-obvious terms lives in `ui/help.py` (`HELP`); show it with `C.help_icon(key)` or the
|
||||
`help=` argument of `section`/`status_row`/`kv`, tooltips via `C.tip()` (wraps). Game actions for the Library
|
||||
right-click menu (one `ft.ContextMenu` around the grid, filled on right-click) and the game page's "…" menu come
|
||||
from `app.game_actions()`. Picking art (`sources.apply_choice`) downloads into a staging dir and keeps the old
|
||||
`help=` argument of `section`/`kv` (`C.Check` help key), tooltips via `C.tip()` (wraps). Game actions for the Library
|
||||
right-click menu (one `ft.ContextMenu` around the grid, filled on right-click; short: `menus.quick_menu`, key actions
|
||||
+ "More actions…" = the game page with its full "…" menu opened from code, `app.open_game_menu`) and the game
|
||||
page's "…" menu (`menus.menu_sections` quick=False, sectioned) come from `app.game_actions()`. Picking art (`sources.apply_choice`) downloads into a staging dir and keeps the old
|
||||
art if nothing came back; "Update Steam art on Frame" re-sends the art set to the game's anchor (agent ≥ 12).
|
||||
Patch descriptions/reasons describe the general case, naming games only as "e.g. …".
|
||||
- Installs: queued/cancelled/failed ones are remembered (library setting `ui.installs`) → Library "Resume" bar;
|
||||
@@ -91,11 +154,7 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
doesn't do). `VD.bat` is Virtual Desktop's launcher: ignore it except as an exe-location hint. Library migration
|
||||
`rift_run_direct` resets existing recipes.
|
||||
Auto launch-test is skipped on PC installs (it would start the game on the user's desktop). Launch tests collect the Unreal
|
||||
game log + crash summaries from the Proton prefix; triage `unreal-crash`. Agent v67 adds Unity's logs (LocalLow/<Company>/<Product>/Player(-prev).log via `<Name>_Data/app.info`,
|
||||
`output_log.txt`, Temp/…/Crashes/*/error.log; `unity_logs`) to launch tests and diagnostics; triage `unity-vr-init` /
|
||||
`unity-crash`. A catalog recipe verified with another build (catalog `xr` ≠ the build's) keeps the build's own
|
||||
`pcvr.launch_args` (`engine._other_build`; GitHub #105: SUPERHOT VR's Oculus+OpenVR build needs `-vrmode OpenVR`,
|
||||
the catalog's is the OpenXR build); Electron launchers next to a game rank −30 (`rift.is_electron`). Lies Beneath via Proton without Revive
|
||||
game log + crash summaries from the Proton prefix; triage `unreal-crash`. Lies Beneath via Proton without Revive
|
||||
crashed (UE 4.23 "Unhandled exception").
|
||||
- Rift scanning: `sources/rift_dump.scan` = the scanned folder's subfolders are games (one per folder; a folder is a
|
||||
game if all candidate exes sit under one child), recursing into collections; `analysis/rift.py` walks once,
|
||||
@@ -201,9 +260,15 @@ Rick and Morty runs on the Frame via its catalog recipe (OpenVR, no Revive),
|
||||
signed, `ready.json`); `apply()` writes + starts detached `apply.ps1`/`apply.sh` (wait for pid → Windows: copy over,
|
||||
replaced files kept in `updates/<ver>/previous` because the zip has no top folder; macOS/Linux: mv to `.old` + swap,
|
||||
rollback, `xattr -dr` quarantine → relaunch; `<data>/logs/update.log`). `ui/updater.py`: background check (10 s,
|
||||
then 6 h), sidebar card (hidden control, toggled), Library bar (`library_bar`), notes dialog (`ft.Markdown`), job
|
||||
then 6 h), sidebar card (hidden control, toggled), Library bar (`library_bar`), changelog dialog, job
|
||||
`app-update` that restarts only when no other job is active, `apply_pending_at_start()` in `main()` for
|
||||
"Install updates automatically"; Settings → Updates. CLI: `--version`, `frameport update [--check (exit 10)]
|
||||
"Install updates automatically"; Settings → Updates. Changelog: `updates.fetch_changelog` (releases list,
|
||||
`app-releases.json`, same 6 h cache, offline → cached / []) → `ChangelogEntry` (`whats_new()` keeps only the tag
|
||||
message's "What's new" part: CI's intro, update hint and release-footer.md stripped); `between`/`changelog_for`
|
||||
(installed < v ≤ offered, dev entry only when on/choosing dev, skipped versions included), `recent_history`;
|
||||
the update/dev dialogs show one collapsible section per version (`_changes_column`, newest open); after an update
|
||||
`pending_news` (setting `update.last_seen_version`; first start only records it; offline → retried next start)
|
||||
→ Library "was updated" bar → "See what's new…"; Settings → Updates "What's new…" = recent history. CLI: `--version`, `frameport update [--check (exit 10)]
|
||||
[--yes]`, once-a-day stderr hint read from the cache only (`refresh_cache()` in a daemon thread writes no
|
||||
settings, to avoid read-modify-write races). `scripts/update_smoke.py <archive>` runs the real extract + swap script
|
||||
(no relaunch) — CI runs it on all three OS with the archive it just built.
|
||||
@@ -237,11 +302,19 @@ Repo is on an NTFS drive (`core.fileMode=false`); line endings are LF (`.gitattr
|
||||
artwork, frames.json, the app's SSH key which the dev Frame authorizes).
|
||||
- Device checks: `frameport test <pkg>` / `frameport parity-device --results <parity.json> --baseline <launch.txt>
|
||||
[--test-only]`; the pre-FramePort baseline is `PATCHED/_known-good-2026-09-28/_frame-state/baseline-launch.txt`.
|
||||
- Docs screenshots (`docs/images/`): `python scripts/scrub_library.py ~/.local/share/frameport <dir> --status works,issues` (copies
|
||||
library + artwork only; titles replace folder names, local paths → `D:/Games/...`, sort by size) then
|
||||
`FRAMEPORT_HOME=<dir> python scripts/ui_smoke.py --out <shots> --docs --fake-frame --game <pkg>` (set
|
||||
FRAMEPORT_JAVA/_OVERPORT_JAR/_APKSIGNER_JAR so no tool download toast appears; `--viewport 1280x2600` + crop for the
|
||||
patch list). Check every PNG for paths, IPs, user names and repack/scene names before committing.
|
||||
- Docs screenshots + videos (docs/SHOWCASE.md): never by hand. `uv run python scripts/showcase/render_docs.py`
|
||||
renders `docs/showcase/shots.yaml` into `docs/images/` (every shot twice, kept when both agree; only visibly changed
|
||||
files are rewritten; `--check` for CI) and `scripts/showcase/record_video.py [names] [--draft]` records the
|
||||
storyboards `docs/showcase/videos/<name>.yaml` (tour = FramePort in use + README teaser; install = the install
|
||||
tutorial: instruction cards for the download / the command on the Frame, the rest filmed from a first start) into
|
||||
`docs/media/frameport-<name>.mp4`. Both build the demo library first (`demo_home.py`, profile `demo` or `fresh`:
|
||||
catalog games from `demo-library.yaml` + `demo-analyses.json`, art/details cached in ~/.cache/frameport-showcase, a
|
||||
pretend Frame from `showcase-frame.json`) in a temp FRAMEPORT_HOME: no personal data, refuses the real data dir
|
||||
and placeholder art; discovery is off and the setup command shows placeholders for the address and code. Steps find elements
|
||||
by name through Flutter's semantics tree (`scripts/showcase/web.py`: text, tooltip; the innermost match wins) —
|
||||
give new icon-only controls a tooltip. The `showcase` workflow renders on UI pushes to main (+ the videos whose
|
||||
storyboard changed, or the ones named on dispatch) and opens PR `showcase/update`; releases attach every video as
|
||||
`FramePort-<name>.mp4`. `scripts/scrub_library.py` (the owner's own library) is only for private screenshots now.
|
||||
README rules (owner): states the project is a proof of concept, provides no piracy tools, credits the wrapped
|
||||
projects (most functionality is theirs); neutral technical wording; no Quest2Frame mentions anywhere.
|
||||
- GUI smoke test: `uv pip install flet-web playwright && playwright install chromium`, then
|
||||
@@ -307,7 +380,10 @@ The Frame runs firewalld (22 and 32000 open). PC side: the setup server needs in
|
||||
firewall blocks it silently (`DefaultInboundAction Block`): `pairing.ensure_reachable` adds a temporary rule via one
|
||||
UAC prompt, removed when the server stops (flag file in %TEMP%, max 35 min); hints per OS after 45 s without a request
|
||||
(`pairing.firewall_hint`). Flet 1.0 patches aren't thread-safe → `app.serialize_flet_updates()` (a dialog shown while a
|
||||
scan redraw ran never closed: "dropped a patch for unknown control").
|
||||
scan redraw ran never closed: "dropped a patch for unknown control"); it also makes property writes (Flet's
|
||||
`Prop.__set__`) take the same `app.FLET_LOCK`: a property set on a background thread while the loop packed a patch
|
||||
changed the control's `_values` mid-iteration ("dictionary changed size during iteration", a sidebar click's page
|
||||
change died while the live Frame card took a sample). Anything that serves the app (ui_smoke, showcase) calls it too.
|
||||
**Lepton:** needs an activity with category **LAUNCHER** (Quest apps often only have INFO → "APP_ACTIVITY is empty").
|
||||
**2D apps:** Lepton runs every app headless (`lepton.headless=true`, only OpenXR output reaches the headset) unless the app folder (`<base>/lepton-app/`) has a `lepton-show-flatscreen` file (liblepton/app_metadata.sh) → Waydroid window on gamescope; agent v28 `set_flatscreen` at finalize for `vr_kind == "none"`. Android 11's navbar covered the
|
||||
app's controls → patch `device.hide_navbar` (default on for vr_kind none, migration `flat_hide_navbar`) exports
|
||||
@@ -618,7 +694,6 @@ FrameBridge `snapshot=N` (`snapshot_gl.c`, GLES): every N s the left-eye image t
|
||||
own context and saved as `files/fb_snap_0-7.ppm` (quarter size) — headless launches show a black headset view, this
|
||||
shows what the game draws. Vader: Lucasfilm logo (an OBB mp4: video works), then its loading card (portrait + segmented
|
||||
bar) that never advances; the async loader thread sleeps and OBB reads stop (~168 MB of a 2.7 GB pak).
|
||||
**Lepton's logcat mirror dies (agent v67, 2026-10-09):** occasionally launch.log ends with `logcat: Unexpected EOF!` right after the game starts (about 1 launch in 50, Lepton 2.8.14 and 3.0.5): no dashboard auto-hide, no launch-test result. launch.sh's `_logcat_keeper` then reads `podman exec lepton-steamlaunch-<appid> logcat` itself into launch.log (up to 5 restarts while the game runs).
|
||||
**Double launch (agent v57, 2026-10-06):** a second Play while Lepton still boots (~10 s with nothing to see) made
|
||||
the second Lepton stop the first one's container ("Waiting for steamlaunch-<appid> (PID …) to exit", exit 137
|
||||
"(starting)", "Clearing baked app data due to early exit") and both died (Vader, BattleSisters). launch.sh now takes
|
||||
@@ -646,41 +721,6 @@ head-pose deadline ends VR mode without a worn headset (not a game bug).
|
||||
|
||||
**Language packs (merged from PR #20, 2026-10-04):** overport's `libovrplatformloader.so` is a dispatcher that `dlopen`s Meta's own loader (`libovrplatformloader_meta.so` / `_meta_q1.so`, also `libpxrplatformloader.so`) and keeps its own message queue; `ovr_LanguagePack_GetCurrent/SetCurrent` are 8-byte `return 0` stubs in it, `ovr_AssetFile_GetList` forwards to Meta's loader. `frame.langpacks` (opt-in, `native/langpack`) serves `<tag>.lang` files from the game's data; `elf.hide_exports` marks the loader's exports STB_LOCAL (bionic and glibc only match GLOBAL/WEAK; verified for glibc, bionic's `is_symbol_global_and_defined` is from memory). `libfp_langpack.so` is built here (`python native/build.py --only langpack`) and committed. Owner-verified 2026-10-04: Deadpool VR with only `en.lang` and the patch on plays English dialogue and runs normally (headless launch tests show 2-6 fps while it loads: not a regression sign). A dispatcher answer that arrives after we answered the timed-out GetList is dropped (one answer per request); games already in a library get `lang_packs` filled after an app update (`library._refresh_data_fields`). The library logs to logcat under the tag `fp_langpack` (dirs looked in, packs found, every language-pack call), so it shows up in the game's `launch.log`; an `ovr_AssetFile_GetList` the dispatcher leaves unanswered for 1.5 s is answered with our packs alone. Deadpool VR (Unreal) accepts a pack only when its `Metadata` equals the game's own version string (`ULanguagePacksSubsystem` compares it with `%s.%s.%s.%s.%s` built from the build info, e.g. `1.0.40.356975.Quest` = versionName; found by disassembling `libUE4.so`): the patch writes the APK's versionName into the library (`@FPMETA@` slot, `with_metadata`), `FRAMEPORT_LANGPACK_META` overrides it. Deadpool VR (2026-10-04, headset): German became selectable with that Metadata, but dialogue stayed silent (even English once reported as a pack) while the path was spelled `/sdcard/Android/obb/<pkg>/x.lang`; with the `/storage/emulated/0/Android/obb/<pkg>/x.lang` spelling (Unreal's own, now listed first in `scan_dirs`) German dialogue plays. `FRAMEPORT_LANGPACK_SKIP=<tags>` or a file `fp_langpack_skip` in the obb folder leaves packs out of the list (experiments).
|
||||
|
||||
**Cube swapchains (GitHub #107, 2026-10-09):** the Frame's runtime refuses `faceCount=6` swapchains (-2,
|
||||
XR_ERROR_RUNTIME_FAILURE); OVRPlugin ignores that ("CreateSwapchain for eye 0: 0x0, 0 stages") and crashes in
|
||||
ovrp_EndFrame4 (memset). FrameBridge `cube_standin` (default on, `native/adapter/cube_standin.c`) serves a refused cube
|
||||
swapchain as one GL cube-map texture in the app's context (GLES only) and drops its layers. Verified headless with
|
||||
Budget Cuts Ultimate (2048² sRGB, 12 mips; runs on at ~70 fps); what the cube layer showed is simply missing.
|
||||
**Vivox API 31 (GitHub #101, 2026-10-09):** newer Vivox builds (Green Hell VR) call Android 12 AudioManager
|
||||
communication-device methods from `com.vivox.sdk.AudioChangeListener` with no SDK check → NoSuchMethodError on Lepton's
|
||||
Android 11. `frame.vivox_audio_route` (analysis `vivox_api31`, ANALYSIS_VERSION 4) makes every such method return at
|
||||
once (`Dex.return_early`: return-void / `const/4 v0,0; return v0`; nopping the invoke would leave a move-result the
|
||||
verifier rejects). Older Vivox (Eleven Table Tennis, BattleSisters) lacks that code and isn't matched. Verified
|
||||
headless: Vivox initialises, 150 s at ~65-70 fps.
|
||||
**Multiview programs on flat framebuffers (GitHub #77, Doom3Quest, 2026-10-09, prototype):** Mesa enforces OVR_multiview's
|
||||
"program num_views == draw framebuffer views" rule (`draw_validate.c`, the draw is dropped silently); Qualcomm doesn't.
|
||||
Doom3Quest compiles every VS with `layout(num_views=2) in;` and draws its HUD/PDA into 2D-texture FBOs → black. Opt-in
|
||||
`frame.gl_multiview_fbo` (analysis `gl_multiview_libs`, ANALYSIS_VERSION 6; own-engine GLES only): `native/glmv` =
|
||||
`libfpglmv.so` (12 chars = "libGLESv3.so": libdoom3.so's one `.rodata` dlopen string is rewritten in place, its qgl*
|
||||
table comes from dlsym on that handle; also first DT_NEEDED for its direct gl*/egl* imports). Such draws use a lazily
|
||||
built single-view twin (view 0, uniforms copied per draw); eglMakeCurrent resets the per-thread cache. Host-tested only
|
||||
(rewriter on all 19 Doom3Quest shaders + glmv.c against a stand-in GL, `tests/test_gl_multiview_fbo.py`); the host's
|
||||
Mesa 23.2 llvmpipe has no OVR_multiview, so no real-driver test yet. Not in the catalog until a headset test.
|
||||
**Session triage (agent v70, 2026-10-09):** launch tests never reach FOCUSED, so real play sessions are triaged
|
||||
too. list_installed gives each game `last_play` {start, end, test} from `<anchor>/plays.log` (launch tests write a
|
||||
`test <unix>` line first → test sessions are only marked); `session_log` returns the newest session's launch.log
|
||||
(`<base>/session.log`, ≤4 MB: head + tail + FrameBridge/crash lines between) + that session's logcat-crash.log +
|
||||
`journalctl -k` GPU lines ("kernel: …"). The GUI's connection refresh (`app._check_sessions` → `pipeline.sessions_due`,
|
||||
background thread; sessions >7 days old are skipped) runs `pipeline.triage_session` = `validate/session.analyze`
|
||||
(triage.yaml signatures incl. `space-warp-used` (info, `question:`, never auto-applied), `gpu-hang` (`report: true`)
|
||||
+ computed `slow-frames` (pacing windows vs the nearest refresh rate) and `focus-dips` (FrameBridge always logs
|
||||
`focus: lost` / `focus: back after N ms`, session_fixes.c)) → library `last_session` / `last_session_checked` → game
|
||||
page "Last session" callout (Try this fix / Rebuild with this fix / Yes-No question / Report / Dismiss). Suggestions may
|
||||
be values (`adapter.scale=0.85`, `triage.split_suggestion`); adapter-only fixes are pushed live (`apply_suggestions_live`
|
||||
→ agent set_settings, like the Game settings dialog). CLI `frameport session <pkg> [--apply]`. PC VR (Proton) launchers
|
||||
log no session end, so they aren't triaged yet. pac_hints stays triage-only: a survey of all 68 dump APKs found unpaired
|
||||
PAC hints in 21 libraries of 18 games (OpenSSL's 38/40 in most UE4 libUE4.so and libEOSSDK.so, UE5 libUnreal.so ~400
|
||||
vs +2-3, libass, libopencv, …), most of them games that work, so default-on would rewrite many working builds.
|
||||
**Unresolved (as of 2026-09-28):** Arcsmith (right-eye distortion) and Time Stall (both eyes) — swap, tracking, Valve
|
||||
layers, depth, pacing ruled out. Sniper Elite VR (DEVICE LOST), Espire 1 (Mesa GL upload crash), HITMAN 3 (freedreno
|
||||
crash): use PC versions.
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
|
||||
Install games that target the Meta Quest, Android, or general PCVR onto your **Valve Steam Frame**. FramePort handles everything from uploading game files, setting up your Frame, injecting compatibility patches, and adding shortcuts to your Steam library. FramePort aims to be as simple as possible by taking advantage of the fact that the Steam Frame runs on Linux.
|
||||
|
||||

|
||||
[](docs/media/frameport-tour.mp4)
|
||||
|
||||
▶ [Watch the full tour](docs/media/frameport-tour.mp4) · New to FramePort? [Watch the install tutorial](docs/media/frameport-install.mp4)
|
||||
(about 90 seconds each, MP4; also attached to every release)
|
||||
|
||||
> **Notice:** FramePort explicitly does NOT download, share, or unlock games. You must provide legally obtained game
|
||||
> executables. Core features of FramePort simply download and wrap other published tools (see [Built on](#built-on))
|
||||
@@ -18,6 +21,8 @@ Install games that target the Meta Quest, Android, or general PCVR onto your **V
|
||||
|
||||
## Features
|
||||
|
||||

|
||||
|
||||
- **Painless setup:** one short command on the Frame. No root, no `sudo`, no password.
|
||||
[What it changes](docs/FRAME_SETUP.md).
|
||||
- **Type on Frame:** use your computer's keyboard on the Frame: in VR apps, Android apps, Steam and the desktop.
|
||||
@@ -109,7 +114,7 @@ will attempt to guess key patches. If you find a new config that works for an ap
|
||||
|
||||
**[List of tested games](docs/GAMES.md)**
|
||||
|
||||
**Tested something? Share it.** In FramePort open the game → **…** → **Share working config…** (it fills in the
|
||||
**Tested something? Share it.** In FramePort open the game → **…** → **Share working recipe…** (it fills in the
|
||||
recipe for you) or **Report a problem…** (attaches a diagnostics zip with personal data removed). Without the app:
|
||||
[share a working config](https://github.com/spoopyghosty0/frameport/issues/new?template=working-config.yml) · [report a problem](https://github.com/spoopyghosty0/frameport/issues/new?template=bug-report.yml). Shared configs become built-in recipes for everyone.
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ FramePort is GPL-3.0-only (see `LICENSE`). It includes or downloads the followin
|
||||
| Android NDK runtime (statically linked libc++) | native Android libraries | Apache-2.0 with LLVM exception, plus legacy notices (`native/vrapi-bridge/licenses/ANDROID-NDK.txt`) |
|
||||
| Flet and Flutter (desktop app runtime) | release bundles | Apache-2.0 / BSD-3-Clause |
|
||||
| flet-dropzone / desktop_drop (drag-and-drop) | release bundles | Apache-2.0 / MIT |
|
||||
| FFmpeg 7.1.1 hardware HEVC wrapper (LGPL configuration, without GPL/nonfree components) | `artifacts/hevc/libstagefrighthw.so`; source/rebuild instructions in `native/hevc/build.py` and `native/hevc/README.md` | LGPL-2.1-or-later (`artifacts/hevc/COPYING.FFmpeg`); unmodified source: https://ffmpeg.org/releases/ffmpeg-7.1.1.tar.xz |
|
||||
| AOSP Android 11 native media/utility headers | `native/hevc/platform/` | Apache-2.0; copyright/license notices retained in the headers |
|
||||
| Python packages (paramiko, zeroconf, psutil, pyelftools, capstone, UnityPy, PyYAML, requests, typer, pyaxmlparser, Pillow, cryptography, …) | release bundles | their own licenses (see each package's metadata) |
|
||||
|
||||
FramePort's own native code (the FrameBridge adapter, GL/Vulkan/OpenXR shims, the Windows helpers) is GPL-3.0-only.
|
||||
|
||||
@@ -35,11 +35,10 @@ import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
import zlib
|
||||
from types import SimpleNamespace
|
||||
|
||||
AGENT_VERSION = 70
|
||||
AGENT_VERSION = 66
|
||||
HOME = os.path.expanduser("~")
|
||||
STEAM = os.path.join(HOME, ".local/share/Steam")
|
||||
ANCHORS = os.path.join(HOME, "Applications/quest-frame")
|
||||
@@ -1451,7 +1450,6 @@ def cmd_list_installed(args):
|
||||
apk = os.path.join(dep["base"], "lepton-app/game.apk")
|
||||
dep["apk_present"] = os.path.exists(apk)
|
||||
dep["apk_size"] = os.path.getsize(apk) if dep["apk_present"] else 0
|
||||
dep["last_play"] = last_play(dep["anchor"]) # agent v70: the PC triages a finished play session's log
|
||||
games.append(dep)
|
||||
return {"games": games}
|
||||
|
||||
@@ -1929,42 +1927,6 @@ def play_sessions():
|
||||
return [tuple(s) for s in sessions]
|
||||
|
||||
|
||||
TEST_MARK_WINDOW = 60 # s: a "test <unix>" line in plays.log marks a session starting this soon after as a launch test
|
||||
|
||||
|
||||
def last_play(anchor):
|
||||
"""The newest play session in <anchor>/plays.log: {start, end (None while it runs, and for Proton launchers, which
|
||||
exec the game), test (started by a launch test, not by the player)}, or None."""
|
||||
text = _tail(os.path.join(anchor, PLAYS_LOG), 8192)
|
||||
if not text:
|
||||
return None
|
||||
start = end = None
|
||||
tests = []
|
||||
for line in text.splitlines():
|
||||
parts = line.split()
|
||||
if len(parts) < 2 or not parts[1].isdigit():
|
||||
continue
|
||||
t = int(parts[1])
|
||||
if parts[0] == "start":
|
||||
start, end = t, None
|
||||
elif parts[0] == "end" and start is not None and t >= start:
|
||||
end = t
|
||||
elif parts[0] == "test":
|
||||
tests.append(t)
|
||||
if start is None:
|
||||
return None
|
||||
return {"start": start, "end": end, "test": any(0 <= start - t <= TEST_MARK_WINDOW for t in tests)}
|
||||
|
||||
|
||||
def mark_launch_test(anchor):
|
||||
"""A launch test runs the game's launcher, which logs a play session: mark it so the PC doesn't triage it as one."""
|
||||
try:
|
||||
with open(os.path.join(anchor, PLAYS_LOG), "a") as f:
|
||||
f.write(f"test {int(time.time())}\n")
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def session_game(t, sessions):
|
||||
"""Package whose play session contains time t (the latest start wins), else None."""
|
||||
hit = None
|
||||
@@ -2120,6 +2082,11 @@ def cmd_delete_screenshots(args):
|
||||
for p in paths:
|
||||
os.unlink(p)
|
||||
deleted.append(p)
|
||||
stem, ext = os.path.splitext(p)
|
||||
try: # a VR screenshot's stereo copy (<name>_vr.jpg) next to it goes too
|
||||
os.unlink(stem + "_vr" + ext)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
thumbs = os.path.join(os.path.dirname(p), "thumbnails")
|
||||
if inside_userdata(thumbs):
|
||||
try:
|
||||
@@ -2129,6 +2096,112 @@ def cmd_delete_screenshots(args):
|
||||
return {"deleted": deleted}
|
||||
|
||||
|
||||
# Headset screenshots through OpenVR's IVRScreenshots (SteamVR's own libopenvr_api.so via ctypes, no build step):
|
||||
# connect as a background app (never starts SteamVR), RequestScreenshot(stereo) = SteamVR captures what the wearer
|
||||
# sees into two files (a flat preview + the stereo image), SubmitScreenshot = the Steam client adds them to its
|
||||
# library like a shot taken in the headset (under SteamVR, 250820). Verified on the device 2026-10-08. (SteamVR's
|
||||
# dashboard debug command `screenshot_request` over its web mailbox did nothing here.) While the headset sleeps the
|
||||
# compositor captures nothing.
|
||||
OPENVR_LIBS = ("/opt/steamvr/bin/linuxarm64/libopenvr_api.so", "/opt/steamvr/bin/linux64/libopenvr_api.so")
|
||||
VR_APP_BACKGROUND = 3
|
||||
VR_SHOT_STEREO = 2
|
||||
HMD_STATE = re.compile(r"\[CCVTrackedHmdDriver\] in State(\w+)")
|
||||
|
||||
|
||||
def hmd_state():
|
||||
"""The headset's state from SteamVR's driver log ("Normal", "Standby", ... ; None = unknown)."""
|
||||
try:
|
||||
with open(os.path.join(STEAM, "logs", "vrserver.txt"), "rb") as f:
|
||||
f.seek(max(0, os.path.getsize(f.name) - 400_000))
|
||||
text = f.read().decode(errors="replace")
|
||||
except OSError:
|
||||
return None
|
||||
found = HMD_STATE.findall(text)
|
||||
return found[-1] if found else None
|
||||
|
||||
|
||||
def steamvr_shot_files():
|
||||
return set(glob.glob(os.path.join(STEAM, "userdata", "*", "760", "remote", STEAMVR_APPID, "screenshots", "*")))
|
||||
|
||||
|
||||
def vr_screenshot(capture_wait=6.0):
|
||||
"""Ask SteamVR for a stereo screenshot and hand it to Steam. Returns None when submitted, else why not:
|
||||
"steamvr" (not running / no OpenVR), "capture" (nothing captured: the headset sleeps), or an error text."""
|
||||
import ctypes
|
||||
import tempfile
|
||||
|
||||
lib = next((p for p in OPENVR_LIBS if os.path.isfile(p)), None)
|
||||
if lib is None:
|
||||
return "steamvr"
|
||||
vr = ctypes.CDLL(lib)
|
||||
vr.VR_InitInternal2.restype = ctypes.c_uint32
|
||||
vr.VR_InitInternal2.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.c_int, ctypes.c_char_p]
|
||||
vr.VR_GetGenericInterface.restype = ctypes.c_void_p
|
||||
vr.VR_GetGenericInterface.argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_int)]
|
||||
vr.VR_ShutdownInternal.restype = None
|
||||
err = ctypes.c_int(0)
|
||||
vr.VR_InitInternal2(ctypes.byref(err), VR_APP_BACKGROUND, None)
|
||||
if err.value:
|
||||
return "steamvr"
|
||||
tmp = tempfile.mkdtemp(prefix="frameport-shot-")
|
||||
try:
|
||||
request = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.POINTER(ctypes.c_uint32), ctypes.c_int, ctypes.c_char_p,
|
||||
ctypes.c_char_p)
|
||||
submit = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_uint32, ctypes.c_int, ctypes.c_char_p, ctypes.c_char_p)
|
||||
|
||||
class Table(ctypes.Structure): # openvr_capi.h VR_IVRScreenshots_FnTable (IVRScreenshots_001)
|
||||
_fields_ = [("RequestScreenshot", request), ("HookScreenshot", ctypes.c_void_p),
|
||||
("GetScreenshotPropertyType", ctypes.c_void_p),
|
||||
("GetScreenshotPropertyFilename", ctypes.c_void_p),
|
||||
("UpdateScreenshotProgress", ctypes.c_void_p), ("TakeStereoScreenshot", ctypes.c_void_p),
|
||||
("SubmitScreenshot", submit)]
|
||||
|
||||
ierr = ctypes.c_int(0)
|
||||
ptr = vr.VR_GetGenericInterface(b"FnTable:IVRScreenshots_001", ctypes.byref(ierr))
|
||||
if not ptr:
|
||||
return f"no screenshot interface ({ierr.value})"
|
||||
table = Table.from_address(ptr)
|
||||
base = os.path.join(tmp, "shot")
|
||||
handle = ctypes.c_uint32(0)
|
||||
r = table.RequestScreenshot(ctypes.byref(handle), VR_SHOT_STEREO, (base + "_preview").encode(),
|
||||
(base + "_vr").encode())
|
||||
if r:
|
||||
return f"SteamVR refused the screenshot ({r})"
|
||||
preview, full = base + "_preview.png", base + "_vr.png"
|
||||
deadline = time.time() + capture_wait
|
||||
while time.time() < deadline and not (os.path.isfile(preview) and os.path.isfile(full)):
|
||||
time.sleep(0.2)
|
||||
if not (os.path.isfile(preview) and os.path.isfile(full)):
|
||||
return "capture"
|
||||
time.sleep(0.4) # the second file can still be being written
|
||||
r = table.SubmitScreenshot(handle.value, VR_SHOT_STEREO, preview.encode(), full.encode())
|
||||
if r:
|
||||
return f"Steam didn't take the screenshot ({r})"
|
||||
time.sleep(1.5) # Steam copies the files: keep them until it has
|
||||
return None
|
||||
finally:
|
||||
vr.VR_ShutdownInternal()
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
|
||||
def cmd_take_screenshot(args):
|
||||
"""A headset screenshot now (vr_screenshot), saved by Steam under SteamVR; waits up to `wait` s for its file:
|
||||
{taken, path, reason, hmd}. reason: "steamvr" (SteamVR not running), "capture" (the headset sleeps), other text =
|
||||
an error."""
|
||||
wait = float(args.get("wait") or 8)
|
||||
before = steamvr_shot_files()
|
||||
reason = vr_screenshot()
|
||||
if reason is None:
|
||||
deadline = time.time() + wait
|
||||
while time.time() < deadline:
|
||||
new = [p for p in steamvr_shot_files() - before if SHOT_NAME.match(os.path.basename(p))]
|
||||
if new:
|
||||
return {"taken": True, "path": max(new, key=os.path.getmtime), "reason": None, "hmd": hmd_state()}
|
||||
time.sleep(0.4)
|
||||
reason = "not saved"
|
||||
return {"taken": False, "path": None, "reason": reason, "hmd": hmd_state()}
|
||||
|
||||
|
||||
def cmd_prepare(args):
|
||||
"""Where to upload, and what the Frame already has (so unchanged data is not re-sent)."""
|
||||
pkg = check_pkg(args["package"])
|
||||
@@ -2189,7 +2262,6 @@ export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||
export IS_PARENT=true
|
||||
{extra_env}
|
||||
[[ ! -x "$app_dir/frameport-codec/bin/podman" ]] || export PATH="$app_dir/frameport-codec/bin:$PATH"
|
||||
child=''
|
||||
stop() {{
|
||||
trap - EXIT INT TERM
|
||||
@@ -2205,7 +2277,6 @@ trap 'exit 143' TERM
|
||||
setsid {lepton_q} start >"$app_dir/launch.log" 2>&1 &
|
||||
child=$!
|
||||
{dashboard}
|
||||
{logcat}
|
||||
wait "$child"
|
||||
""")
|
||||
|
||||
@@ -2233,22 +2304,10 @@ SINGLE_LINE = ('exec 9>"$app_dir/.launch.lock"; flock -n 9 || '
|
||||
'exit 0; }')
|
||||
|
||||
|
||||
# Lepton mirrors the game's logcat into launch.log, and that reader sometimes dies right after the game starts
|
||||
# ("logcat: Unexpected EOF!", seen with Vader Immortal on Lepton 3.0.5 and Under Cover on 2.8.14). The game runs on,
|
||||
# but launch.log stays empty: no dashboard auto-hide, no launch-test result. _logcat_keeper then reads the
|
||||
# container's logcat itself and appends it to launch.log.
|
||||
LOGCAT_LINE = ('python3 {agent_q} _logcat_keeper "$app_dir/launch.log" "$SteamAppId" $$ '
|
||||
'>"$app_dir/logcat-keeper.log" 2>&1 9>&- &')
|
||||
|
||||
|
||||
def dashboard_line():
|
||||
return DASHBOARD_LINE.format(agent_q=shlex.quote(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def logcat_line():
|
||||
return LOGCAT_LINE.format(agent_q=shlex.quote(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def plays_lines(anchor):
|
||||
"""launch.sh lines that log play sessions to <anchor>/plays.log (screenshots are matched to games by time: the
|
||||
Frame files every headset screenshot under SteamVR). Never fail the launcher."""
|
||||
@@ -2273,8 +2332,6 @@ def upgrade_launchers():
|
||||
new = new.replace(OLD_WATCHDOG, WATCHDOG, 1)
|
||||
if "_dashboard_worker" not in new and 'child=$!\nwait "$child"' in new:
|
||||
new = new.replace('child=$!\nwait "$child"', 'child=$!\n' + dashboard_line() + '\nwait "$child"', 1)
|
||||
if "_logcat_keeper" not in new and "_dashboard_worker" in new and '\nwait "$child"' in new:
|
||||
new = new.replace('\nwait "$child"', '\n' + logcat_line() + '\nwait "$child"', 1)
|
||||
guard = '[[ -d "$app_dir/lepton-app" ]] ||'
|
||||
if ".launch.lock" not in new and guard in new:
|
||||
i = new.index("\n", new.index(guard)) + 1
|
||||
@@ -2317,8 +2374,7 @@ def write_launcher(anchor, base, pkg, title, appid, lepton, env):
|
||||
if re.fullmatch(r"[A-Z_][A-Z0-9_]*", k))
|
||||
text = LAUNCH_SH.format(title=title.replace("\n", " "), pkg=pkg, base_q=shlex.quote(base), appid=appid,
|
||||
lepton_q=shlex.quote(lepton), extra_env=extra, watchdog=WATCHDOG,
|
||||
dashboard=dashboard_line(), logcat=logcat_line(), single=SINGLE_LINE,
|
||||
plays_start=plays_lines(anchor)[0],
|
||||
dashboard=dashboard_line(), single=SINGLE_LINE, plays_start=plays_lines(anchor)[0],
|
||||
plays_end=plays_lines(anchor)[1])
|
||||
path = os.path.join(anchor, "launch.sh")
|
||||
with open(path + ".tmp", "w") as f:
|
||||
@@ -2331,47 +2387,6 @@ def data_files_dir(base, pkg):
|
||||
return os.path.join(base, "lepton-data/external/Android/data", pkg, "files")
|
||||
|
||||
|
||||
def install_video_codec(base, lepton, appid):
|
||||
"""Extract the APK's codec assets for this game's container. Never alter shared Lepton or MP4 files."""
|
||||
directory = os.path.join(base, "frameport-codec")
|
||||
prefix = "assets/frameport/hevc/"
|
||||
with zipfile.ZipFile(os.path.join(base, "lepton-app/game.apk")) as apk:
|
||||
if prefix + "manifest.json" not in apk.namelist():
|
||||
# An older/unpatched APK must not keep using an obsolete codec.
|
||||
wrapper = os.path.join(directory, "bin/podman")
|
||||
if os.path.exists(wrapper):
|
||||
os.remove(wrapper)
|
||||
return False
|
||||
manifest = json.loads(apk.read(prefix + "manifest.json"))
|
||||
data = {}
|
||||
for name in ("libstagefrighthw.so", "media_codecs_frameport.xml", "podman.py", "COPYING.FFmpeg"):
|
||||
info = apk.getinfo(prefix + name)
|
||||
if info.file_size > 16 * 1024 * 1024:
|
||||
raise AgentError(f"oversized video codec asset: {name}")
|
||||
data[name] = apk.read(info)
|
||||
if hashlib.sha256(data[name]).hexdigest() != manifest["files"][name]:
|
||||
raise AgentError(f"video codec asset checksum mismatch: {name}")
|
||||
real_podman = shutil.which("podman")
|
||||
if not real_podman:
|
||||
raise AgentError("podman is unavailable")
|
||||
os.makedirs(os.path.join(directory, "bin"), exist_ok=True)
|
||||
config = {"lepton": lepton, "appid": str(appid), "podman": real_podman,
|
||||
"runtime_sha256": manifest["runtime_sha256"]}
|
||||
path = os.path.join(directory, "deployment.json")
|
||||
with open(path + ".tmp", "w") as f:
|
||||
json.dump(config, f)
|
||||
os.replace(path + ".tmp", path)
|
||||
# Publish the executable last: a first install cannot expose a wrapper
|
||||
# whose configuration or codec files have not been written yet.
|
||||
for name in (*[n for n in data if n != "podman.py"], "podman.py"):
|
||||
path = os.path.join(directory, "bin/podman" if name == "podman.py" else name)
|
||||
with open(path + ".tmp", "wb") as f:
|
||||
f.write(data[name])
|
||||
os.chmod(path + ".tmp", 0o755 if name == "podman.py" else 0o644)
|
||||
os.replace(path + ".tmp", path)
|
||||
return True
|
||||
|
||||
|
||||
def set_flatscreen(app_dir, on):
|
||||
"""Lepton shows an app as a flat (2D) window only when its app folder holds this marker
|
||||
(liblepton/app_metadata.sh); otherwise the app runs headless and only OpenXR output reaches the headset."""
|
||||
@@ -2452,7 +2467,6 @@ def cmd_finalize(args):
|
||||
with open(target, "w") as f:
|
||||
f.write(content)
|
||||
models = install_controller_models(files_dir, str(settings.get("controller_models", 0)) not in ("0", "0.0"))
|
||||
install_video_codec(base, lepton, appid)
|
||||
write_launcher(anchor, base, pkg, title, appid, lepton, args.get("env"))
|
||||
art_in = os.path.join(base, "incoming-artwork")
|
||||
if os.path.isdir(art_in):
|
||||
@@ -3720,7 +3734,7 @@ def cmd_uninstall(args):
|
||||
raise AgentError("the game is running")
|
||||
keep_data = args.get("keep_data", True)
|
||||
names = ("game", "revive", "xrlayer", "shadercache", "incoming", "incoming-artwork") if pcvr else \
|
||||
("app", "incoming", "incoming-artwork", "launch.log", "session.log") if linux else \
|
||||
("app", "incoming", "incoming-artwork", "launch.log") if linux else \
|
||||
("lepton-app", "lepton-shaders", "incoming", "previous-game.apk")
|
||||
for name in names:
|
||||
p = os.path.join(base, name)
|
||||
@@ -3746,7 +3760,7 @@ def cmd_uninstall(args):
|
||||
if not keep_data or base != anchor:
|
||||
remove_tree(anchor)
|
||||
else: # saves live next to the launcher (Quest games): keep them, drop what marks the game as installed
|
||||
for name in ("deployment.json", "launch.sh", "artwork", "launch.log", "launch-test.log", "session.log"):
|
||||
for name in ("deployment.json", "launch.sh", "artwork", "launch.log", "launch-test.log"):
|
||||
p = os.path.join(anchor, name)
|
||||
remove_tree(p)
|
||||
return {"removed": True, "kept_saves": keep_data, "shortcut_removed": removed_sc}
|
||||
@@ -4084,56 +4098,10 @@ PCVR_LOGS = ("compatdata/pfx/drive_c/users/steamuser/AppData/Local/Revive/Revive
|
||||
LOCAL_APPDATA = "compatdata/pfx/drive_c/users/steamuser/AppData/Local"
|
||||
|
||||
|
||||
LOCAL_LOW = "compatdata/pfx/drive_c/users/steamuser/AppData/LocalLow"
|
||||
|
||||
|
||||
def _head_tail(path, head=300, tail=1500):
|
||||
lines = open(path, errors="replace").read().splitlines()
|
||||
if len(lines) > head + tail:
|
||||
lines = lines[:head] + [f"[... {len(lines) - head - tail} lines left out ...]"] + lines[-tail:]
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def unity_logs(base, since=0.0):
|
||||
"""Unity's own logs of a PC VR game: LocalLow/<Company>/<Product>/Player.log + Player-prev.log (Unity 2018.3+;
|
||||
company and product from <game>/<Name>_Data/app.info, else every Player log in LocalLow), the older
|
||||
<Name>_Data/output_log.txt and the crash handler's Temp/<Company>/<Product>/Crashes/*/error.log. Unity logs VR
|
||||
start-up (which SDK, init errors) at the top, so the head is kept as well as the tail."""
|
||||
game = os.path.join(base, "game")
|
||||
low = os.path.join(base, LOCAL_LOW)
|
||||
temp = os.path.join(base, LOCAL_APPDATA, "Temp")
|
||||
names = []
|
||||
for info in glob.glob(os.path.join(glob.escape(game), "*_Data", "app.info")):
|
||||
try:
|
||||
lines = [ln.strip() for ln in open(info, errors="replace").read().splitlines()]
|
||||
except OSError:
|
||||
continue
|
||||
if len(lines) >= 2 and lines[0] and lines[1] and "/" not in lines[0] + lines[1] and \
|
||||
".." not in (lines[0], lines[1]):
|
||||
names.append((lines[0], lines[1]))
|
||||
dirs = [os.path.join(low, c, p) for c, p in names if os.path.isdir(os.path.join(low, c, p))]
|
||||
logs = []
|
||||
for d in dirs or glob.glob(os.path.join(glob.escape(low), "*", "*")):
|
||||
logs += [os.path.join(d, n) for n in ("Player.log", "Player-prev.log")]
|
||||
logs += glob.glob(os.path.join(glob.escape(game), "*_Data", "output_log.txt"))
|
||||
crash_dirs = [os.path.join(temp, c, p) for c, p in names] or glob.glob(os.path.join(glob.escape(temp), "*", "*"))
|
||||
crashes = [x for d in crash_dirs for x in glob.glob(os.path.join(glob.escape(d), "Crashes", "*", "error.log"))]
|
||||
out = []
|
||||
for log in [x for x in logs if os.path.isfile(x)]:
|
||||
if os.path.getmtime(log) < since: # left over from an earlier run
|
||||
continue
|
||||
out.append(f"===== unity log {os.path.relpath(log, base)}\n" + _head_tail(log))
|
||||
for err in sorted(crashes, key=os.path.getmtime, reverse=True)[:2]:
|
||||
if os.path.getmtime(err) >= since:
|
||||
out.append(f"===== unity crash {os.path.relpath(err, base)}\n" + _head_tail(err, 100, 400))
|
||||
return out
|
||||
|
||||
|
||||
def game_logs(base, since=0.0):
|
||||
"""The game's own logs from the Proton prefix, newest first: Unreal Saved/Logs/*.log (tail) and crash summaries
|
||||
(Saved/Crashes/*/CrashContext.runtime-xml → error message + call stack), Unity's Player.log / crash error.log
|
||||
(agent v67), Revive's logs."""
|
||||
out = unity_logs(base, since)
|
||||
(Saved/Crashes/*/CrashContext.runtime-xml → error message + call stack), Revive's logs."""
|
||||
out = []
|
||||
local = os.path.join(base, LOCAL_APPDATA)
|
||||
for log in sorted(glob.glob(os.path.join(local, "*", "Saved", "Logs", "*.log")), key=os.path.getmtime,
|
||||
reverse=True)[:1]:
|
||||
@@ -4158,9 +4126,6 @@ def game_logs(base, since=0.0):
|
||||
return out
|
||||
|
||||
|
||||
LAUNCH_INSTALL_GRACE = 240 # s a launch test waits at most for Lepton's boot + app install before its own window
|
||||
|
||||
|
||||
def cmd_launch_test(args):
|
||||
"""Start the game headless (as Steam would), wait, classify, stop. Without the headset worn the OpenXR session
|
||||
never reaches FOCUSED, so this proves startup, not visuals."""
|
||||
@@ -4182,31 +4147,20 @@ def cmd_launch_test(args):
|
||||
keys = key_usage()
|
||||
unit = f"frameport-test-{appid}"
|
||||
run(["systemctl", "--user", "reset-failed", unit])
|
||||
mark_launch_test(anchor)
|
||||
p = run(["systemd-run", "--user", "--collect", "--quiet", f"--unit={unit}", os.path.join(anchor, "launch.sh")])
|
||||
if p.returncode:
|
||||
raise AgentError("could not start the launcher: " + p.stderr[-300:])
|
||||
start = time.time()
|
||||
state = "RUNNING"
|
||||
app_start = None # when Lepton started the app ("Waiting for app"): the test window counts from there
|
||||
while True:
|
||||
while time.time() - start < seconds:
|
||||
time.sleep(3)
|
||||
now = time.time()
|
||||
text = open(log, errors="replace").read() if os.path.exists(log) else ""
|
||||
if "Exited!" in text:
|
||||
state = "EXITED"
|
||||
break
|
||||
if "Early-exit" in text or not_started(text, now - start):
|
||||
if "Early-exit" in text or not_started(text, time.time() - start):
|
||||
state = "NEVER_STARTED"
|
||||
break
|
||||
if app_start is None and "Waiting for app" in text:
|
||||
app_start = now
|
||||
# the first start after an APK change boots Lepton and installs the app first (a minute or more): stopping the
|
||||
# container then left a half-installed APK ("base.apk is not zip") that never started again (VR HOT)
|
||||
if app_start is not None and now - app_start >= seconds:
|
||||
break
|
||||
if now - start >= seconds + LAUNCH_INSTALL_GRACE:
|
||||
break
|
||||
elapsed = round(time.time() - start)
|
||||
if state == "EXITED": # Lepton dumps the container's logcat buffers (crash backtraces) after "Exited!"
|
||||
until = time.time() + 15
|
||||
@@ -4232,7 +4186,6 @@ def launch_test_linux(dep, anchor, log, seconds):
|
||||
raise AgentError("the app is already running")
|
||||
unit = f"frameport-test-{appid}"
|
||||
run(["systemctl", "--user", "reset-failed", unit])
|
||||
mark_launch_test(anchor)
|
||||
start = time.time()
|
||||
p = run(["systemd-run", "--user", "--quiet", f"--unit={unit}", "--property=RemainAfterExit=no",
|
||||
os.path.join(anchor, "launch.sh")])
|
||||
@@ -4266,7 +4219,6 @@ def launch_test_pcvr(dep, anchor, log, seconds):
|
||||
raise AgentError("the game is already running")
|
||||
unit = f"frameport-test-{appid}"
|
||||
run(["systemctl", "--user", "reset-failed", unit])
|
||||
mark_launch_test(anchor)
|
||||
p = run(["systemd-run", "--user", "--quiet", f"--unit={unit}", "--property=RemainAfterExit=no",
|
||||
os.path.join(anchor, "launch.sh")])
|
||||
if p.returncode:
|
||||
@@ -4305,92 +4257,6 @@ def launch_test_pcvr(dep, anchor, log, seconds):
|
||||
"kind": "pcvr", "game_process": bool(game_seen)}
|
||||
|
||||
|
||||
SESSION_LOG_MAX = 4 << 20 # bytes of a play session's log the PC triages
|
||||
SESSION_READ_MAX = 64 << 20 # a longer launch.log is read from its end
|
||||
SESSION_KEEP = re.compile(r"FrameBridge|focus|pacing|Fatal signal|FATAL|CRASH|#\d\d pc |Abort message|DEVICE.LOST|"
|
||||
r"AndroidRuntime|vrclient|Start proc|lepton", re.I)
|
||||
KERNEL_GPU = re.compile(r"hangcheck|gpu fault|adreno|kgsl|msm_drm.*(hang|recover)", re.I)
|
||||
|
||||
|
||||
def slice_session_log(text, max_bytes=SESSION_LOG_MAX):
|
||||
"""A long play session's log cut to max_bytes: its start (a quarter) and its end (half) whole, from the middle
|
||||
only FrameBridge's, focus, pacing and crash lines (oldest first, while they fit). Returns (text, cut)."""
|
||||
if len(text) <= max_bytes:
|
||||
return text, False
|
||||
head = text[:max_bytes // 4]
|
||||
head = head[:head.rfind("\n") + 1]
|
||||
tail = text[-(max_bytes // 2):]
|
||||
tail = tail[tail.find("\n") + 1:]
|
||||
middle = text[len(head):len(text) - len(tail)]
|
||||
budget, kept = max_bytes - len(head) - len(tail) - 200, []
|
||||
for line in middle.splitlines():
|
||||
if SESSION_KEEP.search(line):
|
||||
budget -= len(line) + 1
|
||||
if budget < 0:
|
||||
break
|
||||
kept.append(line)
|
||||
note = f"[FramePort: {len(middle)} bytes in the middle of this session cut, {len(kept)} lines kept]\n"
|
||||
return head + note + "".join(ln + "\n" for ln in kept) + tail, True
|
||||
|
||||
|
||||
def session_kernel_lines(start, end):
|
||||
"""Kernel GPU lines (hangs, faults, recoveries) logged during a play session."""
|
||||
until = (end or time.time()) + 120
|
||||
try:
|
||||
text = run(["journalctl", "-k", "--since", f"@{int(start)}", "--until", f"@{int(until)}", "-q", "--no-pager",
|
||||
"-o", "short-unix"]).stdout
|
||||
except OSError:
|
||||
return ""
|
||||
lines = [ln for ln in text.splitlines() if KERNEL_GPU.search(ln)]
|
||||
return "".join(f"kernel: {ln}\n" for ln in lines[-200:])
|
||||
|
||||
|
||||
def cmd_session_log(args):
|
||||
"""The log of the game's newest play session (agent v70), for triage on the PC: {session: {start, end, test},
|
||||
log: path of the session's log (launch.log sliced to 4 MB; PC VR: + Revive's and the game's own logs), log_size,
|
||||
cut, crash: that session's crash logcat (tombstones), kernel: GPU hang/fault lines from the kernel log}.
|
||||
session is None when the game was never played."""
|
||||
pkg = check_pkg(args["package"])
|
||||
dep = deployment(pkg)
|
||||
if not dep:
|
||||
raise AgentError(f"{pkg} is not installed")
|
||||
anchor, base = os.path.join(ANCHORS, pkg), dep["base"]
|
||||
session = last_play(anchor)
|
||||
out = {"session": session, "log": None, "log_size": 0, "cut": False, "crash": "", "kernel": "",
|
||||
"kind": dep.get("kind", "quest")}
|
||||
if not session:
|
||||
return out
|
||||
start, end = session["start"], session["end"]
|
||||
parts = []
|
||||
log = os.path.join(base, "launch.log")
|
||||
if os.path.exists(log) and os.path.getmtime(log) >= start - 5: # else no log of this session is left
|
||||
size = os.path.getsize(log)
|
||||
with open(log, "rb") as f:
|
||||
if size > SESSION_READ_MAX:
|
||||
f.seek(size - SESSION_READ_MAX)
|
||||
parts.append(f.read().decode("utf-8", "replace"))
|
||||
if dep.get("kind") == "pcvr":
|
||||
for rel in PCVR_LOGS:
|
||||
path = os.path.join(base, rel)
|
||||
if os.path.exists(path) and os.path.getmtime(path) >= start - 5:
|
||||
parts.append(f"===== {rel}\n" + (_tail(path, 400000) or ""))
|
||||
parts += game_logs(base, since=start - 5)
|
||||
text, cut = slice_session_log("\n".join(parts), int(args.get("max_bytes", SESSION_LOG_MAX)))
|
||||
path = os.path.join(base, "session.log")
|
||||
with open(path, "w") as f:
|
||||
f.write(text)
|
||||
out.update(log=path, log_size=os.path.getsize(path), cut=cut)
|
||||
crash = os.path.join(STEAM, "logs", "lepton-logcats", f"steamlaunch-{dep['appid']}", "logcat-crash.log")
|
||||
try:
|
||||
mtime = os.path.getmtime(crash)
|
||||
if start - 1 <= mtime <= (end or time.time()) + 120:
|
||||
out["crash"] = _tail(crash, 256 * 1024) or ""
|
||||
except OSError:
|
||||
pass
|
||||
out["kernel"] = session_kernel_lines(start, end)
|
||||
return out
|
||||
|
||||
|
||||
def steam_library_report():
|
||||
"""Why a game installed by FramePort may be missing from Steam or fail with "Game configuration unavailable"
|
||||
(GitHub #21/#30): where Steam really lives, Steam's client version/beta, each account's shortcuts.vdf (when it
|
||||
@@ -4892,51 +4758,6 @@ def user_opened_dashboard(log, pos):
|
||||
return False, pos
|
||||
|
||||
|
||||
LOGCAT_EOF = "logcat: Unexpected EOF"
|
||||
|
||||
|
||||
def logcat_keeper(log, appid, parent, poll=2.0, restarts=5, popen=None):
|
||||
"""Keep launch.log filling when Lepton's logcat mirror dies while the game runs (LOGCAT_LINE): once the log shows
|
||||
LOGCAT_EOF after "Waiting for app", read the container's logcat ourselves (from its last 2000 lines, so the start
|
||||
of the game isn't lost) and append it; restart it if it ends while the game still runs (at most `restarts` times).
|
||||
Ends with the launcher."""
|
||||
popen = popen or subprocess.Popen
|
||||
container = f"lepton-steamlaunch-{appid}"
|
||||
|
||||
def alive():
|
||||
try:
|
||||
os.kill(int(parent), 0)
|
||||
return True
|
||||
except (OSError, ValueError):
|
||||
return False
|
||||
|
||||
proc, started = None, 0
|
||||
while alive():
|
||||
if proc is None or proc.poll() is not None:
|
||||
try:
|
||||
with open(log, errors="replace") as f:
|
||||
text = f.read()
|
||||
except OSError:
|
||||
text = ""
|
||||
i = text.find("Waiting for app")
|
||||
if i >= 0 and LOGCAT_EOF in text[i:] and started < restarts:
|
||||
started += 1
|
||||
with open(log, "a") as f:
|
||||
f.write(f"FramePort: Lepton's logcat ended; reading {container}'s logcat again ({started})\n")
|
||||
out = open(log, "ab")
|
||||
try:
|
||||
proc = popen(["podman", "exec", container, "logcat", "-v", "threadtime", "-T", "2000"],
|
||||
stdout=out, stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
|
||||
except OSError as exc:
|
||||
print(f"logcat_keeper: {exc}", flush=True)
|
||||
proc = None
|
||||
finally:
|
||||
out.close()
|
||||
time.sleep(poll)
|
||||
if proc is not None and proc.poll() is None:
|
||||
proc.terminate()
|
||||
|
||||
|
||||
def dashboard_worker(log, parent, wait_start=240, window=120, poll=0.5, ui_log=None, max_hides=10):
|
||||
"""Close SteamVR's dashboard (Steam's "Resume game" frame menu) that opens when the game submits its first VR
|
||||
frame: watch from FrameBridge's first "new layer:" line (the first submitted frame; Steam showed the menu ~0.3 s
|
||||
@@ -5011,6 +4832,8 @@ MON_INTERVALS = (0.1, 0.25, 0.5, 1, 2, 5) # seconds between samples; processes
|
||||
MON_DEFAULT_INTERVAL = 0.5
|
||||
SCAN_SECONDS = 2.0
|
||||
MON_FILTERS = ("game", "steam", "all")
|
||||
# what a client can ask for ({"modules": [...]}, agent v65); without that message every module is collected
|
||||
MON_MODULES = ("games", "procs", "cpu", "gpu", "mem", "temps", "power", "battery", "net", "disk")
|
||||
MON_PROC_LIMIT = 150
|
||||
MON_CONTEXT = 3 # "game" filter: the busiest other processes, shown for context
|
||||
# processes never signalled: the session, SSH and system plumbing (killing them logs the user out or drops FramePort)
|
||||
@@ -5055,6 +4878,20 @@ def _num(text, default=None):
|
||||
return default
|
||||
|
||||
|
||||
def monitor_plan(modules=None):
|
||||
"""The collectors one tick runs for the requested modules (None, "all" or anything unusable = all of them).
|
||||
mem includes PSI, temps the zone detail and the fan. The process scan ("scan") runs for games and procs and also
|
||||
for gpu: GPU busy is summed from the render fds the scan finds; "gpu_ns" (per-process GPU time) for the same."""
|
||||
if modules is None or modules == "all" or not isinstance(modules, (list, tuple, set, frozenset)):
|
||||
wanted = set(MON_MODULES)
|
||||
else:
|
||||
wanted = {m for m in modules if m in MON_MODULES}
|
||||
plan = set(wanted)
|
||||
if wanted & {"games", "procs", "gpu"}:
|
||||
plan |= {"scan", "gpu_ns"}
|
||||
return frozenset(plan)
|
||||
|
||||
|
||||
def read_cpu_times():
|
||||
"""[total, core0, core1, …] as (busy, all) jiffies from /proc/stat."""
|
||||
out = []
|
||||
@@ -5326,6 +5163,7 @@ class Monitor:
|
||||
self.page = os.sysconf("SC_PAGE_SIZE") if hasattr(os, "sysconf") else 4096
|
||||
self.btime = next((int(x.split()[1]) for x in _rd(f"{PROC}/stat").splitlines() if x.startswith("btime ")), 0)
|
||||
self.filter = "game"
|
||||
self.plan = monitor_plan() # collectors per tick (set_modules)
|
||||
self.kthreads = set()
|
||||
self.drm = {} # pid -> (fds, time of the fd scan)
|
||||
self.gpu_ns = {} # pid -> last drm-engine ns
|
||||
@@ -5357,7 +5195,15 @@ class Monitor:
|
||||
"clusters": [{"cpus": c["cpus"], "max_mhz": c["max_mhz"]} for c in self.clusters],
|
||||
"mem_total": read_meminfo()["total"], "rails": [r[0] for r in self.rails],
|
||||
"temp_groups": sorted({z[0] for z in self.zones}, key=[g for g, _ in TEMP_GROUPS].index),
|
||||
"fan": bool(self.fan), "intervals": list(MON_INTERVALS), "filters": list(MON_FILTERS)}
|
||||
"fan": bool(self.fan), "intervals": list(MON_INTERVALS), "filters": list(MON_FILTERS),
|
||||
"modules": list(MON_MODULES)}
|
||||
|
||||
def set_modules(self, modules):
|
||||
"""Collect only these modules from the next tick on (None/"all" = everything)."""
|
||||
plan = monitor_plan(modules)
|
||||
if ("scan" in plan and "scan" not in self.plan) or ("procs" in plan and "procs" not in self.plan):
|
||||
self.scan_at = -1e9 # processes wanted (again): scan at once
|
||||
self.plan = plan
|
||||
|
||||
# -------------------------------------------------------------------- games
|
||||
def deployments(self, now):
|
||||
@@ -5564,53 +5410,73 @@ class Monitor:
|
||||
dt = now - self.last if self.last is not None else 0.0
|
||||
self.last = now
|
||||
out = {"t": round(wall, 3), "dt": round(dt, 3)}
|
||||
cur = read_cpu_times()
|
||||
if self.cpu_prev:
|
||||
pct = cpu_percent(self.cpu_prev, cur)
|
||||
out["cpu"] = {"total": pct[0] if pct else 0.0, "cores": pct[1:]}
|
||||
plan = self.plan
|
||||
if "cpu" in plan:
|
||||
cur = read_cpu_times()
|
||||
if self.cpu_prev:
|
||||
pct = cpu_percent(self.cpu_prev, cur)
|
||||
out["cpu"] = {"total": pct[0] if pct else 0.0, "cores": pct[1:]}
|
||||
else:
|
||||
out["cpu"] = {"total": 0.0, "cores": [0.0] * self.ncpu}
|
||||
self.cpu_prev = cur
|
||||
out["cpu"]["mhz"] = [_num(_rd(f"{c['policy']}/scaling_cur_freq"), 0) // 1000 for c in self.clusters]
|
||||
else:
|
||||
out["cpu"] = {"total": 0.0, "cores": [0.0] * self.ncpu}
|
||||
self.cpu_prev = cur
|
||||
out["cpu"]["mhz"] = [_num(_rd(f"{c['policy']}/scaling_cur_freq"), 0) // 1000 for c in self.clusters]
|
||||
out["mem"] = read_meminfo()
|
||||
out["psi"] = read_psi()
|
||||
if now - self.temps_at >= 2 or self.temps is None: # 48 sensor files (~3 ms at idle clocks); heat is slow
|
||||
self.temps, self.zone_detail = read_temps(self.zones)
|
||||
self.temps_at = now
|
||||
temps, detail = self.temps, self.zone_detail
|
||||
out["temps"] = temps
|
||||
if now - self.zone_detail_at >= 5:
|
||||
out["zones"] = detail
|
||||
self.zone_detail_at = now
|
||||
if self.fan:
|
||||
out["fan"] = _num(_rd(self.fan))
|
||||
out["power"] = self.power.read(now)
|
||||
out["battery"] = self.battery.read(now)
|
||||
net = read_net()
|
||||
if self.net_prev and dt > 0:
|
||||
prev = self.net_prev
|
||||
out["net"] = {k: [max(0, int((v[0] - prev[k][0]) / dt)), max(0, int((v[1] - prev[k][1]) / dt))]
|
||||
for k, v in net.items() if k in prev}
|
||||
self.net_prev = net
|
||||
if now - self.disk_at >= 30:
|
||||
self.cpu_prev = None # no average over the time it was off
|
||||
if "mem" in plan:
|
||||
out["mem"] = read_meminfo()
|
||||
out["psi"] = read_psi()
|
||||
if "temps" in plan:
|
||||
if now - self.temps_at >= 2 or self.temps is None: # 48 sensor files (~3 ms at idle clocks); heat is slow
|
||||
self.temps, self.zone_detail = read_temps(self.zones)
|
||||
self.temps_at = now
|
||||
temps, detail = self.temps, self.zone_detail
|
||||
out["temps"] = temps
|
||||
if now - self.zone_detail_at >= 5:
|
||||
out["zones"] = detail
|
||||
self.zone_detail_at = now
|
||||
if self.fan:
|
||||
out["fan"] = _num(_rd(self.fan))
|
||||
if "power" in plan:
|
||||
out["power"] = self.power.read(now)
|
||||
if "battery" in plan:
|
||||
out["battery"] = self.battery.read(now)
|
||||
if "net" in plan:
|
||||
net = read_net()
|
||||
if self.net_prev and dt > 0:
|
||||
prev = self.net_prev
|
||||
out["net"] = {k: [max(0, int((v[0] - prev[k][0]) / dt)), max(0, int((v[1] - prev[k][1]) / dt))]
|
||||
for k, v in net.items() if k in prev}
|
||||
self.net_prev = net
|
||||
else:
|
||||
self.net_prev = None # a delta over one tick's dt needs the previous tick's counters
|
||||
if "disk" in plan and now - self.disk_at >= 30:
|
||||
try:
|
||||
st = os.statvfs(HOME)
|
||||
out["disk"] = {"free": st.f_bavail * st.f_frsize, "total": st.f_blocks * st.f_frsize}
|
||||
except OSError:
|
||||
pass
|
||||
self.disk_at = now
|
||||
scan = now - self.scan_at >= SCAN_SECONDS or not self.procs
|
||||
scan = "scan" in plan and (now - self.scan_at >= SCAN_SECONDS or not self.procs)
|
||||
if scan:
|
||||
self.scan(now, wall)
|
||||
self.scan_at = now
|
||||
busy = self.gpu_sample(now, dt)
|
||||
out["gpu"] = {"busy": round(busy, 1) if dt > 0 else None,
|
||||
"mhz": _num(_rd(f"{self.gpu}/cur_freq"), 0) // 1000000 if self.gpu else None}
|
||||
out["games"] = self.games_sample(now)
|
||||
if scan:
|
||||
if "gpu_ns" in plan:
|
||||
busy = self.gpu_sample(now, dt)
|
||||
else:
|
||||
busy = None
|
||||
self.gpu_ns, self.gpu_pct, self.gpu_acc = {}, {}, {} # stale counters would spike on the next delta
|
||||
if "gpu" in plan:
|
||||
out["gpu"] = {"busy": round(busy, 1) if dt > 0 and busy is not None else None,
|
||||
"mhz": _num(_rd(f"{self.gpu}/cur_freq"), 0) // 1000000 if self.gpu else None}
|
||||
if "games" in plan:
|
||||
out["games"] = self.games_sample(now)
|
||||
if scan and "procs" in plan:
|
||||
out["procs"] = self.filtered(now)
|
||||
out["filter"] = self.filter
|
||||
self.scan_prev = now
|
||||
elif scan:
|
||||
self.gpu_acc = {}
|
||||
self.scan_prev = now
|
||||
self.tick += 1
|
||||
out["self_ms"] = round((time.process_time() - t0) * 1000, 2)
|
||||
return out
|
||||
@@ -5697,9 +5563,10 @@ def monitor_end_game(pkg, wait=6.0):
|
||||
|
||||
def monitor_session(stdin, stdout, monitor=None, sleep=time.sleep, max_ticks=None):
|
||||
"""Long-lived: prints {"ready": 1, "static": {...}}, then one sample per tick. Control lines on stdin:
|
||||
{"interval": 1|2|5}, {"procs": "game"|"steam"|"all"}, {"pause": bool}, {"id": n, "kill": pid, "sig": "TERM"|
|
||||
"KILL", "force": bool}, {"id": n, "end_game": package} (each with an id gets {"reply": n, "ok": …}). Ends at EOF
|
||||
or when the SSH session (parent) is gone."""
|
||||
{"interval": 1|2|5}, {"procs": "game"|"steam"|"all"}, {"pause": bool}, {"modules": [...]|"all"} (v63: only those
|
||||
collectors run, see monitor_plan), {"id": n, "kill": pid, "sig": "TERM"|"KILL", "force": bool}, {"id": n,
|
||||
"end_game": package} (each with an id gets {"reply": n, "ok": …}). Ends at EOF or when the SSH session (parent)
|
||||
is gone."""
|
||||
import threading
|
||||
|
||||
mon = monitor or Monitor()
|
||||
@@ -5741,6 +5608,8 @@ def monitor_session(stdin, stdout, monitor=None, sleep=time.sleep, max_ticks=Non
|
||||
mon.scan_at = -1e9 # rescan now
|
||||
if "pause" in msg:
|
||||
state["pause"] = bool(msg["pause"])
|
||||
if "modules" in msg and hasattr(mon, "set_modules"):
|
||||
mon.set_modules(msg["modules"])
|
||||
if "kill" in msg or "end_game" in msg:
|
||||
threading.Thread(target=act, args=(msg,), daemon=True).start()
|
||||
continue
|
||||
@@ -5793,9 +5662,6 @@ def main():
|
||||
if len(sys.argv) >= 3 and sys.argv[1] == "_xr_probe":
|
||||
xr_probe(sys.argv[2])
|
||||
return 0
|
||||
if len(sys.argv) >= 5 and sys.argv[1] == "_logcat_keeper":
|
||||
logcat_keeper(sys.argv[2], sys.argv[3], sys.argv[4])
|
||||
return 0
|
||||
if len(sys.argv) >= 4 and sys.argv[1] == "_dashboard_worker":
|
||||
dashboard_worker(sys.argv[2], sys.argv[3])
|
||||
return 0
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
5becb96ee86fbda0ce98c0e0fd064f8ba092314aceaa400e3dcc785705dc3c23 ./arm64-v8a/libVkLayer_fp_shaderfix.so
|
||||
e7554c6343ee2989b0a273ee6230e65c25bfe6499eefd00de19f5f0fee58754f ./arm64-v8a/libfp_langpack.so
|
||||
321da502e0f8f46f0880aad39fe6b84bdef88f925164568814cf704a1b31a577 ./arm64-v8a/libfp_ovrp.so
|
||||
40defdaddcda53bd2649eb48076fae1622bfc2bfc88e9e03c94fc8b45af2a4f2 ./arm64-v8a/libfp_ovrtrace.so
|
||||
7522a7cfb236e48d3442d418c4820cd37760a9627c6bdef80fb0df82df5fd826 ./arm64-v8a/libfp_vk.so
|
||||
383054f8b3b41dde76d062c71856cd3163655e50009c08454bc1793f393ead65 ./arm64-v8a/libfpg.so
|
||||
5432674a59d02f411cd853a5dc57e3fa547d1ac518f25bf433fc54c43677177a ./arm64-v8a/libfpglmv.so
|
||||
8a8f6b1da8952cb3933a5b53558424a5fc56043b2527a16bb6dd62a00d2de01a ./arm64-v8a/libframe_xrshim.so
|
||||
fc559dbe0b87eecc3641256837293260cefb7c2ce7b21d808d10edd2a2dba9fc ./arm64-v8a/libglshim.so
|
||||
1655921f4c91f2f336edf0aac66d8df1b2b649a272aafe365c1f2fa7867129de ./arm64-v8a/libopenxr_loader_generic.so
|
||||
cc5b493cadefe76ad13fd096d3f8494a140ba593e0e1692db12d284bc548c1cf ./arm64-v8a/libopenxr_loader_generic.so
|
||||
1feaeafad467c4cafdf2b018a4d84b0bee200c3f711697b4ce97e66a3ba256ca ./arm64-v8a/libovrplatformcompat.so
|
||||
aa4dc0020c77e12d41ef6ce80b23ad90c9cb7e882338eddf2261efe8645cf38d ./arm64-v8a/libvrapi.so
|
||||
7943c6825e1c2841e54627f96acbd0754a3c06bb608c47f7aa15007aec2191a5 ./armeabi-v7a/libopenxr_loader_generic.so
|
||||
c10412dd76a65a1d587b7ed226367d1a6f2bec238c733c97ee67eb8870c868e8 ./armeabi-v7a/libopenxr_loader_generic.so
|
||||
1871eae093432d277da4bc751bf5f3269dfcf11f9168260b0c3caadb0dedb19d ./dex/oculusos-stubs.dex
|
||||
b634ab5640e258563c536e658cad87080553df6f34f62269a21d554844e58bfe ./hevc/COPYING.FFmpeg
|
||||
c1c2a73e269ff765ce6ed74cd19d37d2258a7499873d799c8ee4799575cd56d3 ./hevc/libstagefrighthw.so
|
||||
7d0e0677d1dc414766a966a4ad60642364b60829fa8873b51534b17c8e571870 ./hevc/manifest.json
|
||||
e4028fccc30132918160c230958aeac616ac6dbf851e6af0c1fe15517b30f2e6 ./hevc/media_codecs_frameport.xml
|
||||
66caeda1938934f5bc76d35261641ccee2020015d9932559943749fabd274088 ./hevc/podman.py.txt
|
||||
1aa733117cf57ccff7cf23f0425dbfd73b0332a3ef1c905ceeca0ccd0449c4e0 ./linux-arm64/XR_APILAYER_FRAMEPORT_timefix.json
|
||||
28c2430a02bbd8902c5bfb9562c6fd0e318654f9e05c095bfeb94b0450ab1b07 ./linux-arm64/libxr_frameport_timefix.so
|
||||
b10b3a5c10c3339fc63fd9f6cb4d01ea29be11a863d0ebad1389ea69fd471940 ./linux-arm64-bin/fp_venc
|
||||
|
||||
@@ -1,502 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"runtime_sha256": "456e912c75cd389abcf6a63bc80e2a53bdc334371d00b200c93680388ae955e2",
|
||||
"files": {
|
||||
"libstagefrighthw.so": "c1c2a73e269ff765ce6ed74cd19d37d2258a7499873d799c8ee4799575cd56d3",
|
||||
"podman.py": "66caeda1938934f5bc76d35261641ccee2020015d9932559943749fabd274088",
|
||||
"media_codecs_frameport.xml": "e4028fccc30132918160c230958aeac616ac6dbf851e6af0c1fe15517b30f2e6",
|
||||
"COPYING.FFmpeg": "b634ab5640e258563c536e658cad87080553df6f34f62269a21d554844e58bfe"
|
||||
},
|
||||
"build": {
|
||||
"ndk_revision": "27.2.12479018",
|
||||
"ffmpeg_source_sha256": "733984395e0dbbe5c046abda2dc49a5544e7e0e1e2366bba849222ae9e3a03b1"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MediaCodecs>
|
||||
<Decoders>
|
||||
<MediaCodec name="OMX.frameport.hevc.decoder" type="video/hevc" rank="64">
|
||||
<Limit name="size" min="128x128" max="8192x8192" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="block-count" range="1-138240" />
|
||||
<Limit name="blocks-per-second" range="1-7864320" />
|
||||
<Limit name="bitrate" range="1-245000000" />
|
||||
<Limit name="concurrent-instances" max="1" />
|
||||
</MediaCodec>
|
||||
</Decoders>
|
||||
</MediaCodecs>
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
"""Add a per-game codec to Lepton's container, without editing its shared rootfs."""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
|
||||
def mounts(directory, config, args):
|
||||
if not args or args[0] != "run":
|
||||
return []
|
||||
name = None
|
||||
for i, arg in enumerate(args):
|
||||
if arg == "--name" and i + 1 < len(args):
|
||||
name = args[i + 1]
|
||||
elif arg.startswith("--name="):
|
||||
name = arg.partition("=")[2]
|
||||
if name != f"lepton-steamlaunch-{config['appid']}":
|
||||
return []
|
||||
root = Path(config["lepton"]).resolve().parent / "images" / "rootfs"
|
||||
expected_root = str(root) + ":O"
|
||||
if not any(arg == expected_root for arg in args):
|
||||
return []
|
||||
device = Path("/dev/video-dec0")
|
||||
runtime = root / "vendor/lib64/libstagefright_softomx.so"
|
||||
upstream_plugin = (root / "vendor/lib64/libstagefrighthw.so").exists()
|
||||
for i, arg in enumerate(args):
|
||||
if arg == "--mount" and i + 1 < len(args):
|
||||
fields = dict(item.split("=", 1) for item in args[i + 1].split(",") if "=" in item)
|
||||
target = fields.get("destination", fields.get("target"))
|
||||
if target == "/vendor/lib64/libstagefrighthw.so":
|
||||
upstream_plugin = True
|
||||
if target == "/vendor/lib64/libstagefright_softomx.so" and fields.get("source"):
|
||||
runtime = Path(fields["source"])
|
||||
if upstream_plugin:
|
||||
print("FramePort HEVC: using the runtime's hardware codec plugin", file=sys.stderr)
|
||||
return []
|
||||
if not device.exists() or hashlib.sha256(runtime.read_bytes()).hexdigest() != config["runtime_sha256"]:
|
||||
print("FramePort HEVC: device or runtime ABI differs; retaining the stock codecs", file=sys.stderr)
|
||||
return []
|
||||
xml = ET.parse(root / "vendor/etc/media_codecs.xml")
|
||||
ET.SubElement(xml.getroot(), "Include", href="media_codecs_frameport.xml")
|
||||
merged = directory / "media_codecs.xml"
|
||||
temporary = merged.with_suffix(".tmp")
|
||||
xml.write(temporary, encoding="utf-8", xml_declaration=True)
|
||||
temporary.replace(merged)
|
||||
# Lepton supplies its own /dev tmpfs. A Podman --device node disappears
|
||||
# beneath it; a bind mount matches Lepton's existing GPU/sound device setup.
|
||||
result = ["--mount", f"type=bind,source={device},destination=/dev/video-dec0,rw"]
|
||||
for source, target in (
|
||||
("libstagefrighthw.so", "/vendor/lib64/libstagefrighthw.so"),
|
||||
("media_codecs.xml", "/vendor/etc/media_codecs.xml"),
|
||||
("media_codecs_frameport.xml", "/vendor/etc/media_codecs_frameport.xml"),
|
||||
):
|
||||
result += ["--mount", f"type=bind,source={directory / source},destination={target},ro"]
|
||||
print("FramePort HEVC: loading the Iris hardware codec plugin for this container", file=sys.stderr)
|
||||
return result
|
||||
|
||||
|
||||
def real_podman(directory):
|
||||
"""Find Podman independently of deployment.json, without recursing into this wrapper."""
|
||||
own_bin = (directory / "bin").resolve()
|
||||
own_script = Path(__file__).resolve()
|
||||
for entry in os.environ.get("PATH", os.defpath).split(os.pathsep):
|
||||
folder = Path(entry or os.curdir).resolve()
|
||||
if folder == own_bin:
|
||||
continue
|
||||
found = shutil.which("podman", path=str(folder))
|
||||
if found:
|
||||
executable = Path(found).resolve()
|
||||
if executable.parent != own_bin and executable != own_script:
|
||||
return str(executable)
|
||||
raise RuntimeError("no real Podman executable found outside the codec wrapper directory")
|
||||
|
||||
|
||||
def main():
|
||||
directory = Path(__file__).resolve().parent.parent
|
||||
args = sys.argv[1:]
|
||||
fallback = real_podman(directory)
|
||||
try:
|
||||
config = json.loads((directory / "deployment.json").read_text())
|
||||
podman = Path(config["podman"]).resolve()
|
||||
if podman.parent == (directory / "bin").resolve() or podman == Path(__file__).resolve():
|
||||
raise ValueError("configured Podman points to the codec wrapper")
|
||||
extra = mounts(directory, config, args)
|
||||
launch_args = [args[0], *extra, *args[1:]] if extra else args
|
||||
os.execv(str(podman), [str(podman), *launch_args])
|
||||
except Exception as exc: # a codec/configuration failure must never prevent the stock container from starting
|
||||
print(f"FramePort HEVC: retaining stock codecs: {exc}", file=sys.stderr)
|
||||
os.execv(fallback, [fallback, *args])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,24 +0,0 @@
|
||||
package: com.CyberneticWalrus.DoesitStackMeta
|
||||
title: Does it Stack?
|
||||
status: issues
|
||||
notes: Mixed reality mode does not work (works on Demeo), everything else seems to be OK
|
||||
tested_version: 1.02 (3683)
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.oculusos
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
refresh_rate: 90.0
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: e9fce6ac812f1bb317a7a6959be89c5ff54e87f56af9ad4c42dff5fecad4efe8
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261006.6173745'
|
||||
agent: 59
|
||||
issue: 112
|
||||
source_hint: Does It Stack
|
||||
@@ -1,20 +0,0 @@
|
||||
package: com.ForwardXP.nuke
|
||||
title: Please Don't Touch Anything
|
||||
status: works
|
||||
notes: Seems functional
|
||||
tested_version: '2.2'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-08'
|
||||
known_good_sha256: 17460c8691b9ff82f6c7ca5597afd0aacf1a94aa30ebb6a6108802991b60f51b
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261006.6173745'
|
||||
agent: 59
|
||||
issue: 106
|
||||
source_hint: apks
|
||||
@@ -1,21 +0,0 @@
|
||||
package: com.FunktronicLabs.TheLightBrigade
|
||||
title: The Light Brigade
|
||||
status: issues
|
||||
notes: Judder in weapons
|
||||
tested_version: '746'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 59
|
||||
issue: 114
|
||||
source_hint: The Light Brigade
|
||||
@@ -1,36 +1,20 @@
|
||||
package: com.ILMxLAB.VaderImmortal.ep1
|
||||
title: 'Vader Immortal: Episode I'
|
||||
status: works
|
||||
notes: 'Plays (owner''s headset test): loading card, grip/trigger, hands and the lightspeed sequence fixed. Thumbs
|
||||
follow the touches with frame.unreal_thumb_touch (Klownicle''s engine fix).'
|
||||
details: Unreal Engine 4 (GLES). Found and verified in gameplay on a Frame by Klownicle (GitHub issue 49); FramePort
|
||||
reimplements them as patches that match the game's code exactly and change nothing when it differs. The engine's
|
||||
Quest checks (IsRunningOnSantaCruz) answer "not a Quest" on the Frame - the menu waited for a Quest-only shader
|
||||
precompile that never starts (frame.unreal_quest_precompile makes the non-Quest branch report 100 %), and the
|
||||
game's key map picked the empty Gear VR controls (frame.unreal_quest_keymap keeps the Quest set). Two lightspeed
|
||||
shaders, as the Frame's GL driver (Zink) compiles them, read loop counters and accumulators before setting them
|
||||
and hang the GPU; a Vulkan layer under Zink inserts the stores that zero them (frame.zink_shader_fix, zink_shader_fix;
|
||||
the captured modules are from Lepton 2.8.14 and stop matching if a Frame update changes the driver's output -
|
||||
the layer logs that). OVRPlugin asks for poses at its own clock (pose_time_fix). Unreal's Oculus input animates the
|
||||
thumbs from near-touch, which the Frame never reports (frame.unreal_thumb_touch reads the touches instead; binding
|
||||
the proximity to the touch inputs in FrameBridge didn't reach the game). The Frame's SteamVR runtime
|
||||
leaks about 20 MB a second while the game runs (reported to Valve).
|
||||
status: issues
|
||||
notes: Starts in VR and plays the intro, then stays on the loading card (Vader's portrait with a progress bar).
|
||||
details: Unreal Engine 4 (GLES). After the Lucasfilm intro the game shows its loading card and never loads the next
|
||||
scene; it keeps rendering at 72 fps and ignores input. Ruled out so far - Meta platform requests (all answered),
|
||||
video playback (the intro is a video and plays), the no-ForceQuit build, frame and swapchain handling. The Frame's
|
||||
SteamVR runtime also leaks about 20 MB of memory a second while the game runs, which slows it down after a few
|
||||
minutes. Next steps - find what the loading code waits for in the game's engine library (no symbols) and report
|
||||
the runtime leak to Valve. GitHub issue 49.
|
||||
tested_version: 1.1.1+667256.cl.387770
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.unreal_quest_precompile
|
||||
- frame.unreal_quest_keymap
|
||||
- frame.unreal_thumb_touch
|
||||
- frame.zink_shader_fix
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
zink_shader_fix: 12016:b2919629761ad268e0b21c72ac8520f81b76e72c3adc26897f97eae9a3e70a66:3092:0x0003003e,166,82,0x0003003e,177,82,0x0003003e,183,82,0x0003003e,189,82,0x0003003e,256,82,0x0003003e,266,82,0x0003003e,272,82,0x0003003e,278,82,0x0003003e,318,82,0x0003003e,328,82,0x0003003e,334,82,0x0003003e,340,82;11436:6f18be49f2aaa2452f962eb16f7af744c5c22a7b25f37ce681e0d6399e35a869:2932:0x0003003e,164,80,0x0003003e,175,80,0x0003003e,181,80,0x0003003e,187,80,0x0003003e,254,80,0x0003003e,264,80,0x0003003e,270,80,0x0003003e,276,80,0x0003003e,316,80,0x0003003e,326,80,0x0003003e,332,80,0x0003003e,338,80
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
date: '2026-10-06'
|
||||
issue: 49
|
||||
updated: '2026-10-09'
|
||||
min_app: 0.12.1
|
||||
updated: '2026-10-06'
|
||||
source_hint: Vader Immortal- Episode I
|
||||
@@ -1,24 +0,0 @@
|
||||
package: com.ILMxLAB.VaderImmortal.ep2
|
||||
title: 'Vader Immortal: Episode II'
|
||||
status: works
|
||||
notes: Plays (owner's headset test, 2026-10-09) with Episode I's fixes, which FramePort finds in this episode's
|
||||
code too.
|
||||
details: 'Unreal Engine 4 (GLES), the same engine build as Episode I: the Quest-only shader precompile and key map
|
||||
(frame.unreal_quest_precompile, frame.unreal_quest_keymap), thumbs from the capacitive touches (frame.unreal_thumb_touch)
|
||||
and poses at OVRPlugin''s clock (pose_time_fix). Episode I''s lightspeed shader fix doesn''t apply. The campaign
|
||||
intro once stayed black with its dialogue playing; it rendered on the next run.'
|
||||
tested_version: 2.0.3+667261.cl.387778
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.unreal_quest_precompile
|
||||
- frame.unreal_quest_keymap
|
||||
- frame.unreal_thumb_touch
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
min_app: 0.12.1
|
||||
source_hint: Vader Immortal- Episode II
|
||||
@@ -1,24 +0,0 @@
|
||||
package: com.ILMxLAB.VaderImmortal.ep3
|
||||
title: 'Vader Immortal: Episode III'
|
||||
status: works
|
||||
notes: Plays (owner's headset test, 2026-10-09) with Episode I's fixes, which FramePort finds in this episode's
|
||||
code too.
|
||||
details: 'Unreal Engine 4 (GLES), the same engine build as Episode I: the Quest-only shader precompile and key map
|
||||
(frame.unreal_quest_precompile, frame.unreal_quest_keymap), thumbs from the capacitive touches (frame.unreal_thumb_touch)
|
||||
and poses at OVRPlugin''s clock (pose_time_fix). Episode I''s lightspeed shader fix doesn''t apply. The campaign
|
||||
intro starts on a black screen with only dialogue: that is the game, not a bug.'
|
||||
tested_version: 3.0.3+667263.cl.387932
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.unreal_quest_precompile
|
||||
- frame.unreal_quest_keymap
|
||||
- frame.unreal_thumb_touch
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
min_app: 0.12.1
|
||||
source_hint: Vader Immortal- Episode III
|
||||
@@ -1,24 +0,0 @@
|
||||
package: com.MightyCoconut.WalkaboutMiniGolf
|
||||
title: Walkabout Mini Golf
|
||||
status: works
|
||||
tested_version: '6.7'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.oculusos
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
controller_models: 1
|
||||
haptic_fix: 1
|
||||
scale: 1.5
|
||||
verified:
|
||||
date: '2026-10-08'
|
||||
known_good_sha256: cf3b5cbe131af8a2baaa3f5c665b1c7001c8b299473abfcf98d90e3c02b08a2f
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 59
|
||||
issue: 111
|
||||
source_hint: Walkabout Mini Golf
|
||||
@@ -1,14 +1,12 @@
|
||||
package: com.PixelToys.BattleSisters
|
||||
title: BattleSisters
|
||||
status: works
|
||||
notes: Plays; controller buttons and vibration work, hands follow the controllers (pose_time_fix).
|
||||
details: Unity 2019.4 with Unity's built-in Oculus support. frame.unity_oculus_check starts VR (Meta's system-app
|
||||
check), adds the frame wait its legacy loop never makes (without it the GPU hung, black screen) and lets Unity's
|
||||
Oculus input accept Lepton's device model (it only reported controllers on a device named "Oculus ...", so buttons
|
||||
were dead). haptic_fix stops the first controller vibration from freezing the Frame (OVRPort's loader read its
|
||||
duration in nanoseconds as seconds and the game ran out of memory). With pose_time_fix the hands follow the controllers
|
||||
- OVRPlugin asked for hand poses at Android's monotonic "now", which on SteamOS 0.4.5 is 2.56 s behind the runtime's
|
||||
XrTime, so the hands lagged far behind.
|
||||
notes: Starts in VR; controller buttons and vibration work.
|
||||
details: Unity 2019.4 with Unity's built-in Oculus support. frame.unity_oculus_check starts VR (Meta's system-app check),
|
||||
adds the frame wait its legacy loop never makes (without it the GPU hung, black screen) and lets Unity's Oculus
|
||||
input accept Lepton's device model (it only reported controllers on a device named "Oculus ...", so buttons were
|
||||
dead). haptic_fix stops the first controller vibration from freezing the Frame (OVRPort's loader read its duration
|
||||
in nanoseconds as seconds and the game ran out of memory).
|
||||
tested_version: 1.2.4
|
||||
engine: Unity
|
||||
xr: VrApi
|
||||
@@ -20,10 +18,9 @@ frame:
|
||||
- frame.unity_gl_shim
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-10-08'
|
||||
date: '2026-10-06'
|
||||
issue: 48
|
||||
updated: '2026-10-08'
|
||||
min_app: 0.12.1
|
||||
updated: '2026-10-06'
|
||||
min_app: 0.11.1
|
||||
source_hint: Battle Sister
|
||||
@@ -1,22 +0,0 @@
|
||||
package: com.ToastVR.Matilda
|
||||
title: Max Mustard
|
||||
status: works
|
||||
tested_version: 1.1.0
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
verified:
|
||||
date: '2026-10-08'
|
||||
known_good_sha256: 9a67459fa36c3b9ac0d035e6c43b1809b39772699333e8cfd7d2a4d7f17926a7
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 59
|
||||
issue: 110
|
||||
updated: '2026-10-09'
|
||||
source_hint: com.ToastVR.Matilda
|
||||
@@ -1,23 +1,16 @@
|
||||
package: com.YourCompany.RoboRecall
|
||||
title: Robo Recall
|
||||
status: works
|
||||
notes: Needed the LAUNCHER category fix.
|
||||
details: Source APK is a community 'patch+savefix+90Hz' build. Shares Vader Immortal's Unreal 4 Oculus input (GitHub
|
||||
49) - thumbs follow the touches (frame.unreal_thumb_touch) and controller poses are located at the right time
|
||||
(pose_time_fix); added 2026-10-09 from Vader's headset results, not yet checked in this game.
|
||||
tested_version: '1.0'
|
||||
source_hint: 'Robo Recall- Unplugged'
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
status: works
|
||||
notes: Needed the LAUNCHER category fix.
|
||||
details: Source APK is a community 'patch+savefix+90Hz' build.
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.unreal_thumb_touch
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: 4ce6e3563da131e288645f4b62a634ac98043e55bc42b7c0ad5f461207d5f53c
|
||||
updated: '2026-10-09'
|
||||
source_hint: Robo Recall- Unplugged
|
||||
@@ -1,23 +0,0 @@
|
||||
package: com.asg.clockworkdev
|
||||
title: Clockwork
|
||||
status: works
|
||||
tested_version: '1.29'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_runtime_msaa_off
|
||||
- frame.unity_gl_shim
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: 99a14eed320ba267153963c2d87d4e11e943b9920d48dfd5352c681de28ba95e
|
||||
app: 0.12.1.dev203
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 67
|
||||
issue: 116
|
||||
source_hint: com.asg.clockworkdev
|
||||
@@ -1,21 +1,16 @@
|
||||
package: com.camouflaj.manta
|
||||
title: 'Batman: Arkham Shadow'
|
||||
status: works
|
||||
notes: Large data set (~27 GiB) incl. all language packs.
|
||||
details: 'Uses Meta XR Audio (Wwise), handled by patch_meta_xr_audio. Includes all language packs (~28 GB). sync_guard
|
||||
(to test, GitHub #102) - a reporter''s game quit to Steam''s waiting screen after the Frame runtime crashed in
|
||||
xrSyncActions (CVRInputLatest::UpdateActionState), the input race Myst had.'
|
||||
tested_version: 1.4.1-350961
|
||||
source_hint: 'Batman- Arkham Shadow'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
status: works
|
||||
notes: Large data set (~27 GiB) incl. all language packs.
|
||||
details: Uses Meta XR Audio (Wwise), handled by patch_meta_xr_audio. Includes all language packs (~28 GB).
|
||||
overport_extra:
|
||||
- patch_disable_space_warp
|
||||
adapter:
|
||||
sync_guard: 1
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: 796d1cab08f614d72c50d9702974c719c0908f5de91183cfe02d1fd5eb09551a
|
||||
updated: '2026-10-09'
|
||||
source_hint: Batman- Arkham Shadow
|
||||
@@ -1,24 +1,18 @@
|
||||
package: com.forcefieldxr.timestall
|
||||
title: Time Stall
|
||||
status: issues
|
||||
notes: Both eyes distort during movement (unresolved).
|
||||
details: Legacy VrApi via OVRPlugin. Shares Vader Immortal's Unreal 4 Oculus input (GitHub 49) - thumbs follow the
|
||||
touches (frame.unreal_thumb_touch) and controller poses are located at the right time (pose_time_fix); added 2026-10-09
|
||||
from Vader's headset results, not yet checked in this game.
|
||||
tested_version: '1.0'
|
||||
source_hint: Time Stall
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
status: issues
|
||||
notes: Both eyes distort during movement (unresolved).
|
||||
details: Legacy VrApi via OVRPlugin.
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.unreal_thumb_touch
|
||||
- frame.nodebug
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: 50c4d05b663b2f1851f5a7d650a89fd34587d65fafba13cc58671c96f7016db6
|
||||
updated: '2026-10-09'
|
||||
source_hint: Time Stall
|
||||
@@ -1,27 +0,0 @@
|
||||
package: com.ilmxlab.tales
|
||||
title: 'Star Wars: Tales from the Galaxy''s Edge'
|
||||
status: unknown
|
||||
notes: Not working yet - after the intro logos and a loading animation the picture goes black (GitHub issue 61).
|
||||
Gets the controller fixes found for Vader Immortal (same studio) to test.
|
||||
details: Unreal Engine 4 (GLES) by ILMxLAB, like Vader Immortal, but a different engine build - it has none of Vader's
|
||||
Quest-only branches (no GetQuestShaderPrecompilePercent or RPOC key map; it precompiles shaders through Unreal's
|
||||
own pipeline cache), so frame.unreal_quest_precompile/_keymap don't apply. Its seasons and Wwise banks are Meta
|
||||
platform asset files (frame.asset_files). Vader's OVRPlugin findings apply to it as well - poses asked for at
|
||||
OVRPlugin's own clock (pose_time_fix) and thumbs from near-touch, which the Frame never reports (frame.unreal_thumb_touch).
|
||||
Ruled out for the black picture so far (see the diagnostics in issue 61) - asset-file paks, Valve's foveation,
|
||||
GL errors; the game's own eye image reads back black.
|
||||
tested_version: 1.1.9+734762.cl.439699
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
frame:
|
||||
- frame.asset_files
|
||||
- frame.unreal_thumb_touch
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
issue: 61
|
||||
updated: '2026-10-09'
|
||||
min_app: 0.12.1
|
||||
source_hint: Star Wars- Tales from the Galaxys Edge
|
||||
@@ -1,24 +0,0 @@
|
||||
package: com.markschramm.gravitylab
|
||||
title: Gravity Lab
|
||||
status: works
|
||||
notes: Works great, along with passthrough mode
|
||||
tested_version: '1.221'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_runtime_msaa_off
|
||||
- frame.unity_gl_shim
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: 82c95ee7487a130b6e37b967dd97c8362bf4d7e873fcff823f2c7877a62ff99f
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 59
|
||||
issue: 113
|
||||
source_hint: Gravity Lab
|
||||
@@ -1,25 +1,18 @@
|
||||
package: com.nDreams.PhantomQuest
|
||||
title: 'Phantom: Covert Ops'
|
||||
tested_version: '1.2'
|
||||
source_hint: 'Phantom- Covert Ops'
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
status: issues
|
||||
notes: DLC/store button crashes (no Meta store). Installs the no-ForceQuit build.
|
||||
details: The regular build quits itself on the Frame (System.exit after a failed platform check), so the no-ForceQuit
|
||||
build is installed. Shares Vader Immortal's Unreal 4 Oculus input (GitHub 49) - thumbs follow the touches (frame.unreal_thumb_touch)
|
||||
and controller poses are located at the right time (pose_time_fix); added 2026-10-09 from Vader's headset results,
|
||||
not yet checked in this game.
|
||||
tested_version: '1.2'
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
build is installed.
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
use_alt: true
|
||||
frame:
|
||||
- frame.unreal_thumb_touch
|
||||
adapter:
|
||||
pose_time_fix: 1
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: bb02b20a23fbe5e7a580ecde15a3cd015a4183421a51aab4a4dbcddbe7a09d1d
|
||||
updated: '2026-10-09'
|
||||
source_hint: Phantom- Covert Ops
|
||||
@@ -1,21 +0,0 @@
|
||||
package: jp.co.amata.nvr
|
||||
title: The Tale of Onogoro
|
||||
status: works
|
||||
tested_version: 1.1.0248
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
haptic_fix: 1
|
||||
verified:
|
||||
date: '2026-10-08'
|
||||
known_good_sha256: d6258a22a0a6e4588bbec36170f126bffc44ed64784f99e37cf4b03ad212fb79
|
||||
app: 0.12.0
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261006.6173745'
|
||||
agent: 59
|
||||
issue: 108
|
||||
source_hint: The Tale of Onogoro
|
||||
@@ -1,23 +0,0 @@
|
||||
package: rift.beat_saber
|
||||
title: Beat Saber
|
||||
status: works
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive.'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
kind: rift
|
||||
quest_package: com.beatgames.beatsaber.lj369vr
|
||||
pcvr:
|
||||
- pcvr.xr_timefix
|
||||
- pcvr.steamvr_tuning
|
||||
pcvr_remove:
|
||||
- pcvr.revive
|
||||
as_is: true
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: dc80bd1f8e46e7b7cdc4fbf51a84e68f2918d7481581bee9c21f65e269c6bf8b
|
||||
app: 0.12.1.dev232
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 67
|
||||
issue: 117
|
||||
source_hint: Beat Saber
|
||||
@@ -1,23 +0,0 @@
|
||||
package: rift.eleven_table_tennis_vr
|
||||
title: 'Eleven: Table Tennis VR'
|
||||
status: works
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive (arguments -vrmode OpenVR).'
|
||||
engine: Unity
|
||||
xr: LibOVR+OpenVR
|
||||
kind: rift
|
||||
pcvr:
|
||||
- pcvr.launch_args
|
||||
- pcvr.xr_timefix
|
||||
- pcvr.steamvr_tuning
|
||||
pcvr_remove:
|
||||
- pcvr.revive
|
||||
as_is: true
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: 2cdfe3b096aef0bf76726156699381f7847ca4d17e7222359521982778470705
|
||||
app: 0.12.1.dev232
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 67
|
||||
issue: 118
|
||||
source_hint: Eleven Table Tennis VR
|
||||
@@ -1,22 +0,0 @@
|
||||
package: rift.pistol_whip
|
||||
title: Pistol Whip
|
||||
status: works
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive.'
|
||||
engine: Unity
|
||||
xr: OpenVR
|
||||
kind: rift
|
||||
pcvr:
|
||||
- pcvr.xr_timefix
|
||||
- pcvr.steamvr_tuning
|
||||
pcvr_remove:
|
||||
- pcvr.revive
|
||||
as_is: true
|
||||
verified:
|
||||
date: '2026-10-09'
|
||||
known_good_sha256: a01eaf73b292eb8ad21e316f1f99ad258d41b2cfed8436858a8caf2f5c0a4d28
|
||||
app: 0.12.1.dev232
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20261007.6125817'
|
||||
agent: 67
|
||||
issue: 119
|
||||
source_hint: Pistol Whip
|
||||
@@ -1,13 +1,11 @@
|
||||
package: rift.superhot_vr
|
||||
title: SUPERHOT VR
|
||||
status: works
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive. Older builds with both Oculus and SteamVR support
|
||||
(SUPERHOTVR.exe) start with -vrmode OpenVR.'
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive.'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
kind: rift
|
||||
pcvr:
|
||||
- pcvr.launch_args
|
||||
- pcvr.xr_timefix
|
||||
- pcvr.steamvr_tuning
|
||||
pcvr_remove:
|
||||
@@ -19,5 +17,4 @@ verified:
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
issue: 28
|
||||
updated: '2026-10-09'
|
||||
source_hint: SUPERHOT VR
|
||||
@@ -1,9 +1,6 @@
|
||||
# Log signature -> diagnosis -> suggested fix. Matched against the game's launch.log (Lepton logcat mirror).
|
||||
# `pattern` is a Python regex (case-sensitive). `suggest` lists patch ids (+ optional params) the UI offers as
|
||||
# "apply and rebuild"; an entry `adapter.<key>=<value>` sets that value (else 1). `severity`: fatal (the game can't
|
||||
# run) | error | warning | info. `question`: a symptom only the player sees (play sessions, GUI "Last session"): its
|
||||
# fix is offered as that question, never applied on its own. `report: true` = the useful next step is a problem report
|
||||
# with diagnostics. Launch tests and real play sessions (agent session_log, `frameport session`) are both matched.
|
||||
# "apply and rebuild". `severity`: fatal (the game can't run) | error | warning | info.
|
||||
# Sources: every failure we hit porting 34 games to the Steam Frame (see docs/PLAYBOOK.md).
|
||||
signatures:
|
||||
- id: no-launcher
|
||||
@@ -37,7 +34,7 @@ signatures:
|
||||
diagnosis: Unity's render thread crashed inside the Frame's GL driver (Mesa/Zink); the picture freezes or stays grey. Known triggers - an OVROverlay copy (try "Unity - skip OVROverlay layers", e.g. The Room VR), MSAA switched on at runtime, a GPU hang (zink DEVICE LOST).
|
||||
suggest: [frame.unity_no_overlay_copy, frame.unity_runtime_msaa_off]
|
||||
- id: unreal-msrtt-crash
|
||||
pattern: 'fault addr 0x10000 in tid \d+ \((RHIThread|RenderThread)|libgallium_dri\.so \(find_rp_state'
|
||||
pattern: 'fault addr 0x10000 in tid \d+ \((RHIThread|RenderThread)'
|
||||
severity: fatal
|
||||
diagnosis: The game's render thread jumped to address 0x10000 inside the Frame's GL driver (Mesa/Zink) a few seconds after start. Zink looks up a render-pass cache slot past its end when a game renders through multisampled render-to-texture (Unreal's mobile MSAA, e.g. Star Wars Pinball VR). Load the GL shim, which hides that extension.
|
||||
suggest: [frame.unreal_gl_shim, frame.unity_gl_shim]
|
||||
@@ -46,13 +43,6 @@ signatures:
|
||||
severity: fatal
|
||||
diagnosis: The game crashed on a return-address check (autiasp) its code never signed. The Quest's CPU ignores these checks, the Steam Frame's enforces them; some OpenSSL assembly in game engines has such unpaired checks (e.g. Star Wars Pinball VR on its first network connection, thread HttpManager).
|
||||
suggest: [frame.pac_hints]
|
||||
- id: cube-swapchain-refused
|
||||
pattern: 'xrCreateSwapchain \d+x\d+ .*faces=6 .*result=-\d+'
|
||||
unless: 'cube_standin: runtime refused'
|
||||
severity: fatal
|
||||
diagnosis: The game asked for a cube-map swapchain (e.g. an OVROverlay skybox or loading cube), which the Frame's runtime doesn't have. OVRPlugin goes on without images and crashes in ovrp_EndFrame4 (Unity's render thread SIGSEGV in memset, e.g. Budget Cuts Ultimate). FrameBridge from FramePort 0.12 serves such swapchains itself and drops their cube layers (cube_standin, GLES games) - rebuild and reinstall the game.
|
||||
suggest: [frame.adapter]
|
||||
supersedes: [unity-render-crash, native-crash]
|
||||
- id: swapchain-rect-invalid
|
||||
pattern: 'xrEndFrame failed -25\b'
|
||||
severity: fatal
|
||||
@@ -85,45 +75,11 @@ signatures:
|
||||
severity: error
|
||||
diagnosis: The Frame rejected the swapchain format (GLES games must use sRGB formats, no MSAA).
|
||||
suggest: [adapter.swapchain_fix]
|
||||
- id: zink-shader-fix-mismatch
|
||||
pattern: 'shader fix layer: a \d+-byte module differs from fix'
|
||||
severity: warning
|
||||
diagnosis: The game's OpenGL ES shader fix (zink_shader_fix) no longer matches the shader the Frame's GL driver (Zink)
|
||||
builds - a Frame or Lepton update changed the driver's output - so the shader it fixes (e.g. Vader Immortal's
|
||||
lightspeed jump) may hang the GPU again. Capture the new modules with zink_shader_dump=1 (files/fp_spirv/ in the
|
||||
game's storage) and update the fix.
|
||||
suggest: [adapter.zink_shader_dump]
|
||||
- id: zink-shader-layer-inactive
|
||||
pattern: 'shader fix layer: NOT active'
|
||||
severity: warning
|
||||
diagnosis: FramePort's shader-fix Vulkan layer couldn't add itself to the game's Vulkan layers (Android's
|
||||
GraphicsEnv functions it uses were not found or behaved differently, e.g. after a Lepton update), so the game's
|
||||
OpenGL ES shader fixes (zink_shader_fix) don't apply.
|
||||
suggest: []
|
||||
- id: zink-device-lost
|
||||
pattern: 'zink.*DEVICE[_ ]LOST|VK_ERROR_DEVICE_LOST'
|
||||
severity: fatal
|
||||
diagnosis: The GPU hung (Zink/Mesa). For GLES Unity games MSAA render-to-texture is the usual cause; at one effect
|
||||
only, a shader reading undefined loop counters (e.g. Vader Immortal's lightspeed jump - frame.zink_shader_fix).
|
||||
diagnosis: The GPU hung (Zink/Mesa). For GLES Unity games MSAA render-to-texture is the usual cause.
|
||||
suggest: [frame.unity_no_msaa, frame.unity_runtime_msaa_off]
|
||||
- id: gpu-hang
|
||||
pattern: 'kernel: .*(?i:hangcheck|gpu fault|msm_drm.*(hang|recover)|kgsl.*(hang|fault)|adreno.*(hang|fault))'
|
||||
severity: fatal
|
||||
diagnosis: The Frame's GPU hung while the game ran (the kernel reset it; the game froze or closed). Usually one
|
||||
shader or effect the Frame's driver can't handle (e.g. Vader Immortal's lightspeed jump). FramePort can't fix
|
||||
that on its own; capture the game's shaders (OpenGL ES games) and send a problem report with diagnostics, so a
|
||||
shader fix can be added for this game.
|
||||
suggest: [adapter.zink_shader_dump]
|
||||
report: true
|
||||
- id: space-warp-used
|
||||
pattern: 'xrCreateSwapchain \d+x\d+ format=(97|129) '
|
||||
unless: 'per-game: hide_space_warp=1'
|
||||
severity: info
|
||||
diagnosis: The game uses Meta's space warp (it renders half of its frames plus motion vectors, and the runtime makes
|
||||
up the rest). On the Frame that can make textures flicker, jump or smear while you move (e.g. Into The Radius 2,
|
||||
Metro Awakening). Turning it off makes the game render every frame itself.
|
||||
question: Did textures flicker, jump or smear while you moved?
|
||||
suggest: [adapter.hide_space_warp]
|
||||
- id: unity-runtime-msaa
|
||||
pattern: 'recommended MSAA level is [248]\. Switching to the recommended level'
|
||||
severity: info
|
||||
@@ -177,13 +133,6 @@ signatures:
|
||||
severity: error
|
||||
diagnosis: Shaders written for Quest drivers fail on Mesa (GLSL strictness).
|
||||
suggest: [frame.gl_shim]
|
||||
- id: gl-multiview-twin-failed
|
||||
pattern: 'GLMV\s*: twin of program \d+(: stage| failed)'
|
||||
severity: warning
|
||||
diagnosis: The multiview interposer (frame.gl_multiview_fbo) couldn't build a single-view copy of one of the
|
||||
game's shader programs (the line has the compiler's message); draws of that program into flat panels (HUD,
|
||||
menus) still stay black. Please report it with the log; turning the patch off changes nothing else.
|
||||
suggest: []
|
||||
- id: vrapi-unsupported-layer
|
||||
pattern: 'OVRPortVrApi.*Unsupported VrApi layer type (\d+)'
|
||||
severity: error
|
||||
@@ -302,12 +251,6 @@ signatures:
|
||||
diagnosis: Stress Level Zero's graphics plugin (libSLZQuestNative.so) hooks Unity's Vulkan start-up and calls an invalid function there on the Frame (e.g. BONELAB 1.2974); the game crashes or hangs before its first frame.
|
||||
suggest: [frame.slz_vulkan_hooks]
|
||||
supersedes: [java-crash, native-crash]
|
||||
- id: vivox-api31
|
||||
pattern: 'NoSuchMethodError: No virtual method \w*CommunicationDevice\w*\(.*Landroid/media/AudioManager'
|
||||
severity: fatal
|
||||
diagnosis: The game's Vivox voice-chat SDK calls Android 12 audio-routing methods (AudioManager communication devices) without checking the Android version; Lepton runs Android 11, so the app crashes (e.g. Green Hell VR). The patch makes Vivox's audio-route check return early (voice chat keeps the default route).
|
||||
suggest: [frame.vivox_audio_route]
|
||||
supersedes: [java-crash]
|
||||
- id: native-crash
|
||||
pattern: 'Fatal signal (\d+) \(SIG[A-Z]+\)'
|
||||
severity: fatal
|
||||
@@ -332,7 +275,6 @@ signatures:
|
||||
suggest: []
|
||||
- id: container-not-started
|
||||
pattern: "is not a running context|OCI runtime error"
|
||||
unless: 'Boot complete!' # Lepton 3.x prints the error while its container is still starting, then boots fine
|
||||
severity: fatal
|
||||
diagnosis: The Lepton container failed to start (see the error above it in launch.log).
|
||||
suggest: []
|
||||
@@ -416,19 +358,6 @@ signatures:
|
||||
severity: fatal
|
||||
diagnosis: The game crashed (Unreal's crash reporter started). See the game log and crash summary in the log. Common causes are that no VR runtime reached the game (Revive off) or a GPU or driver problem under Proton.
|
||||
suggest: [pcvr.revive, pcvr.proton_log, pcvr.no_crash_reporter]
|
||||
- id: unity-vr-init
|
||||
kind: pcvr
|
||||
pattern: '(?i)OpenVR failed initialization|VRInitError_(?!None\b)\w+|Initialization of device \w+ failed|Failed to (load|initialize|start) (VR|XR|OpenVR|Oculus)\b'
|
||||
severity: error
|
||||
diagnosis: The game's Unity log shows that a VR device failed to start. Unity games built for both the Oculus and the SteamVR (OpenVR) runtime choose one with an argument; without it they may try Oculus, which the Frame doesn't have, and run without VR or quit. Start the game with -vrmode OpenVR (Game arguments).
|
||||
suggest: [pcvr.launch_args]
|
||||
- id: unity-crash
|
||||
kind: pcvr
|
||||
pattern: 'Crash!!!|caused an Access Violation|caused an Unhandled Exception'
|
||||
severity: fatal
|
||||
diagnosis: The game crashed (Unity's crash handler wrote a report; the Unity log in the launch log shows the stack). Common causes are that no VR runtime reached the game or a GPU or driver problem under Proton.
|
||||
suggest: [pcvr.proton_log]
|
||||
supersedes: [wine-crash]
|
||||
- id: wine-crash
|
||||
kind: pcvr
|
||||
pattern: 'Unhandled exception: page fault|wine: Unhandled|Backtrace:'
|
||||
|
||||
@@ -6,7 +6,7 @@ Other games get suggested patches from detection rules; each suggestion states i
|
||||
switched on or off under **Customize**: described in plain words, with **Show technical details** for the exact
|
||||
effect of each patch.
|
||||
|
||||
Tried an untested game? Its page asks how it runs; **Share working config…** opens a prefilled GitHub issue so your
|
||||
Tried an untested game? Its page asks how it runs; **Share working recipe…** opens a prefilled GitHub issue so your
|
||||
recipe can join the built-in catalog for everyone.
|
||||
|
||||

|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Two ways users feed results back, both without a GitHub token:
|
||||
|
||||
- **Share working config** (game menu, `frameport share-recipe <pkg>`): saves the recipe as a user catalog entry and
|
||||
- **Share working recipe** (game menu, `frameport share-recipe <pkg>`): saves the recipe as a user catalog entry and
|
||||
opens a prefilled issue from `.github/ISSUE_TEMPLATE/working-config.yml`. A maintainer checks it and adds the label
|
||||
`catalog-accepted`. Then `.github/workflows/catalog-from-issue.yml` runs `scripts/catalog_from_issue.py`, which reads
|
||||
only the YAML block, validates it, and writes `catalog/games/<pkg>.yaml`, and the workflow opens a PR.
|
||||
@@ -38,8 +38,6 @@ games/<pkg>/package/ stand-in for the game files (no content):
|
||||
games/<pkg>/target/ from the Frame (or the PC): launch.sh, settings.conf, deployment.json, launch.log,
|
||||
launch-test.log (PC VR), lepton-steamlaunch-<appid>.log, logcat-{main,crash,system,...}.log,
|
||||
ReviveInjector.txt / steam-<appid>.log / game-log-N.txt (PC VR), files.json (+ missing)
|
||||
(game-log-N.txt: Unreal Saved/Logs + crash summaries, Unity Player.log / Player-prev.log /
|
||||
output_log.txt + crash error.log from the Proton prefix, agent v67)
|
||||
```
|
||||
Each log keeps at most its last 4 MB (2 MB per file from the Frame).
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Games/ ← scan this folder (Add games → Scan
|
||||
as alternates.
|
||||
- **Scanning:** pick the folder that contains the game folders (`Games/` above) to add them all, or one game's folder
|
||||
to add just that game. FramePort looks up to 5 levels deep.
|
||||
- **A single game:** Add games → Add an APK file… works with a lone APK too. Its data is found when the data folder sits next
|
||||
- **A single game:** Add games → Add an APK… works with a lone APK too. Its data is found when the data folder sits next
|
||||
to the APK, named as above.
|
||||
|
||||
Not sure of the package name? Look at the OBB file names: `main.<version>.<package name>.obb`. Or add the APK
|
||||
|
||||
@@ -76,13 +76,6 @@
|
||||
`device.foveation`: `fixed` = `FDM_DEBUG=disable_offsets`, `off` = `VK_INSTANCE_LAYERS=""`. Lepton passes `FDM`,
|
||||
`FDM_DEBUG`, `FOVE_LEVEL` and `FDM_SWAPCHAIN_SIZE` through to the container (liblepton/mounting.sh PASSTHROUGH_VARS);
|
||||
the layers are chosen on the host, so setting them inside the game does nothing.
|
||||
- How Lepton loads them: `liblepton/vulkan_layers.sh` mounts the chosen layers (only those in the OS image's
|
||||
`/usr/share/guestos/android/vendor/vulkan_layers`) into the app's lib dir and writes their names to Android's
|
||||
`settings global gpu_debug_layers` for `gpu_debug_app` = the game; Android's loader reads that list from GraphicsEnv
|
||||
at each vkCreateInstance and searches the app's lib dir (`/data/app/…/lib/arm64`). A layer bundled in the APK is
|
||||
found there too; FramePort's shader-fix layer (`frame.zink_shader_fix`) adds its own name to GraphicsEnv's list from
|
||||
inside the process (`android::GraphicsEnv::setDebugLayers`, exported by the guest's libgraphicsenv.so, Lepton 3.0.5).
|
||||
That is the only way to reach the Vulkan side of OpenGL ES games (Zink creates the instance inside Mesa).
|
||||
- GL ES: Zink (Mesa GL on Vulkan). Strict GLSL (see PLAYBOOK) and occasional `DEVICE LOST` with MSAA render-to-texture.
|
||||
|
||||
## Proton / Windows games (surveyed 2026-09-29; running a Rift game under it not yet verified)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Tested games
|
||||
|
||||
Games tested on the Steam Frame with FramePort's recipes. Games not listed here may work too: FramePort suggests patches for them, and a working config can be shared from the app (**Share working config…**).
|
||||
Games tested on the Steam Frame with FramePort's recipes. Games not listed here may work too: FramePort suggests patches for them, and a working recipe can be shared from the app (**Share working recipe…**).
|
||||
Tested a game? [Share a working config](https://github.com/spoopyghosty0/frameport/issues/new?template=working-config.yml) or [report a problem](https://github.com/spoopyghosty0/frameport/issues/new?template=bug-report.yml) (in the app: the game's **…** menu does both and fills in the details).
|
||||
Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
|
||||
@@ -30,7 +30,6 @@ Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
| Espire 2 | Quest | ✅ Works | |
|
||||
| Genotype | Quest | ✅ Works | |
|
||||
| GORN2 | Quest | ✅ Works | |
|
||||
| Gravity Lab | Quest | ✅ Works | |
|
||||
| H.U.N.T | Quest | ✅ Works | |
|
||||
| I Am Cat | Quest | ✅ Works | |
|
||||
| I Am Monkey | Quest | ✅ Works | |
|
||||
@@ -44,7 +43,6 @@ Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
| Lucky's Tale | Quest | ✅ Works | |
|
||||
| Marvel's Deadpool VR | Quest | ✅ Works | |
|
||||
| Marvel's Iron Man VR | Quest | ✅ Works | |
|
||||
| Max Mustard | Quest | ✅ Works | |
|
||||
| Medieval Dynasty New Settlement | Quest | ✅ Works | |
|
||||
| Metro Awakening | Quest | ✅ Works | |
|
||||
| Mobile Suit Gundam: Silver Phantom | Quest | ✅ Works | |
|
||||
@@ -54,7 +52,6 @@ Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
| palazzo_santacruz | Quest | ✅ Works | |
|
||||
| Path of the Warrior | Quest | ✅ Works | |
|
||||
| Pistol Whip | Quest | ✅ Works | |
|
||||
| Please Don't Touch Anything | Quest | ✅ Works | |
|
||||
| PowerWash Simulator VR | Quest | ✅ Works | |
|
||||
| QuestCraft | Quest | ✅ Works | |
|
||||
| Retronika | Quest | ✅ Works | |
|
||||
@@ -74,27 +71,23 @@ Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
| The Boys VR | Quest | ✅ Works | |
|
||||
| The Climb 2 | Quest | ✅ Works | |
|
||||
| The Room VR | Quest | ✅ Works | |
|
||||
| The Tale of Onogoro | Quest | ✅ Works | |
|
||||
| Time Crisis VR (Experimental) | Quest | ✅ Works | |
|
||||
| Toy Master | Quest | ✅ Works | |
|
||||
| Under Cover | Quest | ✅ Works | |
|
||||
| Vader Immortal: Episode I | Quest | ✅ Works | |
|
||||
| VR HOT Quest | Quest | ✅ Works | |
|
||||
| VR4 | Quest | ✅ Works | |
|
||||
| Walkabout Mini Golf | Quest | ✅ Works | |
|
||||
| Wallace & Gromit in The Grand Getaway | Quest | ✅ Works | |
|
||||
| Waltz of the Wizard: Extended Edition | Quest | ✅ Works | |
|
||||
| Wander | Quest | ✅ Works | |
|
||||
| Arcsmith | Quest | ⚠️ Works with issues | Right eye distorts during movement (unresolved; swap, tracking, Valve layers, depth and pacing ruled out). |
|
||||
| Assassin's Creed Nexus | Quest | ⚠️ Works with issues | Some launch warning text is still upside down; the rest of the UI is fixed by flip emulation. |
|
||||
| Does it Stack? | Quest | ⚠️ Works with issues | Mixed reality mode does not work (works on Demeo), everything else seems to be OK |
|
||||
| Doom3Quest | Quest | ⚠️ Works with issues | PDA shows black screen. |
|
||||
| Myst | Quest | ⚠️ Works with issues | Minor graphical glitches on some objects. |
|
||||
| Phantom: Covert Ops | Quest | ⚠️ Works with issues | DLC/store button crashes (no Meta store). |
|
||||
| Pinball FX VR | Quest | ⚠️ Works with issues | Plays; mixed reality mode not working yet. |
|
||||
| Silhouette | Quest | ⚠️ Works with issues | Hand-tracking game; the Frame synthesizes hands from controllers, so it is janky. |
|
||||
| The Light Brigade | Quest | ⚠️ Works with issues | Judder in weapons |
|
||||
| Time Stall | Quest | ⚠️ Works with issues | Both eyes distort during movement (unresolved). |
|
||||
| Vader Immortal: Episode I | Quest | ⚠️ Works with issues | Starts in VR and plays the intro, then stays on the loading card (Vader's portrait with a progress bar). |
|
||||
| WiiCompiled VR | Quest | ⚠️ Works with issues | To add a game: in FramePort's Files tab, upload your .wcgame file to this game's storage, folder Android/data/org.wiicompiled.quest/files/WiiCompiledOpenXRVR… |
|
||||
| BlazeRush | Quest | ❌ Doesn't run | Starts and reaches the menu room, but the room shows no controllers and ignores all input (it all reaches the game); no fix yet. |
|
||||
| Espire 1: VR Operative (Quest Edition) | Quest | ❌ Doesn't run | Mesa GL driver crash during texture upload. |
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Installing FramePort
|
||||
|
||||
▶ **[Watch the install tutorial](media/frameport-install.mp4)** (about 90 seconds, MP4; also attached to every
|
||||
release as `FramePort-install.mp4`): from the download to the first game on the Frame.
|
||||
|
||||
[](media/frameport-install.mp4)
|
||||
|
||||
Download the archive for your computer from the [latest release](https://github.com/spoopyghosty0/frameport/releases/latest)
|
||||
and extract it anywhere. No installer or admin rights are needed. On first start FramePort downloads its Java
|
||||
runtime, the OVRPort CLI and apksigner into its data folder (Settings → Tools shows them).
|
||||
@@ -99,7 +104,7 @@ which would end Desktop Mode). This is new: please report anything odd with **Re
|
||||
back/home/recents buttons are hidden by default (patch **Hide Android's navigation bar**). If FramePort guesses
|
||||
wrong (a phone app shows nothing in the headset, or a VR app opens as a flat window), choose **VR** or **Flat
|
||||
window** under **Show as VR or as a flat window** in the game's **Customize** section, then **Update on Frame**.
|
||||
- **Add games → Add a Windows program (.exe)…** adds a single Windows program; the Frame runs it through Proton (as a
|
||||
- **Add games → Add a Windows program…** adds a single Windows program; the Frame runs it through Proton (as a
|
||||
window unless it is a VR game). A program sitting in Downloads, the home folder or a drive root is copied on its
|
||||
own first, so the install doesn't upload everything next to it.
|
||||
- In the packaged app you can also **drag files onto the Library**: APKs, Linux apps (AppImage, `.zip`/`.tar.gz`),
|
||||
@@ -114,7 +119,7 @@ sideloader, documented at framedropvr.com/docs). FramePort understands the same
|
||||
the title, the files, their size and whether a checksum is given, and asks before it downloads anything. Then it
|
||||
downloads the build, adds it to your library and starts the usual install on the Frame. If no Frame is connected,
|
||||
the game is added now and installs once the Frame is back.
|
||||
- **Add games → Install from a link…** takes the button's address (right-click → Copy link), a `framedrop://` or
|
||||
- **Add games → Add from a link…** takes the button's address (right-click → Copy link), a `framedrop://` or
|
||||
`frameport://` link, a manifest (`.json`) or a direct link to an APK, a Linux build or a Windows program. Use it on
|
||||
macOS, where web pages can't hand links to FramePort yet.
|
||||
- **Settings → Install links** has one switch for `framedrop://` links (the buttons) and one for FramePort's own
|
||||
@@ -125,7 +130,8 @@ sideloader, documented at framedropvr.com/docs). FramePort understands the same
|
||||
(`{"schema": "framedrop.install/v1", "name": "…", "files": [{"url": "https://…", "sha256": "…"}]}`). FramePort
|
||||
also reads an optional `"frameport": {"description": "…", "icon": "https://….png"}` object (FrameDrop ignores
|
||||
it): the install question then shows the icon and description, and they become the game's icon and "About this
|
||||
game" text when no store has them. Without a manifest (a bare file link) FramePort guesses the title from the
|
||||
game" text when no store has them. For your page there's an "Install with FramePort" button:
|
||||
[INSTALL_BUTTON.md](INSTALL_BUTTON.md). Without a manifest (a bare file link) FramePort guesses the title from the
|
||||
file name and replaces it with the app's own name once it's downloaded.
|
||||
- Only `https://` links to public servers are used (plain `http://` only on this PC, for testing); links with a
|
||||
user name or password, or pointing into your local network, are refused. Only install from sites you trust.
|
||||
@@ -139,7 +145,7 @@ reality), showing only what matters for that game. Changes are kept with the gam
|
||||
|
||||
## Typing on the Frame
|
||||
|
||||
- **Type on Frame** (its own tab in the sidebar; also on the Steam Frame page and in a game's menu): while the tab is
|
||||
- **Type on Frame** (its own tab in the sidebar; also on the Steam Frame page): while the tab is
|
||||
open, this computer's keyboard works as a keyboard plugged into the Frame. Select a text field in the headset (in
|
||||
an app, Steam or the desktop) and type; Esc and shortcuts go to the Frame too. Paste longer text into the box to
|
||||
type it in one go (US keyboard layout). Opening another tab disconnects the keyboard.
|
||||
@@ -190,7 +196,7 @@ Command line: `frameport update` (`--check` only checks, exit code 10 = update a
|
||||
## PC VR games
|
||||
|
||||
PC VR games are Windows VR games (OpenXR, SteamVR or Oculus). Scan a folder of them (one folder per game) or use
|
||||
**Add games → Add one game folder…**. FramePort finds the game's program and asks when there is more than one
|
||||
**Add games → Add a PC game folder…**. FramePort finds the game's program and asks when there is more than one
|
||||
candidate. **Already patched** on a game page installs a copy unchanged. Oculus-only games need Revive: FramePort uses
|
||||
an installed Revive, or downloads a portable copy.
|
||||
|
||||
@@ -201,7 +207,7 @@ an installed Revive, or downloads a portable copy.
|
||||
on the game page.
|
||||
- Games that use the Oculus Platform SDK check the licence through the Oculus app, so they run on the PC only.
|
||||
|
||||
**Windows games without VR:** **Add games → Add one game folder…** with the game's folder (pick the program that
|
||||
**Windows games without VR:** **Add games → Add a PC game folder…** with the game's folder (pick the program that
|
||||
starts it if asked). FramePort installs it on the Frame and Proton runs it as a window, like Steam's own Windows games;
|
||||
it shows up in the Frame's Steam library tagged "Windows game on Frame". Whether a game runs depends on Proton on ARM
|
||||
(x86 games run through emulation).
|
||||
@@ -249,7 +255,7 @@ Command line: `frameport frame send <files> --dest videos` (`frameport frame sto
|
||||
|
||||
## Sharing a working game, reporting a problem
|
||||
|
||||
- **Share working config…** (game menu): opens a prefilled GitHub issue with the game's patches and settings. Accepted
|
||||
- **Share working recipe…** (game menu): opens a prefilled GitHub issue with the game's patches and settings. Accepted
|
||||
configs become built-in recipes. Untested games ask on their page once they've been installed or tested: **It
|
||||
works**, **It has issues** or **It doesn't run**.
|
||||
- **Report a problem…** (game menu, or Settings → Problems and feedback): saves a diagnostics zip to Documents (logs,
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# "Install with FramePort" button
|
||||
|
||||
A button for web pages and READMEs that opens a game straight in FramePort. Clicking it hands FramePort an install
|
||||
link; FramePort shows what it would download and asks before it does anything (see
|
||||
[Install links](INSTALL.md#install-links-install-with-framedrop-buttons)).
|
||||
|
||||
<p>
|
||||
<img src="badges/install-with-frameport-animated.svg" alt="Install with FramePort" width="216" height="60">
|
||||
</p>
|
||||
|
||||
## Files
|
||||
|
||||
All files are in [`docs/badges/`](badges/). Each SVG is self-contained (no external fonts or images), 216 × 60.
|
||||
|
||||
| File | Use it for |
|
||||
|---|---|
|
||||
| [`install-with-frameport.svg`](badges/install-with-frameport.svg) | Everywhere. No motion. |
|
||||
| [`install-with-frameport-animated.svg`](badges/install-with-frameport-animated.svg) | GitHub READMEs and other pages that only allow images. The glow plays by itself every 6 seconds: blue swells from the left, the portal between "Frame" and "Port" flares, then orange swells on the right. |
|
||||
| [`install-with-frameport-hover.svg`](badges/install-with-frameport-hover.svg) | Websites where you can paste HTML. The glow brightens and the middle portal lights up while the pointer is on the button. It only reacts to the mouse when the SVG code is placed in the page itself (see below). |
|
||||
| [`install-with-frameport@2x.png`](badges/install-with-frameport@2x.png) | Places without SVG support (some forums, email). 432 × 120; show it at 216 × 60. |
|
||||
|
||||
Both animated versions stop moving for visitors who turn on reduced motion in their system settings.
|
||||
|
||||
## The link
|
||||
|
||||
The button links to an install link, which names either a manifest or one file:
|
||||
|
||||
```
|
||||
frameport://install?manifest=<URL-encoded https address of a manifest .json>
|
||||
frameport://install?url=<URL-encoded https address of an .apk, a Linux build (.zip, .tar.*, .AppImage) or a Windows .exe>
|
||||
```
|
||||
|
||||
The manifest is the FrameDrop format, which FramePort reads as it is:
|
||||
|
||||
```json
|
||||
{
|
||||
"schema": "framedrop.install/v1",
|
||||
"name": "My Game",
|
||||
"files": [{ "url": "https://example.com/my-game.apk", "sha256": "<64 hex digits>" }],
|
||||
"frameport": { "description": "One sentence about the game.", "icon": "https://example.com/icon.png" }
|
||||
}
|
||||
```
|
||||
|
||||
`name` becomes the game's title in Steam. `sha256` is optional but recommended: FramePort checks the download
|
||||
against it. The `frameport` object is optional and ignored by FrameDrop; its icon and description are shown in the
|
||||
install question. Only public `https://` addresses are accepted.
|
||||
|
||||
To build a link from Python: `frameport.deeplink.make_link(manifest_url="https://…/my-game.json")`.
|
||||
|
||||
## On a website
|
||||
|
||||
Image version (any page):
|
||||
|
||||
```html
|
||||
<a href="frameport://install?manifest=https%3A%2F%2Fexample.com%2Fmy-game.json">
|
||||
<img src="install-with-frameport.svg" alt="Install with FramePort" width="216" height="60">
|
||||
</a>
|
||||
```
|
||||
|
||||
Hover version: paste the contents of `install-with-frameport-hover.svg` inside the link instead of the `<img>`, and
|
||||
give the link an accessible name:
|
||||
|
||||
```html
|
||||
<a href="frameport://install?manifest=https%3A%2F%2Fexample.com%2Fmy-game.json" aria-label="Install with FramePort">
|
||||
<svg …>…</svg> <!-- the whole file -->
|
||||
</a>
|
||||
```
|
||||
|
||||
Host the files yourself, or load them from jsDelivr, which serves them with the right content type:
|
||||
`https://cdn.jsdelivr.net/gh/spoopyghosty0/frameport@main/docs/badges/install-with-frameport.svg` (replace `main`
|
||||
with a release tag such as `v0.12.0` to pin a version; jsDelivr caches `@main` for up to 12 hours).
|
||||
|
||||
## In a GitHub README
|
||||
|
||||
GitHub removes links that don't start with `https://` or `http://` from READMEs, so a `frameport://` link there is
|
||||
not clickable. Link the button to an `https://` page instead, for example your release page with instructions, or
|
||||
FrameDrop's install page, which opens `framedrop://` links (FramePort opens those too while Settings → Install links
|
||||
→ `framedrop://` is on):
|
||||
|
||||
```markdown
|
||||
[](https://framedropvr.com/install?manifest=https%3A%2F%2Fexample.com%2Fmy-game.json)
|
||||
```
|
||||
|
||||
Use the animated or still SVG; the hover version doesn't react inside a README, because GitHub shows SVGs as
|
||||
images.
|
||||
|
||||
## If a visitor doesn't have FramePort
|
||||
|
||||
A `frameport://` link does nothing visible (or shows the browser's "no app for this link" message) when FramePort
|
||||
isn't installed. Put a line next to the button such as "Needs [FramePort](https://github.com/spoopyghosty0/frameport)
|
||||
on Windows or Linux." On macOS, web pages can't hand links to FramePort yet: users paste the link into Add games →
|
||||
Add from a link….
|
||||
|
||||
## Usage rules
|
||||
|
||||
- Keep the alt text "Install with FramePort".
|
||||
- Don't recolor, stretch, crop or redraw the button, and don't show it smaller than 40 px tall.
|
||||
- Leave some space around it (at least 8 px) so it doesn't touch other buttons.
|
||||
- It works on light and dark pages as it is; there is no light version.
|
||||
@@ -46,7 +46,6 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
| PC VR game: `Failed to initialize Oculus API (-3001)` / `Unable to load LibOVRRT DLL` | Revive's LoadLibrary hook doesn't work under Proton arm64 (ARM64EC kernelbase); the game's LibOVR shim finds no runtime DLL | Symlink `LibOVRRT64_1.dll` → Revive's DLL in the prefix's system32 (manual so far) → then -3021 (runtime signature check; open) |
|
||||
| Uploads to the Frame are slow (~15 MB/s) | PC and Frame both on Wi-Fi through the home router | Connect the PC to the Frame's own hotspot (or a USB cable): FramePort uses the direct link automatically (~80-100 MB/s); job log line "Transfer link" |
|
||||
| PC VR game exits right away: `Unhandled Exception: 0xc06d007e` (after `FOnlineSubsystemOculus::InitWithWindowsPlatform`) | Delay-loaded `LibOVRPlatform64_1.dll` (Oculus Platform SDK, installed with the Oculus app) is missing | None on the Frame (entitlement check; FramePort doesn't replace it). PC mode with the Oculus app |
|
||||
| Unity PC VR game (Oculus + SteamVR build: `OVRPlugin.dll` and `openvr_api.dll` in `<Name>_Data/Plugins`) opens a window and quits after ~20 s; no VR Vulkan instance after the game's DXVK device in launch.log; Unity log (`unity log … Player.log`, agent v67): `OpenVR failed initialization` / `Initialization of device … failed` | Unity's built-in VR tries its SDKs in list order (Oculus first) unless `-vrmode` picks one; a catalog recipe verified with another build of the game (e.g. SUPERHOT VR's OpenXR build, GitHub #105) used to drop the build's own arguments | `pcvr.launch_args` = `-vrmode OpenVR` (detected for such builds; kept when the catalog's `xr` differs from the build's). A game's Electron launcher next to it (SHVR.exe) is ranked below the game |
|
||||
| Unreal PC VR game opens the crash reporter instead of closing | UE starts CrashReportClient.exe on a crash | `pcvr.no_crash_reporter` (default for Unreal Rift games): `-nocrashreports` + CrashReportClient.exe renamed `.disabled` in the Frame copy |
|
||||
| A backup's game was added without its data (library `data_dir` null, `data_bytes` 0) although the folder has .obb files | The OBBs sit in a layout the scan didn't know: `<game>/obb/<package>/`, `Android/obb/<package>/`, or SideQuest-style `<game>/apk/x.apk` + `<game>/obb/<package>/` | `sources/quest_dump.find_data_dir` finds a `<package>` folder with .obb files ≤3 levels below the APK's folder or ≤2 below its parent (skipping neighbouring folders with APKs: other games); an `apk`/`apks` folder counts as part of its game folder. Add the folder again (Analyze again doesn't look for data) |
|
||||
| Game hangs at start / never loads although its .obb files are right there: next to the APK, in an `obb` folder beside an `apk` folder inside a `<package>` folder, or a SideQuest backup (`<timestamp>_<versionCode>.apk`) (GitHub #85, #91) | No folder named after the package, so the folder-layout checks found nothing and no OBB was uploaded | `quest_dump.find_data` then looks for the files by name, `(main\|patch).<versionCode>.<package>.obb` (any case), in the APK's folder, its parent and up to 3 levels below each (folders with their own APKs are other games); prefers the folder and files of the APK's own versionCode, else the newest older, else any version. When that folder also holds other things (the APK itself, other games' OBBs), the library entry gets `data_files` and only those files are uploaded, counted and deleted with the game. Add the folder again |
|
||||
@@ -79,51 +78,36 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
| Video player / app finds no local videos; MediaProvider "Requested path /home/steamos/... doesn't appear under ..." | Lepton's /sdcard is a symlink to a host path, so Android's media index rejects every file | upload in the Files tab (Videos = /sdcard/Movies) and browse folders in the app |
|
||||
| Batman: Arkham Shadow closes during smoke-bomb effects; later input-tree corruption | Meta XR Audio Wwise deletes queued metadata still referenced by the current audio frame, then writes through the stale pointer | FrameBridge automatically retires metadata after current-frame references disappear, for the verified AArch64 SDK build only; see [AUDIO_METADATA.md](AUDIO_METADATA.md) |
|
||||
| Game stays on a loading or "Waiting" box although it reached FOCUSED; log `FrameBridge: xrEndFrame failed -25` then no more `pacing:` lines (e.g. PowerWash Simulator on some Frames, GitHub #39) | The eye image rect ends a few pixels past its swapchain (Unity rounds the swapchain width, the runtime's recommended size differs per Frame); SteamVR rejects every frame with XR_ERROR_SWAPCHAIN_RECT_INVALID | FrameBridge clamps every projection/quad image rect to its swapchain (`rect_clamp`, default on since 0.11.0; log `rect_clamp: view N image rect clamped`): rebuild + reinstall the game |
|
||||
| Unity game (OVRPlugin, GLES) crashes ~10 s in: `FrameBridge: xrCreateSwapchain … faces=6 … result=-2`, OVRPlugin `CreateSwapchain for eye 0: 0x0, 0 stages`, then render-thread SIGSEGV in memset ← libOVRPlugin ← `ovrp_EndFrame4` (libgallium/ANR follow; e.g. Budget Cuts Ultimate, GitHub #107); triage `cube-swapchain-refused` | The game shows a cube-map layer (OVROverlay cubemap); the Frame's runtime has no cube layers and refuses cube swapchains (XR_ERROR_RUNTIME_FAILURE); OVRPlugin doesn't check and writes into the image list it never got | FrameBridge `cube_standin` (default on): a refused cube swapchain is served as a GL cube map in the game's context and its layers are dropped (log `cube_standin: runtime refused …`): rebuild + reinstall. GLES only; a Vulkan game keeps the error |
|
||||
| Game (Unity, GLES) freezes, `zink: DEVICE LOST` | multisampled render-to-texture hangs the GPU | `frame.unity_no_msaa`; if it persists: unfixable → PC version |
|
||||
| Unreal GLES game crashes ~3 s after start: `Fatal signal 11 … fault addr 0x10000 in tid … (RHIThread)`, `#01 … libgallium_dri.so` (GitHub #83 Star Wars Pinball VR, triage `unreal-msrtt-crash`) | Unreal's mobile MSAA renders through multisampled render-to-texture; Zink's `find_rp_state` then indexes `rendering_state_cache[6]` one past its end (sample count ≥ 32) and calls a junk hash function (0x10000). Mesa bug (no bounds check) | `frame.unreal_gl_shim` (GL shim with `gl_hide_msrtt`, multiview kept for Unreal: Unreal 4.25 only enables multiview with GL_OVR_multiview, GL_OVR_multiview2 **and** GL_OVR_multiview_multisampled_render_to_texture, so the shim keeps the last one visible for Unreal and maps glFramebufferTextureMultisampleMultiviewOVR to the single-sampled glFramebufferTextureMultiviewOVR; log `multiview multisampled render-to-texture (N samples) drawn single-sampled`) |
|
||||
| Crash with `SIGILL (ILL_ILLOPN)` and `*pc=0xd50323bf` (autiasp), e.g. on Unreal's HttpManager thread (GitHub #83 Star Wars Pinball VR, triage `pac-unpaired`) | The engine's OpenSSL ARMv8 assembly has autiasp without a matching paciasp (libUE4.so: 38 paciasp, 40 autiasp; Poly1305 NEON). Quest CPUs treat PAC hints as NOPs, the Frame's CPU checks them | `frame.pac_hints`: in a library with unpaired counts every paciasp/autiasp becomes a NOP (in place) |
|
||||
| launch.log ends with `logcat: Unexpected EOF!` right after `Waiting for app …`; the game runs, but Steam's "Resume game" menu isn't closed and the launch test shows nothing (Vader Immortal on Lepton 3.0.5, Under Cover on 2.8.14; about 1 launch in 50) | Lepton's logcat mirror died | Agent v67 `_logcat_keeper` (started by launch.sh, added to older launchers by `upgrade_launchers`) reads the container's logcat itself (`podman exec lepton-steamlaunch-<appid> logcat -v threadtime -T 2000`) and appends it to launch.log; log `<base>/logcat-keeper.log` |
|
||||
| A game no longer starts after a reinstall that was launch-tested right away: logcat `Zip: EOCD not found, …/base.apk is not zip` / `Failed to parse …base.apk`, no `Start proc` for the game (VR HOT, 2026-10-09) | The launch test's 45 s ran from the launcher, but the first start after an APK change spends ~1–2 min booting Lepton and installing the app: stopping the container mid-install left a broken installed copy | Agent v68: the test window counts from Lepton's `Waiting for app` (at most 240 s extra for boot + install). Repair a broken one: `touch <base>/lepton-app/game.apk` (Lepton re-installs it on the next start) |
|
||||
| Unreal game (OVRPlugin) never starts VR: launch.log has `OVRPlugin: JNI_OnLoad` but never `CompositorOpenXR::PreInitialize`, no OpenXR session, then a crash a few seconds in (e.g. Star Wars Pinball VR, UE 4.25: null pointer in `FSceneRenderer::GetMultiViewSceneColor`, GitHub #83) | Unreal's Oculus module looks up every `ovrp_*` function of the OVRPlugin it was built against (`InitializeOculusPluginWrapper`, all ANDed); OVRPort's OpenXR OVRPlugin lacks a few old ones (UE 4.25 / OVRPlugin 1.44: `ovrp_GetPTWNear`), so the wrapper fails and OculusHMD is never pre-initialised | `frame.unreal_ovrp_entrypoints` (suggested when analysis `unreal_ovrp_lookups` name functions the shipped OVRPlugin lacks): generated `libfp_ovrpstubs.so` (DT_NEEDED of libOVRPlugin.so; dlsym on the plugin's handle searches its dependencies) with a stand-in per missing name returning ovrpFailure (-1000); build note lists the names |
|
||||
| Only the Android home screen shows; the log has Unity's VR device as `None` (e.g. Accounting+, Unity 2017) | Unity 2017–2018 built-in Oculus support starts VR only when `com.oculus.systemactivities` is installed; Lepton has no Meta system apps, so Unity falls back to non-VR | `frame.unity_oculus_check`: that package name in libunity.so → `android`, plus `native/ovrpshim` (libfp_ovrp.so): Unity 2017's legacy frame loop (`ovrp_Update2`/`ovrp_BeginFrame`) never calls `ovrp_WaitToBeginFrame`, so without the shim no `xrWaitFrame` happens, `CompositorOpenXR::Update … outside of frame bounds` floods the log and the dashboard freezes. With it: log `ovrp frame loop shim: waited for frame N`, ~71 fps. Accounting+ then stops at "press any button" although its OVRInput gets clean input (`INPUT_PROBE` in the patch logs connected controllers/buttons/input focus per call) — unresolved |
|
||||
| Black flat window, then a GPU hang: kernel `hangcheck detected gpu lockup` (offending task the game), `zink: DEVICE LOST`, Unity render-thread crash; `outside of frame bounds` thousands of times a second (e.g. BattleSisters, Unity 2019.4) | Unity 2019 on its built-in VR (no `libOculusXRPlugin.so`) uses the same legacy frame loop as Unity 2017: no `xrWaitFrame`, the render thread floods the GPU | `frame.unity_oculus_check` adds the ovrpshim frame wait for these too (revision 2) |
|
||||
| Unity built-in VR game (with `frame.unity_oculus_check`) freezes at a scene switch: the log stops after `Boot: Activating Scene: …`, the process stays alive, every thread sleeps (e.g. Sniper Elite VR, Unity 2019.4) | The shim's `xrWaitFrame` blocks until the previously waited frame is begun; Unity skipped beginning it at the scene switch and its render thread then waited for the main thread (gdb: UnityMain in vrclient `CSxrSession::StartNextFrame` ← `ovrp_WaitToBeginFrame` ← `fpov_Update2`). OVRPlugin also only begins the frame index it waited for | `frame.unity_oculus_check` revision 5: libunity.so's `ovrp_BeginFrame`/`ovrp_EndFrame` go through the shim, which waits ≤ 50 ms for the last waited frame to begin, else skips the wait (log `the last waited frame wasn't begun`), and gives a begin/end of another index the waited one |
|
||||
| Unity built-in VR game: the hands/weapons trail the controllers by centimetres when moving (headset fine, 72 fps), e.g. Sniper Elite VR | Unity's physics-step `ovrp_Update2` (prediction 0) makes OVRPlugin locate the nodes at the monotonic clock's "now", the XrTime base on a Quest but 0.05–0.9 s behind the Frame's XrTime; the runtime extrapolates backwards and the render-step reads after it get those poses too. A larger prediction is capped by OVRPlugin (~0.07 s) | `frame.unity_oculus_check` revision 5 holds the physics-step update back: both steps read the render update's display-time poses |
|
||||
| OVRPlugin game: the hands lag behind the controllers (also with `ovrp_hold_physics` on or off; rendering fine), e.g. BattleSisters | OVRPlugin passes its monotonic-clock "now" on as the OpenXR time (OVRPort's dispatcher converts XR_KHR_convert_timespec_time 1:1: the Frame's runtime lacks it, and FrameBridge's emulation is never asked), but the Frame's XrTime runs ahead of CLOCK_MONOTONIC (2.56 s on SteamOS 0.4.5): with `pose_debug=1` the hand spaces show `time - predicted display time -2564 ms`; BattleSisters also asks for its head at XrTime 0.1 s every frame | `adapter.pose_time_fix` (FrameBridge, suggested for Unity built-in OVRPlugin games): a located time nearer the monotonic clock than XrTime's "now" is moved by the clock offset measured at xrWaitFrame, one more than 0.5 s before the display time goes to "now" (log `pose_time_fix: …`; `pose_debug=1` counts both per 5 s). Once a build has this FrameBridge it is toggled in settings.conf (no rebuild) The offset is the largest of the last ~2 s of xrWaitFrame samples (hitches made single samples dip by up to 2.5 s and pushed fixed times into the future); far-past requests get the frame's display time. Headless survey of 54 games (2026-10-09): no head/view request on the monotonic clock in any other game; UE4 OVRPlugin 1.89 games (Robo Recall, Vader, Phantom, Time Stall) and The Room VR ask for head/views at XrTime ≈ 0 every frame, which works today; hands only show in the headset. Suggested for Unity built-in Oculus games only. A time equal (±1 ms) to one of the last 6 predicted display times is never moved, and monotonic times are only told apart when the clocks are more than 4 display periods apart and the time is clearly nearer the monotonic "now" (GitHub #49: on a Frame with XrTime only ~68 ms ahead, a display-time request after a hitch was moved +67.7 ms) |
|
||||
| Unreal game stuck on a loading image after the intro, frames keep coming (72 fps), no crash (e.g. Vader Immortal) | suspect: a Meta Platform SDK request no message ever answers | diagnostics: `frame.ovr_trace` (opt-in) logs every `ovr_*` call, the answers `ovr_PopMessage` returns and every 10 s the unanswered requests (`fp_ovrtrace` in launch.log). Never fake an entitlement answer |
|
||||
| Own-engine game crashes in `libVkLayer_fossilize.so` (Fossilize's recording thread, e.g. Roblox) | same as Deadpool VR: uninitialised pointers in what Fossilize records | `frame.vk_sanitize` now also covers own-engine libraries that load `libvulkan.so` by name |
|
||||
| Crash right after the game gets focus, in `vrclient.so … UpdateActionStateInternal` / `sxr_xrSyncActions` (e.g. Myst) | a race in the Frame runtime's input code on the first sync after focus (not every launch) | adapter `sync_guard` (input syncs one at a time with event polling, paused 250 ms after FOCUSED) |
|
||||
| View jumps sideways / game pauses or freezes for a moment every few seconds (e.g. Blade & Sorcery, BattleGlide) | the Frame drops focus for ~0.5 s (FOCUSED→VISIBLE→SYNCHRONIZED); games pause or re-align the player (`OnVRPresence … Teleport`) | adapter `focus_hold` |
|
||||
| SDL / LÖVE app crashes at start: `NullPointerException … ClipboardManager.addPrimaryClipChangedListener` in `SDLClipboardHandler.<init>` (e.g. Dramatic Shape) | Lepton's Android has no clipboard service (`service check clipboard`: not found) | `frame.sdl_clipboard` (that call → nops in classes.dex, in place, `apk/dex.py`); reproduced and verified with LÖVE for Android 11.5 |
|
||||
| Game crashes at start: `java.lang.NoSuchMethodError: No virtual method getAvailableCommunicationDevices()… in class Landroid/media/AudioManager` at `com.vivox.sdk.AudioChangeListener.checkAudioRouteAndApplyChanges` (e.g. Green Hell VR, GitHub #101); triage `vivox-api31` | Newer Vivox (voice chat) builds call Android 12 audio-routing methods without a version check; Lepton is Android 11. Older Vivox builds (Eleven Table Tennis, BattleSisters) don't have that code | `frame.vivox_audio_route` (suggested by analysis `vivox_api31`): every AudioChangeListener method that calls one of them returns at once (`Dex.return_early`: return-void / `const/4 v0, 0; return v0`, in place); voice chat keeps the default audio route |
|
||||
| Controllers do nothing (e.g. stuck on a setup screen); log: `xrSuggestInteractionProfileBindings … XR_ERROR_PATH_UNSUPPORTED` | the game only suggests bindings for Meta's newer profiles (Touch Plus / Touch Pro); the Frame's Android runtime knows `oculus/touch_controller`, not those | adapter `profile_remap` (default on): the bindings are suggested again for Touch (log: `controller profile … -> oculus/touch_controller`) |
|
||||
| Some buttons do nothing or the wrong thing (e.g. a Quest game's X/Y on the Frame's left controller) | the game binds only Quest Touch and SteamVR maps Touch onto the Frame controllers with its own remap (Touch left X/Y land on the d-pad, right X and Y repeat B), or the runtime rejected a profile or an input call | turn on adapter `input_diag` (diagnostics, off by default; `frameport settings <pkg> input_diag=1`) and look for `input_diag:` lines: `bindings: <profile> accepted` or `unsupported: interaction profile <profile> -> <result>` with the rejected paths, `bindings: /user/hand/<hand> uses <profile>`, `unsupported: function <name>`, `unsupported: xrCreateAction -> <result> (<action>)` |
|
||||
| Unity game hangs or the whole Frame restarts (e.g. in a menu); log: `The current MSAA level is 0, but the recommended MSAA level is 4. Switching to the recommended level.` (e.g. Lucky's Tale) | Meta's OVRManager (`useRecommendedMSAALevel`) turns 4x MSAA on at runtime, past QualitySettings; multisampled render-to-texture on GLES/Zink hangs the GPU | `frame.unity_runtime_msaa_off` (Cpp2IL: `OVRDisplay.get_recommendedMSAALevel` → 0) |
|
||||
| Unity game: one eye shows only effects or grey, the other is fine (e.g. I Am Cat, Oculus XR Plugin on GLES) | the game's single-pass multiview rendering goes wrong for array slice 1 (the adapter submits both slices correctly) | `frame.unity_multipass` (Cpp2IL: `OculusSettings.GetStereoRenderingMode` → MultiPass); `swap_eyes=1` tells whether the game or the adapter is at fault |
|
||||
| Setup/intro loops every launch (Espire 2) | save folders created without write permission | launcher repairs permissions every 2 s (built in) |
|
||||
| VrApi bridge: never enters VR | Frame reaches FOCUSED later than Quest; tracking only when worn | bridge waits 30 s; test in the headset |
|
||||
| Unreal game (ILMxLAB, e.g. Vader Immortal) plays its intro, then stays on its loading card (portrait + progress bar) at 72 fps and ignores input (GitHub #49) | the menu waits for `UVRUtils::GetQuestShaderPrecompilePercent()` to reach 100 %; the precompile only starts when `IsRunningOnSantaCruz()` (a Quest), the other branch returns 0.0 | `frame.unreal_quest_precompile` (non-Quest branch returns 1.0; found by Klownicle); suggested when the engine exports that function (analysis `unreal_quest_gates`) |
|
||||
|
||||
## Picture problems (headset on)
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| Found after playing: the game page's "Last session" (or `frameport session <pkg>`) lists a finding (agent v70 `session_log`: the newest `plays.log` session's launch.log, ≤4 MB, + its crash logcat + kernel GPU lines) | launch tests never reach FOCUSED or gameplay; the same `catalog/triage.yaml` signatures (sync_guard, pac_hints, unreal_gl_shim, vk_spec_fixes, …) now also run on real sessions, plus the frame-rate and focus-dip findings below | "Try this fix" (FrameBridge settings: written on the Frame at once via `set_settings`, used from the next start) / "Rebuild with this fix" (APK patches); launch-test sessions (`test <unix>` in plays.log) are skipped |
|
||||
| Textures flicker, jump or smear while moving in an OVRPlugin game that renders space-warp swapchains (`xrCreateSwapchain 376x376 format=97` / `format=129`; triage `space-warp-used`, info + question) | Application SpaceWarp: half the frames plus motion vectors; the Frame's reprojection of them misbehaves (Into The Radius 2, Metro Awakening) | adapter `hide_space_warp=1`; offered as "Did textures flicker…?" after a play session, never applied on its own |
|
||||
| The game froze or closed and the kernel log has `hangcheck` / GPU fault / `msm_drm … recover` lines during the session (triage `gpu-hang`, play sessions only) | a shader or effect hangs the Frame's GPU (e.g. Vader Immortal's lightspeed jump) | capture the shaders (`adapter.zink_shader_dump=1`, GLES) and send a problem report; the maintainer adds a `zink_shader_fix` / `vk_shader_fix` catalog entry. `zink-device-lost` keeps its MSAA suggestions |
|
||||
| The game keeps pausing or recentring for a moment while worn (session finding `focus-dips`: ≥3 `focus: back after N ms` lines longer than the game's focus_hold_ms, up to 5 s) | the Frame's wear sensor flickers "HMD off"; FrameBridge logs every runtime focus loss/return (always, before focus_hold) | `adapter.focus_hold_ms=<longest dip + 250 ms, in 500 ms steps, ≤5000>` (or `adapter.focus_hold=1` when off) |
|
||||
| Judder or smearing on head turns; FrameBridge pacing below the display rate (session finding `slow-frames`: >30 % of the 5 s windows under 90 % of the nearest refresh rate ≥ the session's 90th-percentile fps, after the first two windows, ≥1 min) | the game renders below the refresh rate; the runtime reprojects | `adapter.scale=<current × 0.85>` first, then `frame.unity_runtime_msaa_off` (Unity) / `adapter.hide_space_warp` (Unreal 5 + OVRPlugin) |
|
||||
| Unreal game (ILMxLAB, e.g. Vader Immortal): controllers track but grip/trigger do nothing, grabbing never works (Unreal's own input values move, the game's stay 0) | `URPOCKeyMapManagerComponent` picks the Quest or the Gear VR key set by `IsRunningOnSantaCruz()`; on the Frame it takes Gear VR, empty in a Quest build | `frame.unreal_quest_keymap` (the Oculus case keeps the Quest set, for action and axis mappings; found by Klownicle, GitHub #49) |
|
||||
| The hands' thumbs never move when you touch the thumbstick or buttons (Unreal `ThumbUp` stays 1, e.g. Vader Immortal) | OVRPlugin reports thumb proximity from XR_FB_touch_controller_proximity, which the Frame's runtime lacks; OVRPort's loader offers it anyway and the proximity actions never get a binding | adapter `proximity_emul=1` (thumb proximity from the touch inputs: thumbstick, face buttons, thumb rest; 2 = also the index finger from trigger touch); log `proximity_emul: finger proximity bound to touch`. **For UE4 Oculus games this didn't animate the thumbs** (Vader, GitHub #49): use `frame.unreal_thumb_touch` (found by Klownicle): `OculusInput::FOculusInput::SendControllerEvents` computes ThumbUp from NearTouches (masks 0x2/0x8); the patch makes it read Touches (the slot 4 bytes before) with masks 0x0f00 (X/Y/stick/thumb rest) / 0x000f (A/B/stick/thumb rest), keeping the inversion; three instructions, matched exactly (build note `OculusInput ThumbUp: from the capacitive touches`). Matches Vader Immortal Ep. I, Robo Recall, Phantom: Covert Ops, Time Stall, Star Wars: Tales from the Galaxy's Edge; newer UE4 builds (e.g. Asgard's Wrath 2, RE4, In Death) compile it differently (shared mask registers) and aren't matched |
|
||||
| OpenGL ES game: the GPU hangs at one effect (freeze/exit, compositor watchdog, e.g. Vader Immortal's lightspeed jump) | a shader (as Zink compiles it) reads loop counters/accumulators before setting them | capture the SPIR-V (adapter `zink_shader_dump=1` writes every module to `files/fp_spirv/`, or a GPU capture), then a `zink_shader_fix` entry (same format as `vk_shader_fix`) + `frame.zink_shader_fix` (Vulkan layer under Zink, activated through GraphicsEnv's debug layer list); log `shader fix layer: fixed shader module N`; triage `zink-shader-fix-mismatch` when a Frame update changed the driver's output |
|
||||
| 2D Android app: Steam says it's running but nothing shows | Lepton runs apps headless unless the app folder has `lepton-show-flatscreen` | FramePort adds it for apps without VR (agent v28+); reinstall apps installed before |
|
||||
| A phone/tablet app shows nothing in the headset, or a VR app opens as a flat window | FramePort's VR/2D guess (`vr_kind`) is wrong for this app | patch `device.display_mode` → **Flat window** or **VR** (Customize → "Show as VR or as a flat window"), then Update on Frame |
|
||||
| "Install with FrameDrop" button opens FrameDrop (or nothing) instead of FramePort | another program owns `framedrop://`, or the switch is off, or macOS (Flet can't receive links there) | Settings → Install links → **Use FramePort for these links**; else Add games → Install from a link… (paste the button's address) |
|
||||
| "Install with FrameDrop" button opens FrameDrop (or nothing) instead of FramePort | another program owns `framedrop://`, or the switch is off, or macOS (Flet can't receive links there) | Settings → Install links → **Use FramePort for these links**; else Add games → Add from a link… (paste the button's address) |
|
||||
| 2D Android app: back/home/recents buttons cover the app's own buttons | Android's navigation bar | patch `device.hide_navbar` (on by default for apps without VR) sets `qemu.hw.mainkeys=1`; reinstall to apply |
|
||||
| Black screen, audio works, GLES engine with direct VrApi | Mesa rejects Quest-style GLSL | `frame.gl_shim` (logs `GLShim: SHADER COMPILE FAILED` + source lines) |
|
||||
| Black screen, audio works, log `Unsupported VrApi layer type N` | bridge drops frames containing that layer | extend the bridge (cylinder=3 is converted to a quad already) |
|
||||
| Only some draws visible (e.g. controllers) + `glGetError 0x502` | multiview shaders used on single-view FBOs | GL shim `gl_hide_multiview=1` (default) |
|
||||
| Own GLES engine (OpenXR, not VrApi): eye view fine, but HUD / menu / PDA panels black (e.g. Doom3Quest, GitHub #77; no error in the log) | every shader declares `layout(num_views=2) in;`, also the ones drawn into the engine's single-layer offscreen framebuffers (2D textures/renderbuffers); OVR_multiview makes such draws INVALID_OPERATION and Mesa drops them (`draw_validate.c`), Quest's driver doesn't | `frame.gl_multiview_fbo` (opt-in, experimental: `libfpglmv.so` interposes GLES and draws those cases with a single-view twin of the program; logs `GLMV: twin built: program N -> M`, per-5-s `single-view draws` counters; `gl_mv_debug=1` adds glGetError checks; triage `gl-multiview-twin-failed`). Alternative: the game's own fix (two-layer multiview pool, Xandrix's patch in #77) |
|
||||
| Upside-down image in a GL bridge game | GL images start at the bottom row | fixed in the bridge (swap angleUp/Down for GL chains) |
|
||||
| UI panels upside down (AC Nexus) | XrCompositionLayerImageLayoutFB VERTICAL_FLIP unsupported | adapter `flip_emul=1` (default); rotating quads makes them vanish |
|
||||
| Passthrough black (BAM) | XR_FB_passthrough missing | adapter `passthrough_emul=1` (default) + `patch_force_passthrough` for MR-only games |
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
# Screenshots and videos
|
||||
|
||||
The pictures in the docs and the videos are rendered by scripts, never taken by hand. The scripts show the real
|
||||
FramePort GUI with a demo library and a pretend Steam Frame, drive it the way a person would, and film or photograph
|
||||
it:
|
||||
|
||||
| What | Source | Output |
|
||||
|---|---|---|
|
||||
| Docs screenshots | `docs/showcase/shots.yaml` | `docs/images/*.png` |
|
||||
| Demo tour (about 95 s) | `docs/showcase/videos/tour.yaml` | `docs/media/frameport-tour.mp4` (+ `.jpg` poster), `docs/images/tour-teaser.webp` (README) |
|
||||
| Install tutorial (about 90 s) | `docs/showcase/videos/install.yaml` | `docs/media/frameport-install.mp4` (+ `.jpg` poster) |
|
||||
|
||||
Nothing comes from anyone's own library. The demo library (`docs/showcase/demo-library.yaml`) lists real catalog
|
||||
games, so recipes and patches are the ones FramePort really uses. Their technical analysis (`demo-analyses.json`:
|
||||
engine, VR API, libraries, sizes) was exported from real APK analyses without any paths. Art, in-game screenshots
|
||||
and store details come from the same public sources the app uses and are cached in `~/.cache/frameport-showcase`.
|
||||
The renderer refuses to run in FramePort's own data folder, scans the demo data for home paths and IP addresses
|
||||
first, and stops when a store didn't send art (placeholders never reach the docs; `--allow-missing-art` overrides
|
||||
that). Frame discovery is switched off during a render (no real device on your network can appear), and the setup
|
||||
command shows placeholders for the address and code (each PC has its own), never this computer's.
|
||||
|
||||
## Running it
|
||||
|
||||
You need the dev extras, Chromium for Playwright and ffmpeg:
|
||||
|
||||
```
|
||||
UV_LINK_MODE=copy uv sync --extra dev
|
||||
uv run playwright install chromium # once
|
||||
uv run python scripts/showcase/render_docs.py # all screenshots → docs/images (changed ones only)
|
||||
uv run python scripts/showcase/render_docs.py --only game,monitor --out /tmp/shots
|
||||
uv run python scripts/showcase/record_video.py install --draft # quick 720p check of a storyboard edit
|
||||
uv run python scripts/showcase/record_video.py # every video → docs/media (+ the README teaser)
|
||||
uv run python scripts/showcase/record_video.py tour install # some
|
||||
```
|
||||
|
||||
Every screenshot is rendered twice, each in a fresh window, and kept only when both agree (the headless GPU now and
|
||||
then draws a glyph wrong); a third render settles a disagreement, and `--fast` renders once for trying out an edit.
|
||||
A shot whose steps fail is tried again and never written. A screenshot is rewritten only when it visibly changed
|
||||
(`render_docs.changed`: anti-aliasing noise doesn't count), so running it twice changes nothing. `--check` writes
|
||||
nothing and exits 1 when a docs image is out of date.
|
||||
|
||||
For videos, `--names` prints what can be clicked after each scene and `SHOWCASE_DEBUG=1` prints every step with its
|
||||
start time (which step waited); `--draft --scenes a,b` records only some scenes. A video is encoded at the best
|
||||
quality that fits its `budget_mb` (12 by default), a teaser at 4 MB.
|
||||
|
||||
## Videos
|
||||
|
||||
One storyboard per video in `docs/showcase/videos/<name>.yaml`; adding a file adds a video (CI and releases pick it
|
||||
up by itself). The output must be `docs/media/frameport-<name>.mp4`: releases attach it as `FramePort-<name>.mp4`.
|
||||
|
||||
```yaml
|
||||
output: docs/media/frameport-install.mp4
|
||||
teaser: docs/images/tour-teaser.webp # optional: a looping WebP from the scenes' `teaser` parts
|
||||
budget_mb: 12
|
||||
poster_at: 9 # the poster frame, seconds after the title card
|
||||
start:
|
||||
profile: fresh # demo = FramePort in use (games installed, BONELAB running); fresh = its first start
|
||||
frame: disconnected # connected (default) or disconnected
|
||||
route: welcome # the page filming starts on (default library)
|
||||
stream: live # the monitor stream: live (default) or frozen
|
||||
setup: # steps before filming starts (a failure stops the recording)
|
||||
- hook: {name: first_run, args: ["D:/Games", 1.4]}
|
||||
vars: {game: com.playful.LuckysTale} # ${game} in any step
|
||||
title: {heading: Installing FramePort, line: …, seconds: 3.4}
|
||||
end: {heading: You're set, line: …, footer: github.com/spoopyghosty0/frameport, seconds: 4}
|
||||
scenes:
|
||||
- name: connect # a filmed scene
|
||||
caption: ["Connect your Steam Frame", "Once: FramePort shows a command to run on the Frame"]
|
||||
teaser: [0.6, 4.0] # optional: this part goes into the teaser
|
||||
hold: 1.5 # seconds of filming after the last step (default 0.6)
|
||||
steps: [...]
|
||||
- name: on-the-frame # an instruction card: for what happens outside FramePort
|
||||
seconds: 10
|
||||
card:
|
||||
eyebrow: "Step 3 · On the Frame, first time only"
|
||||
heading: Run the setup command
|
||||
steps: ["In the SteamVR dashboard: **Launch a program** → **Desktop**", …] # **bold** = a button or menu
|
||||
code: "curl -fsS <your-PC-address>:8765/<one-time-code> | bash"
|
||||
note: "Your address and code differ."
|
||||
```
|
||||
|
||||
Filmed scenes are one continuous session: each starts where the last one left off. Cards are rendered at the end
|
||||
and slotted in, with crossfades between everything. The `fresh` profile starts FramePort as on a new computer: an
|
||||
empty library, the welcome screen and a Frame that isn't set up. Its games wait for the pretend folder scan.
|
||||
|
||||
## Writing steps
|
||||
|
||||
Shots and scenes use one step language (`scripts/showcase/steps.py`). A step is a one-key mapping:
|
||||
|
||||
```yaml
|
||||
- go: monitor # a sidebar route
|
||||
- nav: "Monitor" # click that tab (checked: the page really changed)
|
||||
- open_game: ${game} # or {package: …, advanced: true}
|
||||
- call: {fn: settings_dialog, args: ["${game}"]} # any app method
|
||||
- hover: "Batman: Arkham Shadow" # the pointer: by name…
|
||||
- click: {name: "Lucky's Tale", dy: 0.35} # …offset inside the element (fraction of its size, or px)
|
||||
- click: "Install on Frame" # right_click, double_click, drag: [from, …, to]
|
||||
- type: "ri" # press: Escape
|
||||
- wait_for: "BONELAB · 2026-10-04 21:50"
|
||||
- wait: 1.2
|
||||
- hook: {name: held_install, args: ["${new_game}"]} # the pretend Frame's scripted events
|
||||
```
|
||||
|
||||
Elements are found by name through Flutter's accessibility tree: their visible text, a tooltip or a semantics
|
||||
label. Exact names win over prefixes, and buttons and cards win over plain text. When several match, the innermost
|
||||
one wins (a list carries the text of its rows; the row is meant). Icon-only buttons need a tooltip to be found,
|
||||
which also helps screen readers. The pointer moves on eased, slightly curved paths and is drawn into the picture,
|
||||
with a ring on every click. To open a game from a cover card, click its title (`dy: 0.35`): the card's middle is its
|
||||
Play/Install button.
|
||||
|
||||
Hooks (`steps.HOOKS`) cover what a real Frame would do:
|
||||
- `fake_install`: an install through the real job queue with every real stage name and a launch test that passes.
|
||||
- `held_install`: an install that stops mid-upload, for screenshots of the progress.
|
||||
- `connect` and `disconnect`
|
||||
- `first_run`: a first start. The welcome screen's tool download is a pretend one, and "Scan a folder…" scans a
|
||||
folder at once (the native folder picker can't be scripted).
|
||||
- `pairing_done`: the Frame ran the setup command, so FramePort connects.
|
||||
- `live_stream`: a test picture through the real relay.
|
||||
- `monitor_details`, `type_tab`, `select_files` and `settings_section`.
|
||||
|
||||
In a video, clicking Install runs the scripted install, and the game is then installed on the pretend Frame.
|
||||
|
||||
Pictures must not change from one run to the next:
|
||||
- Screenshot and file dates are fixed.
|
||||
- The Monitor's stream stops after its two-minute history.
|
||||
- The pointer leaves the page before a still picture is taken.
|
||||
- Each shot gets a fresh window and browser.
|
||||
- A picture is taken once the page has stopped changing.
|
||||
|
||||
Live data, such as the live view's relay port and data rate, doesn't belong in a docs screenshot.
|
||||
|
||||
## How it runs on GitHub
|
||||
|
||||
The `showcase` workflow (`.github/workflows/showcase.yml`):
|
||||
1. **When it runs:** on pushes to `main` that touch the UI, its translations or the showcase files, and on
|
||||
**Run workflow**.
|
||||
2. **What it renders:** the screenshots every time. Videos when their storyboard changed (all of them when the
|
||||
scripts changed), or the ones named on a manual run (`all`, or e.g. `tour install`). UI tweaks alone don't
|
||||
re-commit 10 MB videos.
|
||||
3. **What happens next:** every render is uploaded as the run's `showcase` artifact. When a picture changed, the
|
||||
workflow opens or updates the pull request on branch `showcase/update`, which you review and merge.
|
||||
|
||||
Releases attach every committed video as `FramePort-<name>.mp4`.
|
||||
|
||||
## Gallery
|
||||
|
||||
These are renders the README doesn't show (yet):
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
|  |  |
|
||||
|  |  |
|
||||
@@ -1,136 +0,0 @@
|
||||
# Batman cutscene playback on Steam Frame
|
||||
|
||||
Batman: Arkham Shadow (`com.camouflaj.manta`) submits its prerecorded cutscenes
|
||||
through Android video surfaces and stereoscopic 180-degree OpenXR equirectangular
|
||||
layers. Lepton/SteamVR's missing surface/layer support leaves those layers black,
|
||||
while the separately played audio continues. Uploading software-decoded panorama
|
||||
pixels also does not provide practical playback of the original 8192x4096 HEVC
|
||||
assets.
|
||||
|
||||
## Scope and installation
|
||||
|
||||
FrameBridge enables the internal native-video path only for this package's
|
||||
arm64 APK. It bundles a private hardware codec, its checksum manifest, and a
|
||||
Podman wrapper in that APK. The agent verifies and extracts those files into
|
||||
the game's own directory. The launcher places this wrapper on its child PATH.
|
||||
Only the matching game's container receives the read-only plugin/XML mounts
|
||||
and Iris decoder device. Shared Lepton files and original MP4/OBB assets are
|
||||
never replaced, transcoded, resized, or rewritten.
|
||||
|
||||
The native projection, view recording and Vulkan-enable hooks are gated by
|
||||
`surface_native`. With it off, Vulkan function lookup and directly exported
|
||||
entry points pass through to the original loader; default `surface_emul`
|
||||
alone does not enable the new Vulkan projection path. The fixture
|
||||
`tests/fixtures/src/surface_hooks_test.c` checks function identity with the
|
||||
setting off/on and direct-export forwarding with it off. Compile it with
|
||||
`FRAMEPORT_FAKE_RUNTIME` as `libopenxr_loader_original.so`, then without that
|
||||
define as the client; run each setting in a separate process next to the
|
||||
production adapter and fake loader.
|
||||
|
||||
The wrapper verifies the tested Android 11 SoftOMX ABI. An existing runtime
|
||||
hardware plugin takes precedence; incompatible runtimes keep their stock codecs.
|
||||
Hardware decoder capacity is probed before the private component is advertised.
|
||||
If the driver's session limit is exhausted, Android can fall back to software
|
||||
decoding; that preserves functionality but not full-resolution performance.
|
||||
FramePort does not change Steam's global hardware-decoding settings.
|
||||
|
||||
Other packages and arm32 APKs do not receive the native-video setting or these
|
||||
codec assets. Rebuilding an older unrelated APK removes the previously bundled
|
||||
codec files, and installing an APK without its manifest disables its old wrapper.
|
||||
MP4 presence alone is not evidence of compatible surface/overlay semantics.
|
||||
|
||||
Package-specific patch revisions use the existing Update on Frame state without
|
||||
adding UI controls or wording. The shared adapter revision is unchanged; only
|
||||
Batman is marked outdated for this repair. Older builds without recorded recipe
|
||||
fingerprints are handled with the same package scope.
|
||||
|
||||
## Decode and render path
|
||||
|
||||
`native/hevc/frameport_hevc.cpp` exposes `OMX.frameport.hevc.decoder` through the
|
||||
tested SoftOMX ABI, using FFmpeg's LGPL Iris V4L2 hardware decoder wrapper.
|
||||
Native surface clients receive full-resolution YUV hardware buffers with fences.
|
||||
Persistent workers copy disjoint NV12 row bands into Android buffers without
|
||||
CPU color conversion. Input timestamps, EOS, dynamic dimensions, seek and flush
|
||||
are preserved.
|
||||
|
||||
An AImageReader retains the decoder's actual image. The surface worker samples
|
||||
that original YUV buffer and fuses conversion with visible-view projection on
|
||||
the GPU. Vulkan imports the finished shared view with explicit foreign ownership
|
||||
transfers. There is no full-panorama RGB intermediate or CPU picture readback.
|
||||
The default native output is 2560x2560 per eye with a 12% tangent-space guard;
|
||||
an explicit `equirect_res` takes precedence.
|
||||
|
||||
Every finished view carries the camera that actually generated its pixels.
|
||||
Submitted game projection views are preferred over another tracking query.
|
||||
The worker coalesces video/view arrivals and reuses held pixels only while the
|
||||
visible frustum remains covered. Color/source changes redraw content without
|
||||
unnecessarily changing the covered panorama-local sampling camera. Infinite
|
||||
panoramas retain their layer rotation and have no translational parallax.
|
||||
|
||||
## Stable composition
|
||||
|
||||
A separately submitted projected video layer can alternate with the main game
|
||||
projection as opaque coverage changes during head movement. That presentation
|
||||
path exhibited snap-back/doubled video in headset tests even when rendering
|
||||
and submitted camera metadata agreed.
|
||||
|
||||
The native path instead snapshots the game's successfully waited stereo color
|
||||
image **before forwarding its release**, restoring its color-attachment layout
|
||||
after the copy. Acquisition indices are tracked in FIFO order. The application
|
||||
image is never sampled or modified after its OpenXR release, and release is not
|
||||
deferred. Snapshot generations must match the last successful release.
|
||||
|
||||
The final GPU pass reprojects the cached video into the current game camera,
|
||||
blends it with the scene in linear light, and draws directly into a runtime sRGB
|
||||
attachment. One primary projection contains both scene and video, including
|
||||
fades and uncovered hemisphere edges. Later subtitles/menu layers keep their
|
||||
order. Once this output is ready, movie updates copy only to its private cache,
|
||||
avoiding the additional standalone-output copy.
|
||||
|
||||
Batman attaches color-scale/bias and image-layout structures even when their
|
||||
transforms are identity. The compositor applies RGB/alpha scale and bias using
|
||||
OpenXR's straight-color transform and restored premultiplication, and respects
|
||||
vertical orientation. Unknown scene/view chains, unsupported layout flags, and
|
||||
intervening layers keep the ordinary fallback; settings are not silently lost.
|
||||
The push constants fit Vulkan's guaranteed 128-byte minimum.
|
||||
|
||||
Each output image has separate commands, descriptors and fences. Positive wait
|
||||
timeouts retain acquisition for retry. Missing snapshots retain the previous
|
||||
combined output with the exact camera that produced it; old pixels are never
|
||||
relabelled with a newer pose. Teardown retires snapshot writers and compositor
|
||||
readers. Depth/motion-vector images from another render are not attached.
|
||||
|
||||
## Building and validation
|
||||
|
||||
Rebuild FrameBridge with Android NDK r27c:
|
||||
|
||||
```sh
|
||||
python native/build.py --only adapter --ndk /path/to/android-ndk-r27c
|
||||
```
|
||||
|
||||
The hardware plugin builder and its pinned source/runtime requirements are in
|
||||
`native/hevc/README.md`. Shader sources and their generated SPIR-V are included.
|
||||
Compile them for Vulkan 1.0 and validate with `spirv-val` when changing them.
|
||||
|
||||
The host tests cover package-scoped settings/assets/freshness, existing-wrapper
|
||||
updates, codec extraction checksums, runtime/container isolation, and preservation
|
||||
of original video assets. Android fixtures in `tests/fixtures/src/` exercise the
|
||||
production Vulkan shaders, hardware worker, camera/coverage helpers and YUV copies.
|
||||
The original-8K worker test requires a lawfully supplied cutscene file and the
|
||||
private codec in an isolated Android container; no game assets are distributed.
|
||||
|
||||
Validation on Steam Frame included stereo/fade/transparent/uncovered pixels,
|
||||
asymmetric vertical orientation, color/alpha transforms, unsupported-chain
|
||||
fallback, timeout retry, held camera metadata, reader teardown, hardware playback,
|
||||
pause/resume and seek. One isolated run presented 594/600 and 118/120 distinct
|
||||
scheduled original pictures, none early; 120 moving-head composition frames
|
||||
averaged 1.16 ms for submission plus GPU completion. These are isolated fixture
|
||||
results, not a guarantee of full-game frame rate.
|
||||
|
||||
The final build was also tested in Batman in-headset: cutscenes displayed and
|
||||
head-movement snap-back was reported resolved. Logs confirmed the combined path,
|
||||
full-resolution hardware decoding, over 12,500 scene frames with only two startup
|
||||
holds, and no subsequent old promotion messages or composition setup failures.
|
||||
Some frame-rate dips and existing Unity render-pass warnings remain. The patch
|
||||
does not claim universal game compatibility, exact Quest 3 pixel equivalence,
|
||||
or perfect frame timing.
|
||||
@@ -0,0 +1,61 @@
|
||||
# Themes
|
||||
|
||||
FramePort comes with three colour themes, all dark:
|
||||
|
||||
| Theme | Look |
|
||||
|---|---|
|
||||
| **Portal** (default) | The logo's two portals: orange for actions and the current selection, blue for secondary actions, progress and the PC side. |
|
||||
| **Portal (OLED)** | Portal on true black, for OLED screens. |
|
||||
| **Original** | FramePort's first look, with a violet accent. |
|
||||
|
||||
Switch in **Settings → Appearance**. The change applies at once.
|
||||
|
||||
## Your own theme
|
||||
|
||||
A theme is a small JSON file. To make one:
|
||||
|
||||
1. In **Settings → Appearance**, pick the theme closest to what you want and click **Copy this theme as a file**.
|
||||
2. Paste it into a text editor and save it as `something.json`.
|
||||
3. Change the name and the colours you want different. You can delete every colour you keep: missing colours come
|
||||
from the `base` theme.
|
||||
4. Back in **Settings → Appearance**, click **Install theme file…** and choose the file. FramePort checks it,
|
||||
switches to it and keeps a copy in its data folder (`themes/`), so you can delete the original.
|
||||
|
||||
To remove an installed theme, click the bin icon on its card.
|
||||
|
||||
### Format
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Ember & Ice",
|
||||
"base": "portal",
|
||||
"dual": true,
|
||||
"colors": {
|
||||
"ACCENT": "#FF5A36",
|
||||
"SECONDARY": "#5CE1E6"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
| `name` | Shown on the theme's card (up to 40 characters). |
|
||||
| `base` | The built-in theme that fills in every colour the file leaves out: `portal` (default), `portal_oled` or `original`. |
|
||||
| `dual` | `true`: two-colour touches like Portal's (blue-to-orange sidebar edge, two-colour "FramePort", the selected tab's fade, blue secondary buttons). `false`: one accent, like Original. Default: the base's. |
|
||||
| `colors` | Any of the colours below, as `#RRGGBB` or `#RGB`. Names may be upper or lower case. |
|
||||
|
||||
| Colour | Used for |
|
||||
|---|---|
|
||||
| `BG` | Window background |
|
||||
| `SIDEBAR` | Sidebar and activity panel |
|
||||
| `SURFACE`, `SURFACE_2`, `SURFACE_3` | Cards; raised and hovered parts; inputs and chips |
|
||||
| `BORDER`, `BORDER_STRONG` | Outlines |
|
||||
| `TEXT`, `TEXT_2`, `TEXT_3` | Main text; secondary text; captions and disabled text |
|
||||
| `ACCENT`, `ACCENT_SOFT`, `ON_ACCENT` | Main buttons and the current selection; its tint; text on it |
|
||||
| `SECONDARY`, `SECONDARY_SOFT` | Secondary buttons, progress, switch tracks; its tint |
|
||||
| `OK`, `WARN`, `ERROR`, `INFO` | Status: works, needs attention, failed, information |
|
||||
| `PC` | PC VR games and "on this PC" |
|
||||
|
||||
FramePort refuses a theme file it can't show well, and says why: a light window background (FramePort is dark only),
|
||||
text that's hard to read on cards, an unknown colour name or a value that isn't a colour. An example is in
|
||||
[`themes/example-theme.json`](themes/example-theme.json).
|
||||
@@ -0,0 +1,28 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="216" height="60" viewBox="0 0 216 60" role="img" aria-label="Install with FramePort"><title>Install with FramePort</title><style>.fp-wb,.fp-wo{transform-box:view-box}
|
||||
.fp-wb{transform-origin:0 0;animation:fp-wb 6s ease-in-out infinite}
|
||||
.fp-wo{transform-origin:216px 0;animation:fp-wo 6s ease-in-out infinite}
|
||||
.fp-core{animation:fp-core 6s ease-in-out infinite}
|
||||
@keyframes fp-wb{0%,10%,100%{opacity:.45;transform:scaleX(1)}32%{opacity:1;transform:scaleX(1.5)}54%{opacity:.3;transform:scaleX(1)}}
|
||||
@keyframes fp-core{0%,28%,100%{opacity:0}42%{opacity:1}60%{opacity:0}}
|
||||
@keyframes fp-wo{0%,38%,100%{opacity:.6;transform:scaleX(1)}60%{opacity:1;transform:scaleX(1.4)}84%{opacity:.6;transform:scaleX(1)}}
|
||||
@media (prefers-reduced-motion:reduce){.fp-wb,.fp-wo,.fp-core{animation:none!important}}</style><defs>
|
||||
<linearGradient id="fab" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".46"/><stop offset=".55" stop-color="#3AA8FF" stop-opacity="0"/></linearGradient>
|
||||
<linearGradient id="fao" x1="0" y1="0" x2="1" y2="0"><stop offset=".45" stop-color="#FF8A1F" stop-opacity="0"/><stop offset="1" stop-color="#FF8A1F" stop-opacity=".34"/></linearGradient>
|
||||
<radialGradient id="far" gradientUnits="userSpaceOnUse" cx="122" cy="39" r="46" gradientTransform="translate(122 39) scale(1 .62) translate(-122 -39)"><stop offset="0" stop-color="#FFE2BD" stop-opacity=".42"/><stop offset=".25" stop-color="#FF8A1F" stop-opacity=".2"/><stop offset=".6" stop-color="#3AA8FF" stop-opacity=".08"/><stop offset="1" stop-color="#3AA8FF" stop-opacity="0"/></radialGradient>
|
||||
<clipPath id="fac"><rect x="1" y="1" width="214" height="58" rx="11.5"/></clipPath></defs>
|
||||
<rect x=".5" y=".5" width="215" height="59" rx="12" fill="#0D0E12" stroke="#2A2D37"/>
|
||||
<g clip-path="url(#fac)"><rect class="fp-wb" x="1" y="1" width="214" height="58" fill="url(#fab)" opacity=".45"/><rect class="fp-wo" x="1" y="1" width="214" height="58" fill="url(#fao)" opacity=".6"/><rect class="fp-core" x="1" y="1" width="214" height="58" fill="url(#far)" opacity="0"/></g>
|
||||
<g transform="translate(10 10) scale(0.625)">
|
||||
<defs><linearGradient id="fal0" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".18"/><stop offset=".5" stop-color="#3AA8FF" stop-opacity="0"/><stop offset=".5" stop-color="#FF8A1F" stop-opacity="0"/><stop offset="1" stop-color="#FF8A1F" stop-opacity=".18"/></linearGradient>
|
||||
<linearGradient id="fal1" gradientUnits="userSpaceOnUse" x1="26" y1="0" x2="38" y2="0"><stop offset=".3" stop-color="#3AA8FF"/><stop offset=".7" stop-color="#FF8A1F"/></linearGradient>
|
||||
<clipPath id="fal2"><polygon points="-30,-30 49.145,-30 8.855,94 -30,94"/></clipPath><clipPath id="fal3"><polygon points="55.145,-30 94,-30 94,94 14.855,94"/></clipPath></defs>
|
||||
<rect width="64" height="64" rx="15" fill="#101218"/><rect width="64" height="64" rx="15" fill="url(#fal0)"/>
|
||||
<g clip-path="url(#fal2)"><path d="M34 15H9a3 3 0 0 0-3 3v20a3 3 0 0 0 3 3h25z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"/><rect class="fp-scr" x="10.5" y="19.5" width="24" height="17" rx="1" fill="#3AA8FF" fill-opacity="0.35"/><path d="M18 41v6M11 47h14" stroke="#ECEDF3" stroke-width="3" stroke-linecap="round"/></g>
|
||||
<g clip-path="url(#fal3)"><path d="M56.5 31.5H58.5" stroke="#ECEDF3" stroke-width="3.4" stroke-linecap="round"/><path d="M22 21h27a8 8 0 0 1 8 8v5a8 8 0 0 1-8 8H48.65a3 3 0 0 1-2.6-1.5l-1-1.7a.9.9 0 0 0-1.6 0l-1 1.7a3 3 0 0 1-2.6 1.5H22z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"/><g class="fp-lens"><ellipse cx="39.5" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"/><ellipse cx="49" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"/></g></g>
|
||||
<g transform="rotate(18 32 32)"><g class="fp-ptl"><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="#08090C" stroke="#08090C" stroke-width="5.8"/><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="none" stroke="url(#fal1)" stroke-opacity=".25" stroke-width="6.46" class="fp-halo"/><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="url(#fal1)" fill-opacity="0.14" stroke="url(#fal1)" stroke-width="3.4"/></g></g></g>
|
||||
<text x="60" y="25" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="9.5" font-weight="600" letter-spacing="1.4" fill="#A7ABB7">INSTALL WITH</text>
|
||||
<text x="60" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#FF8A1F" textLength="53.1" lengthAdjust="spacingAndGlyphs">Frame</text>
|
||||
<g transform="translate(115.25999999999999 29.36) scale(0.8035714285714286)"><g class="fp-ptl"><defs><linearGradient id="fawr" gradientUnits="userSpaceOnUse" x1="2" y1="0" x2="14" y2="0"><stop offset=".3" stop-color="#FF8A1F"/><stop offset=".7" stop-color="#3AA8FF"/></linearGradient></defs>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="none" stroke="url(#fawr)" stroke-opacity=".35" stroke-width="5" class="fp-halo"/>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="#0D0E12" stroke="url(#fawr)" stroke-width="2.6"/></g></g>
|
||||
<text x="130.27714285714285" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#3AA8FF" textLength="36.9" lengthAdjust="spacingAndGlyphs">Port</text></svg>
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
@@ -0,0 +1,26 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="216" height="60" viewBox="0 0 216 60" role="img" aria-label="Install with FramePort"><title>Install with FramePort</title><style>.fp-wb,.fp-wo{transform-box:view-box;transition:opacity .5s ease,transform .7s cubic-bezier(.2,.8,.2,1)}
|
||||
.fp-wb{transform-origin:0 0}.fp-wo{transform-origin:216px 0}
|
||||
.fp-core{transition:opacity .6s ease}
|
||||
svg:hover .fp-wb{opacity:1;transform:scaleX(1.4)}svg:hover .fp-wo{opacity:1;transform:scaleX(1.3)}
|
||||
svg:hover .fp-core{opacity:1}
|
||||
@media (prefers-reduced-motion:reduce){.fp-wb,.fp-wo,.fp-core{transition:none!important}}</style><defs>
|
||||
<linearGradient id="fhb" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".46"></stop><stop offset=".55" stop-color="#3AA8FF" stop-opacity="0"></stop></linearGradient>
|
||||
<linearGradient id="fho" x1="0" y1="0" x2="1" y2="0"><stop offset=".45" stop-color="#FF8A1F" stop-opacity="0"></stop><stop offset="1" stop-color="#FF8A1F" stop-opacity=".34"></stop></linearGradient>
|
||||
<radialGradient id="fhr" gradientUnits="userSpaceOnUse" cx="122" cy="39" r="46" gradientTransform="translate(122 39) scale(1 .62) translate(-122 -39)"><stop offset="0" stop-color="#FFE2BD" stop-opacity=".42"></stop><stop offset=".25" stop-color="#FF8A1F" stop-opacity=".2"></stop><stop offset=".6" stop-color="#3AA8FF" stop-opacity=".08"></stop><stop offset="1" stop-color="#3AA8FF" stop-opacity="0"></stop></radialGradient>
|
||||
<clipPath id="fhc"><rect x="1" y="1" width="214" height="58" rx="11.5"></rect></clipPath></defs>
|
||||
<rect x=".5" y=".5" width="215" height="59" rx="12" fill="#0D0E12" stroke="#2A2D37"></rect>
|
||||
<g clip-path="url(#fhc)"><rect class="fp-wb" x="1" y="1" width="214" height="58" fill="url(#fhb)" opacity=".45"></rect><rect class="fp-wo" x="1" y="1" width="214" height="58" fill="url(#fho)" opacity=".6"></rect><rect class="fp-core" x="1" y="1" width="214" height="58" fill="url(#fhr)" opacity="0"></rect></g>
|
||||
<g transform="translate(10 10) scale(0.625)">
|
||||
<defs><linearGradient id="fhl0" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".18"></stop><stop offset=".5" stop-color="#3AA8FF" stop-opacity="0"></stop><stop offset=".5" stop-color="#FF8A1F" stop-opacity="0"></stop><stop offset="1" stop-color="#FF8A1F" stop-opacity=".18"></stop></linearGradient>
|
||||
<linearGradient id="fhl1" gradientUnits="userSpaceOnUse" x1="26" y1="0" x2="38" y2="0"><stop offset=".3" stop-color="#3AA8FF"></stop><stop offset=".7" stop-color="#FF8A1F"></stop></linearGradient>
|
||||
<clipPath id="fhl2"><polygon points="-30,-30 49.145,-30 8.855,94 -30,94"></polygon></clipPath><clipPath id="fhl3"><polygon points="55.145,-30 94,-30 94,94 14.855,94"></polygon></clipPath></defs>
|
||||
<rect width="64" height="64" rx="15" fill="#101218"></rect><rect width="64" height="64" rx="15" fill="url(#fhl0)"></rect>
|
||||
<g clip-path="url(#fhl2)"><path d="M34 15H9a3 3 0 0 0-3 3v20a3 3 0 0 0 3 3h25z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"></path><rect class="fp-scr" x="10.5" y="19.5" width="24" height="17" rx="1" fill="#3AA8FF" fill-opacity="0.35"></rect><path d="M18 41v6M11 47h14" stroke="#ECEDF3" stroke-width="3" stroke-linecap="round"></path></g>
|
||||
<g clip-path="url(#fhl3)"><path d="M56.5 31.5H58.5" stroke="#ECEDF3" stroke-width="3.4" stroke-linecap="round"></path><path d="M22 21h27a8 8 0 0 1 8 8v5a8 8 0 0 1-8 8H48.65a3 3 0 0 1-2.6-1.5l-1-1.7a.9.9 0 0 0-1.6 0l-1 1.7a3 3 0 0 1-2.6 1.5H22z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"></path><g class="fp-lens"><ellipse cx="39.5" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"></ellipse><ellipse cx="49" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"></ellipse></g></g>
|
||||
<g transform="rotate(18 32 32)"><g class="fp-ptl"><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="#08090C" stroke="#08090C" stroke-width="5.8"></ellipse><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="none" stroke="url(#fhl1)" stroke-opacity=".25" stroke-width="6.46" class="fp-halo"></ellipse><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="url(#fhl1)" fill-opacity="0.14" stroke="url(#fhl1)" stroke-width="3.4"></ellipse></g></g></g>
|
||||
<text x="60" y="25" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="9.5" font-weight="600" letter-spacing="1.4" fill="#A7ABB7">INSTALL WITH</text>
|
||||
<text x="60" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#FF8A1F" textLength="53.1" lengthAdjust="spacingAndGlyphs">Frame</text>
|
||||
<g transform="translate(115.25999999999999 29.36) scale(0.8035714285714286)"><g class="fp-ptl"><defs><linearGradient id="fhwr" gradientUnits="userSpaceOnUse" x1="2" y1="0" x2="14" y2="0"><stop offset=".3" stop-color="#FF8A1F"></stop><stop offset=".7" stop-color="#3AA8FF"></stop></linearGradient></defs>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="none" stroke="url(#fhwr)" stroke-opacity=".35" stroke-width="5" class="fp-halo"></ellipse>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="#0D0E12" stroke="url(#fhwr)" stroke-width="2.6"></ellipse></g></g>
|
||||
<text x="130.27714285714285" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#3AA8FF" textLength="36.9" lengthAdjust="spacingAndGlyphs">Port</text></svg>
|
||||
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="216" height="60" viewBox="0 0 216 60" role="img" aria-label="Install with FramePort"><title>Install with FramePort</title><defs>
|
||||
<linearGradient id="fsb" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".46"/><stop offset=".55" stop-color="#3AA8FF" stop-opacity="0"/></linearGradient>
|
||||
<linearGradient id="fso" x1="0" y1="0" x2="1" y2="0"><stop offset=".45" stop-color="#FF8A1F" stop-opacity="0"/><stop offset="1" stop-color="#FF8A1F" stop-opacity=".34"/></linearGradient>
|
||||
<radialGradient id="fsr" gradientUnits="userSpaceOnUse" cx="122" cy="39" r="46" gradientTransform="translate(122 39) scale(1 .62) translate(-122 -39)"><stop offset="0" stop-color="#FFE2BD" stop-opacity=".42"/><stop offset=".25" stop-color="#FF8A1F" stop-opacity=".2"/><stop offset=".6" stop-color="#3AA8FF" stop-opacity=".08"/><stop offset="1" stop-color="#3AA8FF" stop-opacity="0"/></radialGradient>
|
||||
<clipPath id="fsc"><rect x="1" y="1" width="214" height="58" rx="11.5"/></clipPath></defs>
|
||||
<rect x=".5" y=".5" width="215" height="59" rx="12" fill="#0D0E12" stroke="#2A2D37"/>
|
||||
<g clip-path="url(#fsc)"><rect class="fp-wb" x="1" y="1" width="214" height="58" fill="url(#fsb)" opacity=".45"/><rect class="fp-wo" x="1" y="1" width="214" height="58" fill="url(#fso)" opacity=".6"/><rect class="fp-core" x="1" y="1" width="214" height="58" fill="url(#fsr)" opacity="0"/></g>
|
||||
<g transform="translate(10 10) scale(0.625)">
|
||||
<defs><linearGradient id="fsl0" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#3AA8FF" stop-opacity=".18"/><stop offset=".5" stop-color="#3AA8FF" stop-opacity="0"/><stop offset=".5" stop-color="#FF8A1F" stop-opacity="0"/><stop offset="1" stop-color="#FF8A1F" stop-opacity=".18"/></linearGradient>
|
||||
<linearGradient id="fsl1" gradientUnits="userSpaceOnUse" x1="26" y1="0" x2="38" y2="0"><stop offset=".3" stop-color="#3AA8FF"/><stop offset=".7" stop-color="#FF8A1F"/></linearGradient>
|
||||
<clipPath id="fsl2"><polygon points="-30,-30 49.145,-30 8.855,94 -30,94"/></clipPath><clipPath id="fsl3"><polygon points="55.145,-30 94,-30 94,94 14.855,94"/></clipPath></defs>
|
||||
<rect width="64" height="64" rx="15" fill="#101218"/><rect width="64" height="64" rx="15" fill="url(#fsl0)"/>
|
||||
<g clip-path="url(#fsl2)"><path d="M34 15H9a3 3 0 0 0-3 3v20a3 3 0 0 0 3 3h25z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"/><rect class="fp-scr" x="10.5" y="19.5" width="24" height="17" rx="1" fill="#3AA8FF" fill-opacity="0.35"/><path d="M18 41v6M11 47h14" stroke="#ECEDF3" stroke-width="3" stroke-linecap="round"/></g>
|
||||
<g clip-path="url(#fsl3)"><path d="M56.5 31.5H58.5" stroke="#ECEDF3" stroke-width="3.4" stroke-linecap="round"/><path d="M22 21h27a8 8 0 0 1 8 8v5a8 8 0 0 1-8 8H48.65a3 3 0 0 1-2.6-1.5l-1-1.7a.9.9 0 0 0-1.6 0l-1 1.7a3 3 0 0 1-2.6 1.5H22z" fill="#101218" stroke="#ECEDF3" stroke-width="3" stroke-linejoin="round"/><g class="fp-lens"><ellipse cx="39.5" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"/><ellipse cx="49" cy="30.5" rx="4.2" ry="3.8" fill="#FF8A1F"/></g></g>
|
||||
<g transform="rotate(18 32 32)"><g class="fp-ptl"><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="#08090C" stroke="#08090C" stroke-width="5.8"/><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="none" stroke="url(#fsl1)" stroke-opacity=".25" stroke-width="6.46" class="fp-halo"/><ellipse cx="32" cy="32" rx="4.5" ry="22" fill="url(#fsl1)" fill-opacity="0.14" stroke="url(#fsl1)" stroke-width="3.4"/></g></g></g>
|
||||
<text x="60" y="25" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="9.5" font-weight="600" letter-spacing="1.4" fill="#A7ABB7">INSTALL WITH</text>
|
||||
<text x="60" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#FF8A1F" textLength="53.1" lengthAdjust="spacingAndGlyphs">Frame</text>
|
||||
<g transform="translate(115.25999999999999 29.36) scale(0.8035714285714286)"><g class="fp-ptl"><defs><linearGradient id="fswr" gradientUnits="userSpaceOnUse" x1="2" y1="0" x2="14" y2="0"><stop offset=".3" stop-color="#FF8A1F"/><stop offset=".7" stop-color="#3AA8FF"/></linearGradient></defs>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="none" stroke="url(#fswr)" stroke-opacity=".35" stroke-width="5" class="fp-halo"/>
|
||||
<ellipse cx="8" cy="14" rx="4.4" ry="10.6" transform="rotate(14 8 14)" fill="#0D0E12" stroke="url(#fswr)" stroke-width="2.6"/></g></g>
|
||||
<text x="130.27714285714285" y="47" font-family="Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif" font-size="18" font-weight="800" fill="#3AA8FF" textLength="36.9" lengthAdjust="spacingAndGlyphs">Port</text></svg>
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 365 KiB After Width: | Height: | Size: 417 KiB |
|
After Width: | Height: | Size: 505 KiB |
|
Before Width: | Height: | Size: 917 KiB After Width: | Height: | Size: 667 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 916 KiB After Width: | Height: | Size: 561 KiB |
|
Before Width: | Height: | Size: 643 KiB After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 846 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 283 KiB |
@@ -0,0 +1,64 @@
|
||||
# The demo library for the docs screenshots and the demo tour (built by scripts/showcase/demo_home.py into an
|
||||
# isolated FRAMEPORT_HOME; see docs/SHOWCASE.md). Real catalog games, so recipes, patches and store art are the
|
||||
# ones FramePort really uses; the technical analysis of each (engine, XR API, libraries, sizes) is in
|
||||
# demo-analyses.json, exported from real APK analyses without any paths. Nothing here is anyone's own data.
|
||||
#
|
||||
# Per game:
|
||||
# frame: on the pretend Frame: internal | sd | outdated (internal, but an older build: "Update on Frame");
|
||||
# left out = not installed
|
||||
# played: last played, days before the render (the Library sorts the "On your Frame" shelf by it)
|
||||
# added: added to the library, days before the render (default 30)
|
||||
# tested: the last launch test passed (default: when installed)
|
||||
# tags: user tags (store genres become tags by themselves)
|
||||
# title: overrides the catalog/store title
|
||||
# art: pick = the art a user gets from Find artwork's Meta result (when the store's own art is a placeholder)
|
||||
|
||||
frame:
|
||||
battery: 82 # %
|
||||
running: com.StressLevelZero.BONELAB # the game the Monitor tab and the sidebar's live card show (it needs
|
||||
# store screenshots: Take screenshot adds one of it)
|
||||
|
||||
games:
|
||||
- package: com.camouflaj.manta
|
||||
frame: internal
|
||||
played: 0.6
|
||||
tags: [Favorites]
|
||||
- package: com.Sanzaru.Wrath2
|
||||
art: pick # the store's image service has a placeholder cover for it: use the picker's Meta result
|
||||
frame: sd
|
||||
played: 1.2
|
||||
tags: [Favorites]
|
||||
- package: com.twistedpixelgames.PILO
|
||||
frame: internal
|
||||
played: 2.4
|
||||
- package: com.StressLevelZero.BONELAB
|
||||
frame: internal
|
||||
played: 0.05
|
||||
- package: com.vertigogames.ImpactDevelopment
|
||||
frame: outdated
|
||||
played: 4.5
|
||||
- package: com.CyanWorlds.Myst
|
||||
frame: sd
|
||||
played: 6
|
||||
- package: com.playful.LuckysTale
|
||||
frame: internal
|
||||
played: 9
|
||||
tags: [Favorites]
|
||||
- package: com.FuturLab.PowerWashSimulator
|
||||
frame: internal
|
||||
played: 12
|
||||
- package: com.CyanWorlds.Riven
|
||||
added: 2
|
||||
- package: com.FireproofStudios.TheRoomVR
|
||||
- package: com.NewFolderGames.IAmCat
|
||||
- package: com.BithellGames.Arcsmith
|
||||
- package: com.zenstudios.PFXVRQuest
|
||||
- package: com.Ubisoft.ACNexusVR
|
||||
- package: com.Solfar.InDeath
|
||||
- package: com.survios.Creed
|
||||
- package: com.crytek.climb2
|
||||
- package: com.thunderful.legobricktales
|
||||
- package: com.GhostlyBirdGames.BattleGlide
|
||||
- package: cn.vr4p.oculus4xvrplayerov
|
||||
- package: rift.rick_and_morty_virtual_rick_ality
|
||||
added: 5
|
||||
@@ -0,0 +1,109 @@
|
||||
# The docs screenshots: scripts/showcase/render_docs.py renders each into docs/images/<name>.png from the demo
|
||||
# library (demo-library.yaml) with a pretend Frame, and rewrites a file only when the picture really changed.
|
||||
# Steps: see scripts/showcase/steps.py. Each shot starts in a fresh window (its own app session).
|
||||
#
|
||||
# viewport: [w, h] browser size in px (default below); scale: UI scale (1.0)
|
||||
# crop: {dialog: true, pad}: the open dialog; {anchor: <name>, left, top, width, height}: a box placed
|
||||
# relative to the top-left corner of the element called <name> (left/top may be negative);
|
||||
# or {x, y, width, height} in page px
|
||||
# docs: where the image is used (checked by the tests: every image a doc shows has an entry here)
|
||||
|
||||
vars:
|
||||
game: com.camouflaj.manta # installed on the pretend Frame
|
||||
new_game: com.CyanWorlds.Riven # in the library, not installed yet
|
||||
|
||||
defaults:
|
||||
viewport: [1280, 820]
|
||||
|
||||
shots:
|
||||
- name: library
|
||||
docs: [README.md]
|
||||
steps:
|
||||
- go: library
|
||||
- wait_for: "On your Frame"
|
||||
- settle: true
|
||||
|
||||
- name: game
|
||||
docs: [docs/INSTALL.md, docs/SHOWCASE.md]
|
||||
viewport: [1280, 1100]
|
||||
steps:
|
||||
- open_game: ${game}
|
||||
- wait_for: "Where it's installed"
|
||||
|
||||
- name: game-settings
|
||||
docs: [docs/INSTALL.md]
|
||||
steps:
|
||||
- open_game: ${game}
|
||||
- call: {fn: settings_dialog, args: ["${game}"]}
|
||||
- wait_for: "Game settings"
|
||||
crop: {dialog: true}
|
||||
|
||||
- name: patches
|
||||
docs: [docs/COMPATIBILITY.md]
|
||||
viewport: [1280, 2600]
|
||||
steps:
|
||||
- open_game: {package: "${game}", advanced: true}
|
||||
- wait_for: "What FramePort will do"
|
||||
crop: {anchor: "What FramePort will do", left: -32, top: -12, width: 1044, height: 820}
|
||||
|
||||
- name: frame
|
||||
docs: [docs/COMPATIBILITY.md]
|
||||
steps:
|
||||
- go: frame
|
||||
- wait_for: "Ready to play"
|
||||
|
||||
- name: files
|
||||
docs: [docs/COMPATIBILITY.md]
|
||||
steps:
|
||||
- go: files
|
||||
- wait_for: "Upload files…"
|
||||
- wait: 1.0
|
||||
- hook: {name: select_files, args: [1, 2]}
|
||||
|
||||
- name: screenshots
|
||||
docs: [README.md]
|
||||
steps:
|
||||
- go: screenshots
|
||||
- wait_for: "Take screenshot"
|
||||
|
||||
- name: screenshot-viewer
|
||||
docs: [README.md]
|
||||
steps:
|
||||
- go: screenshots
|
||||
- wait_for: "Take screenshot"
|
||||
- wait: 1.5
|
||||
- call: {fn: screenshots_view.viewer, args: [0]}
|
||||
- wait_for: "Close"
|
||||
|
||||
- name: type-on-frame
|
||||
docs: [README.md]
|
||||
steps:
|
||||
- hook: type_tab
|
||||
- wait_for: "Keyboard connected"
|
||||
|
||||
- name: monitor
|
||||
docs: [README.md]
|
||||
viewport: [1280, 1150]
|
||||
steps:
|
||||
- go: monitor
|
||||
- wait_for: "Processes"
|
||||
|
||||
# newer screens (docs/SHOWCASE.md's gallery; the README picks what it needs)
|
||||
- name: live-view # idle: a running stream shows its relay's random port and the data rate (no stable picture)
|
||||
docs: [docs/SHOWCASE.md]
|
||||
steps:
|
||||
- go: live
|
||||
- wait_for: "What the player sees"
|
||||
|
||||
- name: install-progress
|
||||
docs: [docs/SHOWCASE.md]
|
||||
steps:
|
||||
- hook: {name: held_install, args: ["${new_game}"]}
|
||||
- open_game: ${new_game}
|
||||
- wait_for: "Cancel"
|
||||
|
||||
- name: appearance
|
||||
docs: [docs/SHOWCASE.md]
|
||||
steps:
|
||||
- go: settings
|
||||
- wait_for: "Portal (OLED)"
|
||||
@@ -0,0 +1,125 @@
|
||||
# The install tutorial: from the download to the first game on the Steam Frame (docs/INSTALL.md links it; every
|
||||
# release attaches it as FramePort-install.mp4). FramePort starts as on a new computer (the "fresh" demo profile:
|
||||
# empty library, welcome screen, no Frame set up); what happens outside FramePort (the download, a command typed
|
||||
# on the Frame) is told on instruction cards. Recorded by scripts/showcase/record_video.py; the format is in
|
||||
# docs/SHOWCASE.md ("Videos").
|
||||
|
||||
output: docs/media/frameport-install.mp4
|
||||
budget_mb: 12
|
||||
poster_at: 9
|
||||
start:
|
||||
profile: fresh # FramePort's first start
|
||||
frame: disconnected # the Frame isn't set up yet
|
||||
route: welcome
|
||||
setup:
|
||||
- hook: {name: first_run, args: ["D:/Games", 1.4]} # the tool download and the folder scan, at a watchable pace
|
||||
|
||||
vars:
|
||||
game: com.playful.LuckysTale
|
||||
|
||||
title:
|
||||
heading: Installing FramePort
|
||||
line: From the download to your first game on the Steam Frame
|
||||
seconds: 3.4
|
||||
end:
|
||||
heading: You're set
|
||||
line: Your game is in the Frame's Steam library. More help in docs/INSTALL.md
|
||||
footer: github.com/spoopyghosty0/frameport
|
||||
seconds: 4.0
|
||||
|
||||
scenes:
|
||||
- name: download
|
||||
seconds: 7.5
|
||||
card:
|
||||
eyebrow: "Step 1 · On your computer"
|
||||
heading: Download FramePort
|
||||
steps:
|
||||
- "Open **github.com/spoopyghosty0/frameport** → **Releases** → the latest one"
|
||||
- "Download the archive for your computer: **FramePort-windows-x64.zip**, **FramePort-macos-arm64.zip** or **FramePort-linux-x64.tar.gz**"
|
||||
- "Extract it anywhere. There's no installer and no admin rights are needed"
|
||||
|
||||
- name: first-start
|
||||
seconds: 7.5
|
||||
card:
|
||||
eyebrow: "Step 2 · First start"
|
||||
heading: Start FramePort
|
||||
steps:
|
||||
- "**Windows:** open **FramePort.exe**. At “Windows protected your PC” choose **More info** → **Run anyway**"
|
||||
- "**macOS:** right-click **FramePort.app** → **Open** → **Open**"
|
||||
- "**Linux:** run **FramePort/FramePort**"
|
||||
note: "FramePort is signed with a free certificate, so your system asks once."
|
||||
|
||||
- name: welcome
|
||||
caption: ["FramePort gets itself ready", "It downloads the tools it uses (Java, OVRPort, apksigner) by itself"]
|
||||
hold: 1.0
|
||||
steps:
|
||||
- wait: 1.0
|
||||
- hook: {name: wait_jobs, args: [40]}
|
||||
- wait_for: "Java, OVRPort and apksigner are ready."
|
||||
- wait: 1.0
|
||||
|
||||
- name: connect
|
||||
caption: ["Connect your Steam Frame", "Once: FramePort shows a command to run on the Frame"]
|
||||
hold: 1.5
|
||||
steps:
|
||||
- click: "Set up the Frame"
|
||||
- wait: 1.6
|
||||
- click: "Show setup command"
|
||||
- wait_for: "Waiting for your Frame"
|
||||
- wait: 1.0
|
||||
- hover: "Copy"
|
||||
- wait: 1.4
|
||||
|
||||
- name: on-the-frame
|
||||
seconds: 10
|
||||
card:
|
||||
eyebrow: "Step 3 · On the Frame, first time only"
|
||||
heading: Run the setup command
|
||||
steps:
|
||||
- "In the SteamVR dashboard: **Launch a program** → **Desktop**"
|
||||
- "Open the app menu (bottom left) → **System** → **Konsole**"
|
||||
- "Type the command FramePort shows and press **Enter**"
|
||||
code: "curl -fsS <your-PC-address>:8765/<one-time-code> | bash"
|
||||
note: "FramePort shows your PC's address and a one-time code in place of **<…>**. The desktop closes by itself after a few seconds (Steam restarts once); if Steam asks to install **Lepton**, confirm it. No password is needed."
|
||||
|
||||
- name: connected
|
||||
caption: ["Your Frame is connected", "From now on FramePort finds it by itself"]
|
||||
hold: 1.2
|
||||
steps:
|
||||
- hook: {name: pairing_done, args: [1.6]}
|
||||
- wait_for: "Ready to play"
|
||||
- wait: 1.2
|
||||
- hover: "Quest games (Lepton)"
|
||||
- wait: 1.6
|
||||
|
||||
- name: add-games
|
||||
caption: ["Add your games", "Point FramePort at the folder with your games"]
|
||||
hold: 1.0
|
||||
steps:
|
||||
- nav: "Library"
|
||||
- wait: 1.2
|
||||
- click: "Scan a folder…"
|
||||
- hook: {name: wait_jobs, args: [40]}
|
||||
- wait: 1.2
|
||||
- hover: {name: "Lucky's Tale", dy: 0.3}
|
||||
- wait: 1.0
|
||||
|
||||
- name: install
|
||||
caption: ["Install a game", "FramePort patches it, installs it and adds it to the Frame's Steam library"]
|
||||
hold: 1.2
|
||||
steps:
|
||||
- click: {name: "Lucky's Tale", dy: 0.35} # (the title: the card's middle is its Install button)
|
||||
- wait_for: "Where it's installed" # (the game page: a click that missed fails here)
|
||||
- wait: 1.2
|
||||
- click: "Install on Frame"
|
||||
- wait: 0.6
|
||||
- move: [860, 640]
|
||||
- hook: {name: wait_jobs, args: [45]}
|
||||
- wait: 1.0
|
||||
|
||||
- name: play
|
||||
caption: ["Play", "Start it from FramePort, or from Steam in the headset"]
|
||||
steps:
|
||||
- click: "Play on Frame"
|
||||
- wait: 2.6
|
||||
- park: true
|
||||
@@ -0,0 +1,134 @@
|
||||
# The demo tour: FramePort in use (README teaser, docs/media, every release as FramePort-tour.mp4).
|
||||
# Recorded by scripts/showcase/record_video.py; the storyboard format is in docs/SHOWCASE.md ("Videos").
|
||||
|
||||
output: docs/media/frameport-tour.mp4
|
||||
teaser: docs/images/tour-teaser.webp
|
||||
budget_mb: 12
|
||||
start:
|
||||
profile: demo # the library in use: games installed on the pretend Frame, BONELAB running
|
||||
frame: connected
|
||||
|
||||
vars:
|
||||
game: com.camouflaj.manta # installed on the pretend Frame
|
||||
new_game: com.CyanWorlds.Riven # installed during the tour
|
||||
|
||||
title:
|
||||
heading: FramePort
|
||||
line: Quest, Android and PC VR games on the Steam Frame
|
||||
seconds: 3.2
|
||||
end:
|
||||
heading: FramePort
|
||||
line: Open source · bring your own games
|
||||
footer: github.com/spoopyghosty0/frameport
|
||||
seconds: 3.6
|
||||
|
||||
scenes:
|
||||
- name: library
|
||||
caption: ["Your library, ready for the Frame", "Quest, Android and PC VR games from your own folders"]
|
||||
teaser: [0.8, 3.2]
|
||||
steps:
|
||||
- go: library
|
||||
- wait: 1.2
|
||||
- hover: {name: "Batman: Arkham Shadow", dy: 0.3}
|
||||
- wait: 1.0
|
||||
- hover: {name: "Marvel's Deadpool VR", dy: 0.3}
|
||||
- wait: 0.8
|
||||
- hover: "Assassin's Creed Nexus"
|
||||
- wait: 0.8
|
||||
- hover: "Lucky's Tale"
|
||||
- wait: 0.8
|
||||
- park: true
|
||||
- type: "ri"
|
||||
- wait: 1.6
|
||||
|
||||
- name: game
|
||||
caption: ["Every game gets its own recipe", "Known-good fixes from the catalog, or suggested from the game itself"]
|
||||
steps:
|
||||
- click: {name: "Riven", dy: 0.35} # (the title: the card's middle is its Install button)
|
||||
- wait: 1.8
|
||||
- hover: "Works"
|
||||
- wait: 0.7
|
||||
- scroll: {dy: 420, at: [860, 560]}
|
||||
- wait: 1.2
|
||||
- scroll: {dy: -420, at: [860, 560]}
|
||||
- wait: 0.5
|
||||
|
||||
- name: install
|
||||
caption: ["One click to install", "Patched, signed, uploaded, added to Steam and launch-tested"]
|
||||
teaser: [0.6, 4.0]
|
||||
hold: 1.2
|
||||
steps:
|
||||
- click: "Install on Frame"
|
||||
- wait: 0.6
|
||||
- move: [860, 640]
|
||||
- hook: {name: wait_jobs, args: [45]}
|
||||
- wait: 1.0
|
||||
|
||||
- name: play
|
||||
caption: ["Play from your PC", "Starts the game in the headset through Steam"]
|
||||
teaser: [4.3, 3.2]
|
||||
steps:
|
||||
- nav: "Library"
|
||||
- call: library_view.clear_search
|
||||
- wait: 1.4
|
||||
- hover: {name: "Asgard's Wrath 2", dy: 0.3}
|
||||
- wait: 0.6
|
||||
- hover: {name: "Batman: Arkham Shadow", dy: 0.3}
|
||||
- wait: 0.6
|
||||
- click: {name: "Play on Frame", nth: 0}
|
||||
- wait: 2.6
|
||||
- park: true
|
||||
- wait: 0.4
|
||||
|
||||
- name: monitor
|
||||
caption: ["See what the Frame is doing", "Frame rate, CPU, GPU, temperatures and every process, live"]
|
||||
teaser: [0.5, 2.6]
|
||||
steps:
|
||||
- nav: "Monitor"
|
||||
- wait: 2.4
|
||||
- hover: "Temperature" # (a tile only: "GPU" is also the process table's sortable column)
|
||||
- wait: 1.0
|
||||
- hover: "Battery"
|
||||
- wait: 1.0
|
||||
- click: "Show details"
|
||||
- wait: 1.8
|
||||
- park: true
|
||||
|
||||
- name: screenshots
|
||||
caption: ["Screenshots from the headset", "Take one from the PC, then view or download them"]
|
||||
steps:
|
||||
- nav: "Screenshots"
|
||||
- wait: 1.6
|
||||
- click: "Take screenshot"
|
||||
- wait_for: "BONELAB · 2026-10-04 21:50"
|
||||
- wait: 0.8
|
||||
- click: "BONELAB · 2026-10-04 21:50"
|
||||
- wait: 2.0
|
||||
- click: "Close"
|
||||
- wait: 0.4
|
||||
|
||||
- name: files
|
||||
caption: ["Files on the Frame", "Videos, mods and saves: upload, download, select with a drag"]
|
||||
steps:
|
||||
- nav: "Files"
|
||||
- wait: 1.6
|
||||
- drag: ["Concert 8K 3D.mp4", "Mars landing (VR180).mkv"]
|
||||
- wait: 1.0
|
||||
- right_click: "Earth from orbit (360).mp4"
|
||||
- wait: 1.4
|
||||
- press: Escape
|
||||
- wait: 0.6
|
||||
|
||||
- name: themes
|
||||
caption: ["Make it yours", "Dark themes, including true black for OLED screens"]
|
||||
steps:
|
||||
- nav: "Settings"
|
||||
- wait: 1.4
|
||||
- click: "Portal (OLED)"
|
||||
- wait: 1.4
|
||||
- click: "Original"
|
||||
- wait: 1.4
|
||||
- click: "Portal"
|
||||
- wait: 1.0
|
||||
- nav: "Library"
|
||||
- wait: 1.4
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Ember & Ice",
|
||||
"base": "portal",
|
||||
"dual": true,
|
||||
"colors": {
|
||||
"ACCENT": "#FF5A36",
|
||||
"ACCENT_SOFT": "#3A1710",
|
||||
"SECONDARY": "#5CE1E6",
|
||||
"SECONDARY_SOFT": "#0E3033",
|
||||
"PC": "#5CE1E6",
|
||||
"INFO": "#5CE1E6"
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,11 @@ embeds debug paths (`-g`) and the dex depends on the d8 version, so those differ
|
||||
|
||||
| Dir | Artifact | What / why |
|
||||
|---|---|---|
|
||||
| `adapter/` | `{arm64-v8a,armeabi-v7a}/libopenxr_loader_generic.so` | **FrameBridge**: replaces overport's generic loader (which is renamed `libopenxr_loader_original.so`) and fixes Steam Frame runtime gaps. Hooks xrCreateInstance, swapchains, xrEndFrame, spaces, xrPollEvent, … everything else is forwarded by `gen_forwarders.py`-generated tail calls. `scene_emu.c` = Meta scene/spatial-entity emulation; `flip_vk.c` = Vulkan blit for VERTICAL_FLIP quads. `session_fixes.c` = per-game session fixes, all off by default and hooked only when on (`layer_debug` diagnostics, `stable_local`, `focus_hold`, aim correction `aim_pitch/aim_yaw/aim_forward`, `refresh_rate`, `proximity_emul` = finger proximity (XR_FB_touch_controller_proximity, which the Frame lacks) from the capacitive touch inputs: OVRPlugin's `hand_thumb_proximity`/`hand_trigger_proximity` actions get extra Touch bindings); `input_diag.c` = controller-input diagnostics (setting `input_diag`, off by default and hooked only when on; logs suggested interaction profiles and the runtime's answers, each hand's current profile, functions the runtime lacks and failing input/haptics/perf calls, each line once; tested on the host by `tests/test_input_diag.py`); `layer_emul_gl.c` = `equirect_emul` (GLES sessions only): 360° equirect/equirect2 layers become one adapter projection layer, drawn by a worker thread with its own EGL context shared with the app's: each 360° image is converted to a cube map only when it changes, and the view is redrawn only after a 4° head turn (GL/EGL resolved with dlopen, so Vulkan games never load them); `layer_math.h` = their pose/face math, tested on the host by `tests/test_layer_emul.py`. `render_model.c` = XR_FB_render_model emulation (setting `controller_models`, off by default): serves `files/framebridge/controller_{left,right}.glb`, which the agent converts on the Frame from SteamVR's own Frame controller render models (never shipped by FramePort); tested on the host by `tests/test_render_model.py`. Settings: `libframe_settings.so` in the APK + `settings.conf`/`framebridge.conf` on the Frame. |
|
||||
| `adapter/` | `{arm64-v8a,armeabi-v7a}/libopenxr_loader_generic.so` | **FrameBridge**: replaces overport's generic loader (which is renamed `libopenxr_loader_original.so`) and fixes Steam Frame runtime gaps. Hooks xrCreateInstance, swapchains, xrEndFrame, spaces, xrPollEvent, … everything else is forwarded by `gen_forwarders.py`-generated tail calls. `scene_emu.c` = Meta scene/spatial-entity emulation; `flip_vk.c` = Vulkan blit for VERTICAL_FLIP quads. `session_fixes.c` = per-game session fixes, all off by default and hooked only when on (`layer_debug` diagnostics, `stable_local`, `focus_hold`, aim correction `aim_pitch/aim_yaw/aim_forward`, `refresh_rate`); `input_diag.c` = controller-input diagnostics (setting `input_diag`, off by default and hooked only when on; logs suggested interaction profiles and the runtime's answers, each hand's current profile, functions the runtime lacks and failing input/haptics/perf calls, each line once; tested on the host by `tests/test_input_diag.py`); `layer_emul_gl.c` = `equirect_emul` (GLES sessions only): 360° equirect/equirect2 layers become one adapter projection layer, drawn by a worker thread with its own EGL context shared with the app's: each 360° image is converted to a cube map only when it changes, and the view is redrawn only after a 4° head turn (GL/EGL resolved with dlopen, so Vulkan games never load them); `layer_math.h` = their pose/face math, tested on the host by `tests/test_layer_emul.py`. `render_model.c` = XR_FB_render_model emulation (setting `controller_models`, off by default): serves `files/framebridge/controller_{left,right}.glb`, which the agent converts on the Frame from SteamVR's own Frame controller render models (never shipped by FramePort); tested on the host by `tests/test_render_model.py`. Settings: `libframe_settings.so` in the APK + `settings.conf`/`framebridge.conf` on the Frame. |
|
||||
| `vrapi-bridge/` | `arm64-v8a/libvrapi.so` | VrApi → OpenXR bridge from [Android-XR-Bridge/OVRPort](https://github.com/Android-XR-Bridge/OVRPort) `native/vrapi` at 5e7df52 (GPL-3.0, `LICENSE.upstream`; unchanged upstream as of OVRPort v1.2.5, which ships the unpatched code as its opt-in `patch_vrapi_openxr` in experimental CLI builds), with our changes in `upstream-patches/`: GLES sessions + GL texture swapchains, cylinder→quad layers, GL vertical flip, UNORM↔sRGB format twins, 30 s VR-mode deadline, VALID-only recenter, loading-icon layers skipped, `vrapi_PollEvent`/`RecenterPose`/`SetDisplayRefreshRate`/`GetSystemPropertyFloatArray` (BlazeRush imports them, GitHub #57), diagnostics behind `-DOVP_GL_DIAG`. `upstream-patches/` reproduces these sources from the fork's `native/vrapi` (checked 2026-10-06 against its latest commit); upstream PRs Android-XR-Bridge/OVRPort#3-#8, tracked in GitHub #75. |
|
||||
| `platformcompat/` | `arm64-v8a/libovrplatformcompat.so` | Real `ovrMessageType_ToString` (same fork, `native/platform`). |
|
||||
| `langpack/` | `arm64-v8a/libfp_langpack.so` | Language packs for the Meta Platform SDK (patch `frame.langpacks`, opt-in). overport's platform loader is a dispatcher in front of Meta's own loader and answers `ovr_LanguagePack_GetCurrent/SetCurrent` with `return 0` (no reply ever). This library becomes the loader's first DT_NEEDED; the loader's own exports of the 31 functions it defines are made STB_LOCAL in `.dynsym` (`elf.hide_exports`, nothing moves), so symbol lookups reach the library first. It serves `<tag>.lang` files found in the game's OBB / app files (`$FRAMEPORT_LANGPACK_DIRS` overrides the search path) through `ovr_LanguagePack_*`, `ovr_AssetFile_GetList` (the loader's list + the packs) and `ovr_AssetFile_StatusById`; its own message queue is merged into `ovr_PopMessage`, and every handle that is not ours (an address-range check) goes to the loader's original function, whose address is read at run time from the loader's in-memory `.dynsym`. With patch `frame.asset_files` (marker byte `@FPASSETS@`, or env `FRAMEPORT_ASSET_FILES=1`) it also lists the data's `*.pak` content files as installed `default` asset files and answers `ovr_AssetFile_DownloadById` for them at once (a completed `DownloadUpdate`, then the result with the path). Host-tested against a stand-in loader (`tests/test_langpack.py`, plain `cc`, no NDK); the bionic/headset side is unverified. |
|
||||
| `glshim/` | `arm64-v8a/libglshim.so` | Mesa GLSL compatibility for GLAD engines (hooks eglGetProcAddress): comments out `#pragma` before `#extension`, enables `GL_EXT_shader_implicit_conversions`, hides GL_OVR_multiview (`gl_hide_multiview`, default 1) and logs failed shaders. `-DGLSHIM_TRACE` adds per-FBO draw/error tracing. |
|
||||
| `glmv/` | `arm64-v8a/libfpglmv.so` | Single-view draws of OVR_multiview programs (patch `frame.gl_multiview_fbo`, opt-in, GitHub #77). Mesa enforces OVR_multiview's rule that a draw's program declares as many views as the draw framebuffer has; engines that compile every shader with `num_views=2` and also draw into ordinary 2D framebuffers (Doom3Quest's HUD/PDA pool) lose those draws. The engine library gets it as first DT_NEEDED (direct `gl*` imports) and its `dlopen("libGLESv3.so")` string is rewritten to `libfpglmv.so` (same length; its `qgl*` dlsym table); linked `--no-as-needed` to libGLESv3 so dlsym on its handle finds everything it doesn't wrap. It records stage sources at glLinkProgram, caches the draw framebuffer's color-attachment view count per bind, and when a multiview program draws into a 0-view framebuffer it binds a lazily built twin (`glmv_rewrite.h`: num_views layout blanked, `gl_ViewID_OVR` -> `(0u)`; attribute locations + uniform block bindings copied, default-block uniforms copied before every such draw with a shadow to skip unchanged ones), draws, rebinds the original. Logcat tag `GLMV`; `gl_mv_debug=1`. The rewriter is host-tested on Doom3Quest's 19 shaders (`tests/test_gl_multiview_fbo.py`); untested on the device. |
|
||||
| `zinkfix/` | `arm64-v8a/libVkLayer_fp_shaderfix.so` | Shader-fix Vulkan layer `VK_LAYER_FP_shader_fix` for OpenGL ES games (patch `frame.zink_shader_fix`): sits between Zink (Mesa's GL on Vulkan) and the driver and inserts the words of `zink_shader_fix` (same format as the Vulkan shim's `vk_shader_fix`: size + SHA-256 match) into SPIR-V modules; `zink_shader_dump=1` writes every distinct module to `files/fp_spirv/`. The engine library loads it first (DT_NEEDED); its constructor puts the layer in front of Android's GraphicsEnv debug layer list (private Android 11 `getDebugLayers`/`setDebugLayers`, found through libvulkan.so's dependencies) before EGL starts, so the loader picks it up from the app's lib dir. Exports only the enumeration functions and `VK_LAYER_FP_shader_fixGet*ProcAddr` (never plain `vk*` entry points). Vader Immortal's lightspeed shaders (Klownicle, GitHub #49). |
|
||||
| `xrlayer/` | `linux-arm64/libxr_frameport_timefix.so` + `XR_APILAYER_FRAMEPORT_timefix.json` | OpenXR API layer for Windows PC VR games under Proton on the Frame (glibc aarch64, built freestanding with the NDK's clang), on by default (patch `pcvr.xr_timefix`). Retries `xrCreateInstance` as an OpenXR 1.0 app when the runtime rejects 1.1 (the Frame's SteamVR runtime does, and Proton 11's VR helper asks for 1.1). Also emulates `xrConvertTimespecTimeToTimeKHR`/`xrConvertTimeToTimespecTimeKHR` if the runtime refuses them (the Frame's Android runtime does; its Linux runtime, used by Proton, supports them as of 2026-09-29 — so this part is only a fallback; Proton's wineopenxr needs them for `XR_KHR_win32_convert_performance_counter_time`, which Revive requires) with the adapter's xrWaitFrame-calibrated offset, and drops the extension from xrCreateInstance if the runtime rejects it. Enabled per game by the Proton launch.sh (`XR_API_LAYER_PATH`, `XR_ENABLE_API_LAYERS`). `tests/test_xrlayer.py` builds it for x86_64 and drives it via ctypes. |
|
||||
| `oculushmd/` | `win-x64/fp_oculushmd.exe` | PC VR counterpart of overport's `patch_oculus_unreal` (patch `pcvr.oculus_unreal`, default for Unreal Rift games on the Frame). Unreal's OculusHMD and LibOVR's `ovr_Detect` only start when the Windows named event `OculusHMDConnected` exists and is signalled (the Oculus service creates it). `fp_oculushmd.exe <command line>` creates it (manual reset, signalled), runs the command (Revive's injector) in a job object and keeps the event until every process in the job — the game and its children — has exited (fallback without job support: 3 minutes); returns the command's exit code and logs `FramePort oculushmd: …` to stderr (launch.log). Freestanding Windows x64 console exe (no CRT, no Windows SDK): the NDK's clang + `lld-link /Brepro` with a kernel32 import library generated by `llvm-dlltool`, so it's byte-reproducible. Tested on Windows from WSL with a build whose event name is `-DEVENT_NAME=L"…"` (the Oculus service owns the real event on a PC with the Oculus app). |
|
||||
| `xrshim/` | `arm64-v8a/libframe_xrshim.so` | FrameBridge extension shim, only in builds with `controller_models=1`. overport's dispatcher (`libopenxr_loader.so`) answers `xrGetInstanceProcAddr` from a fixed table and refuses everything else (`overportOXR: Unknown proc addr: xrLoadRenderModelFB`), so the adapter never sees XR_FB_render_model lookups. Meta's OVRPlugin gets the function with `dlopen("libopenxr_loader.so")` + `dlsym`, so FramePort rewrites that `.rodata` string in `libOVRPlugin.so` (same length, in place) to `libframe_xrshim.so`. The shim returns the adapter's emulated functions (`framebridge_extension_proc`) and forwards every other name to overport. A DT_NEEDED interposer does not work here (dlsym on a handle searches that library first); tried and dropped. |
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Included by frame_adapter.c (after layer_emul_gl.c, whose GL entry points it shares). cube_standin (default on):
|
||||
// the Frame's runtime has no cube layers (XR_KHR_composition_layer_cube) and refuses cube swapchains (faceCount 6)
|
||||
// with XR_ERROR_RUNTIME_FAILURE. OVRPlugin doesn't check: it goes on with "CreateSwapchain for eye 0: 0x0, 0 stages"
|
||||
// and writes past its empty image list in the next ovrp_EndFrame4 (Unity's render thread SIGSEGV in memset, e.g.
|
||||
// Budget Cuts Ultimate's cube-map overlay, GitHub #107). Only when the runtime refused one, a cube swapchain is served
|
||||
// by the adapter instead: one GL cube-map texture (the format, size and mip levels asked for) in the app's current
|
||||
// GLES context, acquire/wait/release succeed at once. The app renders or copies into it as usual; layers that use it
|
||||
// are dropped in xrEndFrame (the runtime couldn't show them anyway). Vulkan sessions (no current EGL context) keep
|
||||
// the runtime's error.
|
||||
#define STANDIN_MAX 8
|
||||
static struct { XrSwapchain handle; GLuint tex; } standins[STANDIN_MAX];
|
||||
static pthread_mutex_t standin_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static int standin_find(XrSwapchain handle) {
|
||||
if (!handle) return -1;
|
||||
int slot = -1;
|
||||
pthread_mutex_lock(&standin_lock);
|
||||
for (int i = 0; i < STANDIN_MAX && slot < 0; ++i)
|
||||
if (standins[i].handle == handle) slot = i;
|
||||
pthread_mutex_unlock(&standin_lock);
|
||||
return slot;
|
||||
}
|
||||
|
||||
static int is_standin(XrSwapchain handle) { return cube_standin && standin_find(handle) >= 0; }
|
||||
|
||||
// After the runtime refused a swapchain: serve a cube stand-in if it was a cube swapchain in a GLES context.
|
||||
static XrResult standin_after_failure(const XrSwapchainCreateInfo *info, XrSwapchain *out, XrResult result) {
|
||||
if (XR_SUCCEEDED(result) || !cube_standin || !info || !out || info->faceCount != 6) return result;
|
||||
if (info->width != info->height || !info->width || info->arraySize > 1) return result;
|
||||
if (!p_eglCreateContext && !emul_load_gl()) { LOG("cube_standin: no GLES, the runtime's error stays"); return result; }
|
||||
if (p_eglGetCurrentContext() == EGL_NO_CONTEXT) {
|
||||
LOG("cube_standin: no current GLES context (Vulkan?), the runtime's error stays");
|
||||
return result;
|
||||
}
|
||||
int slot = -1;
|
||||
pthread_mutex_lock(&standin_lock);
|
||||
for (int i = 0; i < STANDIN_MAX && slot < 0; ++i)
|
||||
if (!standins[i].handle) slot = i;
|
||||
if (slot >= 0) standins[slot].handle = (XrSwapchain)1; // reserved
|
||||
pthread_mutex_unlock(&standin_lock);
|
||||
if (slot < 0) { LOG("cube_standin: too many cube swapchains, the runtime's error stays"); return result; }
|
||||
GLsizei levels = info->mipCount > 1 ? (GLsizei)info->mipCount : 1;
|
||||
for (int i = 0; i < 8 && p_glGetError() != GL_NO_ERROR; ++i) {}
|
||||
GLint previous = 0;
|
||||
p_glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &previous);
|
||||
GLuint tex = 0;
|
||||
p_glGenTextures(1, &tex);
|
||||
p_glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
|
||||
p_glTexStorage2D(GL_TEXTURE_CUBE_MAP, levels, (GLenum)info->format, (GLsizei)info->width, (GLsizei)info->height);
|
||||
GLenum err = p_glGetError();
|
||||
p_glBindTexture(GL_TEXTURE_CUBE_MAP, (GLuint)previous); // the app's binding, untouched
|
||||
if (err != GL_NO_ERROR) {
|
||||
p_glDeleteTextures(1, &tex);
|
||||
pthread_mutex_lock(&standin_lock);
|
||||
standins[slot].handle = XR_NULL_HANDLE;
|
||||
pthread_mutex_unlock(&standin_lock);
|
||||
LOG("cube_standin: couldn't make a %ux%u cube map (GL 0x%x), the runtime's error stays", info->width,
|
||||
info->height, err);
|
||||
return result;
|
||||
}
|
||||
XrSwapchain handle = FAKE_HANDLE(XrSwapchain);
|
||||
pthread_mutex_lock(&standin_lock);
|
||||
standins[slot].handle = handle;
|
||||
standins[slot].tex = tex;
|
||||
pthread_mutex_unlock(&standin_lock);
|
||||
*out = handle;
|
||||
LOG("cube_standin: runtime refused a %ux%u cube swapchain (result=%d): served by FrameBridge (GL cube map %u, "
|
||||
"%d levels); its cube layers are dropped", info->width, info->height, result, tex, (int)levels);
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
static XrResult standin_enumerate(XrSwapchain handle, uint32_t capacity, uint32_t *count, XrSwapchainImageBaseHeader *images) {
|
||||
if (!count) return XR_ERROR_VALIDATION_FAILURE;
|
||||
*count = 1;
|
||||
if (!capacity) return XR_SUCCESS;
|
||||
if (!images) return XR_ERROR_VALIDATION_FAILURE;
|
||||
if (images->type != XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR) return XR_ERROR_VALIDATION_FAILURE;
|
||||
int slot = standin_find(handle);
|
||||
((emul_gles_image *)images)[0].image = slot >= 0 ? standins[slot].tex : 0;
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
static void standin_destroy(XrSwapchain handle) {
|
||||
pthread_mutex_lock(&standin_lock);
|
||||
for (int i = 0; i < STANDIN_MAX; ++i)
|
||||
if (standins[i].handle == handle) {
|
||||
if (p_eglGetCurrentContext && p_eglGetCurrentContext() != EGL_NO_CONTEXT) p_glDeleteTextures(1, &standins[i].tex);
|
||||
standins[i].handle = XR_NULL_HANDLE;
|
||||
standins[i].tex = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&standin_lock);
|
||||
}
|
||||
|
||||
// A layer that shows a stand-in: never passed to the runtime (whatever layer_fix says).
|
||||
static int layer_uses_standin(const XrCompositionLayerBaseHeader *layer) {
|
||||
if (!cube_standin || !layer) return 0;
|
||||
switch (layer->type) {
|
||||
case XR_TYPE_COMPOSITION_LAYER_CUBE_KHR:
|
||||
return is_standin(((const XrCompositionLayerCubeKHR *)layer)->swapchain);
|
||||
case XR_TYPE_COMPOSITION_LAYER_QUAD:
|
||||
return is_standin(((const XrCompositionLayerQuad *)layer)->subImage.swapchain);
|
||||
case XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR:
|
||||
return is_standin(((const XrCompositionLayerCylinderKHR *)layer)->subImage.swapchain);
|
||||
case XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR:
|
||||
return is_standin(((const XrCompositionLayerEquirectKHR *)layer)->subImage.swapchain);
|
||||
case XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR:
|
||||
return is_standin(((const XrCompositionLayerEquirect2KHR *)layer)->subImage.swapchain);
|
||||
case XR_TYPE_COMPOSITION_LAYER_PROJECTION: {
|
||||
const XrCompositionLayerProjection *p = (const XrCompositionLayerProjection *)layer;
|
||||
for (uint32_t v = 0; v < p->viewCount; ++v)
|
||||
if (is_standin(p->views[v].subImage.swapchain)) return 1;
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// XR_FB_swapchain_update_state on a stand-in: nothing to update (only hooked when the runtime has the function).
|
||||
static PFN_xrUpdateSwapchainFB real_update_swapchain;
|
||||
static PFN_xrGetSwapchainStateFB real_get_swapchain_state;
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL standin_update_swapchain(XrSwapchain swapchain, const XrSwapchainStateBaseHeaderFB *state) {
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
return real_update_swapchain ? real_update_swapchain(swapchain, state) : XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
}
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL standin_get_swapchain_state(XrSwapchain swapchain, XrSwapchainStateBaseHeaderFB *state) {
|
||||
if (is_standin(swapchain)) return XR_ERROR_VALIDATION_FAILURE; // no state to report (apps treat it as "unsupported")
|
||||
return real_get_swapchain_state ? real_get_swapchain_state(swapchain, state) : XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
}
|
||||
@@ -40,7 +40,6 @@ static XRAPI_ATTR XrResult XRAPI_CALL eye_hook_xrReleaseSwapchainImage(XrSwapcha
|
||||
const XrSwapchainImageReleaseInfo *info) {
|
||||
PFN_xrReleaseSwapchainImage fn = (PFN_xrReleaseSwapchainImage)lookup(active_instance, "xrReleaseSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
if (release_wait_active()) eye_wait_for_gpu();
|
||||
XrResult result = fn(swapchain, info);
|
||||
if (eye_debug) {
|
||||
|
||||
@@ -47,7 +47,6 @@ typedef struct {
|
||||
VkImage images[MAX_IMAGES];
|
||||
uint32_t image_count;
|
||||
uint32_t last_acquired;
|
||||
uint32_t acquired[MAX_IMAGES], acquired_count, waited_count;
|
||||
XrSwapchain shadow;
|
||||
XrRect2Di shadow_rect;
|
||||
VkImage shadow_images[MAX_IMAGES];
|
||||
@@ -106,10 +105,7 @@ static void flip_on_enumerate_images(XrSwapchain handle, uint32_t count, const X
|
||||
static void flip_on_acquire(XrSwapchain handle, uint32_t index) {
|
||||
pthread_mutex_lock(&flip_lock);
|
||||
tracked_swapchain *t = find_tracked(handle, 0);
|
||||
if (t) {
|
||||
t->last_acquired = index;
|
||||
if(t->acquired_count<MAX_IMAGES)t->acquired[t->acquired_count++]=index;
|
||||
}
|
||||
if (t) t->last_acquired = index;
|
||||
pthread_mutex_unlock(&flip_lock);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// * drops requested instance extensions the runtime lacks (e.g. XR_FB_passthrough);
|
||||
// * retries rejected swapchains with 1 sample / a supported format (swapchain_fix, overport #71);
|
||||
// * drops composition layers that reference swapchains that failed to create (layer_fix);
|
||||
// * serves cube swapchains the runtime refuses as GL cube maps and drops their layers (cube_standin, cube_standin.c);
|
||||
// * optionally requests mutable-format swapchain images (mutable_fix, off by default);
|
||||
// * optionally swaps left/right images of stereo projection layers (swap_eyes, off by default);
|
||||
// * emulates XR_FB_passthrough with XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND when the runtime lacks it
|
||||
@@ -38,7 +37,6 @@
|
||||
// /sdcard/Android/data/<package>/files/framebridge.conf
|
||||
// $FRAMEBRIDGE_CONFIG
|
||||
#define _GNU_SOURCE
|
||||
#define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#define XR_EXTENSION_PROTOTYPES
|
||||
#include <openxr/openxr.h>
|
||||
#include <android/log.h>
|
||||
@@ -75,7 +73,6 @@ static void fb_log(const char *fmt, ...) {
|
||||
}
|
||||
#define LOG(...) fb_log(__VA_ARGS__)
|
||||
#include "audio_metadata.h"
|
||||
#include "surface_views.h"
|
||||
|
||||
static void *loader;
|
||||
static PFN_xrGetInstanceProcAddr next_gipa;
|
||||
@@ -83,10 +80,8 @@ static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
static XrInstance active_instance = XR_NULL_HANDLE;
|
||||
static void *android_vm; // JavaVM from XrInstanceCreateInfoAndroidKHR (surface_swapchain.c)
|
||||
static int surface_emul = 1; // setting: emulate Android surface swapchains
|
||||
static int surface_native; // internal: GPU shared video buffers (panoramic video clients)
|
||||
static int eye_debug; // setting: per-eye diagnostics + file log (eye_debug.c)
|
||||
static int release_wait; // setting: wait for the app's GPU work before releasing images (2 = after 60 s: A/B)
|
||||
static void surf_scene_destroy(XrSwapchain handle);
|
||||
static void surf_on_destroy(XrSwapchain handle);
|
||||
|
||||
static float scale = 1.0f;
|
||||
@@ -108,11 +103,8 @@ static int frame_open;
|
||||
static int sc_acquires, sc_waits, sc_releases, sc_wait_fails; // per pacing period (layer_debug) // drop XrCompositionLayerColorScaleBiasKHR (the runtime's color pass)
|
||||
static int controller_fix = 1;
|
||||
static int swapchain_fix = 1;
|
||||
static int cube_standin = 1; // cube swapchains the runtime refuses: served by the adapter (cube_standin.c)
|
||||
static int rect_clamp = 1;
|
||||
static int pose_consistency = 0; // repeat xrLocateViews queries for one display time get the same poses (GitHub #8) // clamp submitted image rects to their swapchain (SteamVR rejects a 1 px overrun)
|
||||
static int pose_time_fix; // poses asked for at CLOCK_MONOTONIC "now" or far in the past: at XrTime "now" (pose_time.c)
|
||||
static int pose_debug; // diagnostics: requested pose times vs the predicted display time (pose_time.c)
|
||||
static int layer_fix = 1;
|
||||
static int mutable_fix = 0;
|
||||
static int swap_eyes = 0;
|
||||
@@ -135,8 +127,6 @@ static int controller_models; // serve Frame controller models via XR_FB_render
|
||||
// Per-game settings, all off by default (session_fixes.c, layer_emul_gl.c).
|
||||
static int sync_guard; // xrSyncActions one at a time with xrPollEvent, paused briefly after focus returns
|
||||
static int profile_remap = 1; // Meta's newer controller profiles (rejected by the Frame) -> oculus/touch_controller
|
||||
static int proximity_emul; // finger proximity from capacitive touch: 1 thumb, 2 thumb + index (session_fixes.c)
|
||||
static int runtime_has_proximity; // the runtime has XR_FB_touch_controller_proximity itself
|
||||
static int layer_debug; // diagnostics: layers, swapchains, session states, spaces, aim/grip, refresh rates
|
||||
static int input_diag; // diagnostics: controller profiles, bindings, missing functions, failing input calls
|
||||
static int stable_local; // keep every LOCAL space the app creates on the session-start origin
|
||||
@@ -147,7 +137,7 @@ static float aim_pitch, aim_yaw, aim_forward; // aim pose correction (degrees,
|
||||
static float refresh_rate; // requested display refresh rate (Hz), 0 = the app's choice
|
||||
static int equirect_emul; // show 360 layers as cube faces (GLES)
|
||||
static int equirect_face = 1536; // max cube map face size (px)
|
||||
static int equirect_res = 1536, equirect_res_set; // projection image size per eye (px)
|
||||
static int equirect_res = 1536; // projection image size per eye (px)
|
||||
static int equirect_flip; // source orientation fix: 1 upside down, 2 mirrored, 4 turned 180 degrees
|
||||
static float equirect_fps = 60; // max redraws per second per 360 layer (0 = no limit)
|
||||
static int equirect_stereo; // 0 auto (mono if the layer limit can't hold both eyes), 1 stereo, 2 mono
|
||||
@@ -168,11 +158,8 @@ static void read_settings(const char *path) {
|
||||
if (sscanf(line, "snapshot=%f", &value) == 1) snapshot = value > 0 ? (int)value : 0;
|
||||
if (sscanf(line, "controller_fix=%f", &value) == 1) controller_fix = value != 0;
|
||||
if (sscanf(line, "swapchain_fix=%f", &value) == 1) swapchain_fix = value != 0;
|
||||
if (sscanf(line, "cube_standin=%f", &value) == 1) cube_standin = value != 0;
|
||||
if (sscanf(line, "rect_clamp=%f", &value) == 1) rect_clamp = value != 0;
|
||||
if (sscanf(line, "pose_consistency=%f", &value) == 1) pose_consistency = value != 0;
|
||||
if (sscanf(line, "pose_debug=%f", &value) == 1) pose_debug = value != 0;
|
||||
if (sscanf(line, "pose_time_fix=%f", &value) == 1) pose_time_fix = value != 0;
|
||||
if (sscanf(line, "layer_fix=%f", &value) == 1) layer_fix = value != 0;
|
||||
if (sscanf(line, "mutable_fix=%f", &value) == 1) mutable_fix = value != 0;
|
||||
if (sscanf(line, "swap_eyes=%f", &value) == 1) swap_eyes = value != 0;
|
||||
@@ -190,11 +177,9 @@ static void read_settings(const char *path) {
|
||||
if (sscanf(line, "layer_debug=%f", &value) == 1) layer_debug = value != 0;
|
||||
if (sscanf(line, "input_diag=%f", &value) == 1) input_diag = value != 0;
|
||||
if (sscanf(line, "surface_emul=%f", &value) == 1) surface_emul = value != 0;
|
||||
if (sscanf(line, "surface_native=%f", &value) == 1) surface_native = value != 0;
|
||||
if (sscanf(line, "eye_debug=%f", &value) == 1) eye_debug = value != 0;
|
||||
if (sscanf(line, "release_wait=%f", &value) == 1) release_wait = (int)value;
|
||||
if (sscanf(line, "profile_remap=%f", &value) == 1) profile_remap = value != 0;
|
||||
if (sscanf(line, "proximity_emul=%f", &value) == 1 && value >= 0 && value <= 2) proximity_emul = (int)value;
|
||||
if (sscanf(line, "sync_guard=%f", &value) == 1) sync_guard = value != 0;
|
||||
if (sscanf(line, "stable_local=%f", &value) == 1) stable_local = value != 0;
|
||||
if (sscanf(line, "focus_hold=%f", &value) == 1) focus_hold = value != 0;
|
||||
@@ -206,7 +191,7 @@ static void read_settings(const char *path) {
|
||||
if (sscanf(line, "refresh_rate=%f", &value) == 1 && (value == 0 || (value >= 60 && value <= 144))) refresh_rate = value;
|
||||
if (sscanf(line, "equirect_emul=%f", &value) == 1) equirect_emul = value != 0;
|
||||
if (sscanf(line, "equirect_face=%f", &value) == 1 && value >= 256 && value <= 2730) equirect_face = (int)value;
|
||||
if (sscanf(line, "equirect_res=%f", &value) == 1 && value >= 512 && value <= 4096) {equirect_res = (int)value;equirect_res_set=1;}
|
||||
if (sscanf(line, "equirect_res=%f", &value) == 1 && value >= 512 && value <= 4096) equirect_res = (int)value;
|
||||
if (sscanf(line, "equirect_flip=%f", &value) == 1 && value >= 0 && value <= 7) equirect_flip = (int)value;
|
||||
if (sscanf(line, "equirect_fps=%f", &value) == 1 && value >= 0 && value <= 144) equirect_fps = value;
|
||||
if (sscanf(line, "equirect_stereo=%f", &value) == 1 && value >= 0 && value <= 2) equirect_stereo = (int)value;
|
||||
@@ -255,8 +240,6 @@ static void initialize(void) {
|
||||
log_file = fopen(path, "a");
|
||||
}
|
||||
if (input_diag) LOG("per-game: input_diag=1 (controller-input diagnostics)");
|
||||
if (proximity_emul) LOG("per-game: proximity_emul=%d (finger proximity from capacitive touch: %s)", proximity_emul,
|
||||
proximity_emul > 1 ? "thumb + index" : "thumb");
|
||||
if (hide_space_warp) LOG("per-game: hide_space_warp=1 (XR_FB_space_warp hidden, space warp info removed)");
|
||||
if (strip_color_bias) LOG("per-game: strip_color_bias=%d (layer color scale/bias removed)", strip_color_bias);
|
||||
if (frame_balance) LOG("per-game: frame_balance=1 (an open frame is ended before the next one begins)");
|
||||
@@ -376,7 +359,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrCreateInstance(const XrInstanceCreateInfo *info
|
||||
}
|
||||
for (uint32_t j = 0; available && j < available_count; ++j)
|
||||
if (!strcmp(available[j].extensionName, "XR_FB_composition_layer_image_layout")) runtime_has_image_layout = 1;
|
||||
else if (!strcmp(available[j].extensionName, "XR_FB_touch_controller_proximity")) runtime_has_proximity = 1;
|
||||
// Layer types are only valid if their extension ends up enabled; some apps submit them regardless.
|
||||
int has_equirect = 0, has_equirect2 = 0, has_cylinder = 0, has_cube = 0;
|
||||
for (uint32_t i = 0; i < kept; ++i) {
|
||||
@@ -517,10 +499,6 @@ static int emul_is_virtual(XrSwapchain handle);
|
||||
static void emul_virtual_destroy(XrSwapchain handle);
|
||||
static XrResult emul_virtual_enumerate(XrSwapchain handle, uint32_t capacity, uint32_t *count, XrSwapchainImageBaseHeader *images);
|
||||
static void emul_on_acquire(XrSwapchain handle, uint32_t index);
|
||||
static XrResult standin_after_failure(const XrSwapchainCreateInfo *info, XrSwapchain *out, XrResult result);
|
||||
static int is_standin(XrSwapchain handle);
|
||||
static void standin_destroy(XrSwapchain handle);
|
||||
static XrResult standin_enumerate(XrSwapchain handle, uint32_t capacity, uint32_t *count, XrSwapchainImageBaseHeader *images);
|
||||
|
||||
static int known_swapchain(XrSwapchain handle) {
|
||||
int found = 0;
|
||||
@@ -543,11 +521,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchain(XrSession session, const XrSwap
|
||||
fixed.next = p;
|
||||
}
|
||||
if (mutable_fix) fixed.usageFlags |= XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT;
|
||||
// Internal native-video composition snapshots the owned stereo scene before
|
||||
// release. Other games and UI/depth/MSAA swapchains keep their original usage.
|
||||
if(surface_native && fixed.arraySize==2 && fixed.sampleCount==1 &&
|
||||
(fixed.usageFlags&XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT))
|
||||
fixed.usageFlags |= XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT;
|
||||
if (equirect_emul && swapchain && emul_virtual_create(session, &fixed, swapchain)) {
|
||||
remember_swapchain(*swapchain);
|
||||
emul_on_create_swapchain(*swapchain, &fixed);
|
||||
@@ -566,7 +539,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchain(XrSession session, const XrSwap
|
||||
snap_on_create(*swapchain, &fixed);
|
||||
return result;
|
||||
}
|
||||
if (!swapchain_fix) return standin_after_failure(&fixed, swapchain, result);
|
||||
if (!swapchain_fix) return result;
|
||||
|
||||
// Frame's runtime rejects some GLES formats (GL_RGBA8) and MSAA swapchains (overport #71).
|
||||
if (fixed.sampleCount > 1) {
|
||||
@@ -589,7 +562,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchain(XrSession session, const XrSwap
|
||||
emul_on_create_swapchain(*swapchain, &fixed);
|
||||
snap_on_create(*swapchain, &fixed);
|
||||
}
|
||||
return standin_after_failure(&fixed, swapchain, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrDestroySwapchain(XrSwapchain swapchain) {
|
||||
@@ -599,8 +572,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrDestroySwapchain(XrSwapchain swapchain) {
|
||||
static int logged;
|
||||
if (logged++ < 200) LOG("layer_debug: xrDestroySwapchain %p", (void *)swapchain);
|
||||
}
|
||||
if (is_standin(swapchain)) { standin_destroy(swapchain); return XR_SUCCESS; }
|
||||
surf_scene_destroy(swapchain);
|
||||
forget_swapchain(swapchain);
|
||||
surf_on_destroy(swapchain);
|
||||
flip_on_destroy(swapchain);
|
||||
@@ -782,7 +753,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetSystemProperties(XrInstance instance, XrSyst
|
||||
}
|
||||
|
||||
#include "flip_vk.c"
|
||||
#include "pose_time.c"
|
||||
|
||||
// XR_KHR_convert_timespec_time for runtimes that lack it (Frame): XrTime is derived from the monotonic clock
|
||||
// using the offset measured at the last xrWaitFrame. The runtime's own implementation is preferred.
|
||||
@@ -792,14 +762,10 @@ static PFN_xrConvertTimeToTimespecTimeKHR runtime_time_to_timespec;
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL emu_timespec_to_time(XrInstance instance, const struct timespec *ts, XrTime *time) {
|
||||
if (runtime_timespec_to_time) {
|
||||
XrResult r = runtime_timespec_to_time(instance, ts, time);
|
||||
if (r != XR_ERROR_FUNCTION_UNSUPPORTED) {
|
||||
if (XR_SUCCEEDED(r) && time) pose_time_note("xrConvertTimespecTimeToTimeKHR (runtime)", 0, 0, *time);
|
||||
return r;
|
||||
}
|
||||
if (r != XR_ERROR_FUNCTION_UNSUPPORTED) return r;
|
||||
}
|
||||
if (!ts || !time) return XR_ERROR_VALIDATION_FAILURE;
|
||||
*time = (XrTime)((int64_t)ts->tv_sec * 1000000000ll + ts->tv_nsec + (xr_time_calibrated ? xr_time_offset : 0));
|
||||
pose_time_note("xrConvertTimespecTimeToTimeKHR", 0, 0, *time);
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL emu_time_to_timespec(XrInstance instance, XrTime time, struct timespec *ts) {
|
||||
@@ -815,8 +781,6 @@ static XRAPI_ATTR XrResult XRAPI_CALL emu_time_to_timespec(XrInstance instance,
|
||||
}
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrLocateSpace(XrSpace space, XrSpace baseSpace, XrTime time, XrSpaceLocation *location) {
|
||||
time = pose_time_fixed(time);
|
||||
pose_time_note("xrLocateSpace", (uint64_t)(uintptr_t)space, (uint64_t)(uintptr_t)baseSpace, time);
|
||||
if (emulate_scene && location) {
|
||||
XrPosef pose; XrSpaceLocationFlags flags;
|
||||
if (locate_fake(space, baseSpace, time, &pose, &flags)) {
|
||||
@@ -832,14 +796,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrLocateSpace(XrSpace space, XrSpace baseSpace, X
|
||||
static XrResult locate_spaces_common(const char *name, XrSession session, const XrSpacesLocateInfo *info,
|
||||
XrSpaceLocations *locations) {
|
||||
int any_fake = 0;
|
||||
XrSpacesLocateInfo moved;
|
||||
if (info && pose_time_fix) {
|
||||
moved = *info;
|
||||
moved.time = pose_time_fixed(info->time);
|
||||
info = &moved;
|
||||
}
|
||||
if (info) pose_time_note(name, info->spaceCount ? (uint64_t)(uintptr_t)info->spaces[0] : 0,
|
||||
(uint64_t)(uintptr_t)info->baseSpace, info->time);
|
||||
if (emulate_scene && info && locations) {
|
||||
any_fake = fake_space_index(info->baseSpace) >= 0;
|
||||
for (uint32_t i = 0; i < info->spaceCount && !any_fake; ++i) any_fake = fake_space_index(info->spaces[i]) >= 0;
|
||||
@@ -873,108 +829,8 @@ XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpace(XrSpace space) {
|
||||
#include "input_diag.c"
|
||||
#include "session_fixes.c"
|
||||
#include "layer_emul_gl.c"
|
||||
#include "cube_standin.c"
|
||||
#include "snapshot_gl.c"
|
||||
#include "surface_swapchain.c"
|
||||
|
||||
// GPU video buffers need explicit external-memory support on the app's device.
|
||||
// Preserve the runtime's extension list and both Vulkan-enable entry points.
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanInstanceKHR(XrInstance instance,const XrVulkanInstanceCreateInfoKHR *info,
|
||||
VkInstance *created,VkResult *vulkanResult) {
|
||||
PFN_xrCreateVulkanInstanceKHR fn=(PFN_xrCreateVulkanInstanceKHR)lookup(instance,"xrCreateVulkanInstanceKHR");
|
||||
if(!fn)return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if(!surface_native)return fn(instance,info,created,vulkanResult);
|
||||
XrResult result=fn(instance,info,created,vulkanResult);
|
||||
if(XR_SUCCEEDED(result) && created && vulkanResult && *vulkanResult==VK_SUCCESS)vk.instance=*created;
|
||||
return result;
|
||||
}
|
||||
static const char *surf_device_exts[] = {"VK_ANDROID_external_memory_android_hardware_buffer",
|
||||
"VK_KHR_external_memory", "VK_KHR_get_memory_requirements2", "VK_KHR_dedicated_allocation",
|
||||
"VK_EXT_queue_family_foreign", "VK_KHR_sampler_ycbcr_conversion", "VK_KHR_bind_memory2", "VK_KHR_maintenance1"};
|
||||
static int surf_extension_present(const char *text,const char *name) {
|
||||
size_t length=strlen(name);
|
||||
for(const char *p=text;(p=strstr(p,name));p++)
|
||||
if((p==text || p[-1]==' ') && (p[length]==' ' || p[length]=='\0'))return 1;
|
||||
return 0;
|
||||
}
|
||||
static int surf_device_supported(PFN_vkGetInstanceProcAddr gipa, VkInstance instance, VkPhysicalDevice physical) {
|
||||
if (!surface_native || !gipa) return 0;
|
||||
if(!physical){
|
||||
// Unity can ask for extension strings before it creates its instance.
|
||||
// Query a temporary instance instead of depending on that call order.
|
||||
PFN_vkCreateInstance create=(PFN_vkCreateInstance)gipa(VK_NULL_HANDLE,"vkCreateInstance");
|
||||
VkApplicationInfo app={VK_STRUCTURE_TYPE_APPLICATION_INFO,NULL,"FrameBridge video capabilities",0,NULL,0,VK_API_VERSION_1_1};
|
||||
VkInstanceCreateInfo ci={VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,NULL,0,&app};
|
||||
VkInstance probe=VK_NULL_HANDLE;if(!create || create(&ci,NULL,&probe)!=VK_SUCCESS)return 0;
|
||||
PFN_vkEnumeratePhysicalDevices devices=(PFN_vkEnumeratePhysicalDevices)gipa(probe,"vkEnumeratePhysicalDevices");
|
||||
PFN_vkDestroyInstance destroy=(PFN_vkDestroyInstance)gipa(probe,"vkDestroyInstance");
|
||||
uint32_t count=0;VkPhysicalDevice gpu=VK_NULL_HANDLE;
|
||||
int ok=devices && devices(probe,&count,NULL)==VK_SUCCESS && count==1 &&
|
||||
devices(probe,&count,&gpu)==VK_SUCCESS && surf_device_supported(gipa,probe,gpu);
|
||||
if(destroy)destroy(probe,NULL);return ok;
|
||||
}
|
||||
PFN_vkEnumerateDeviceExtensionProperties enumerate=(PFN_vkEnumerateDeviceExtensionProperties)
|
||||
gipa(instance,"vkEnumerateDeviceExtensionProperties");
|
||||
uint32_t count=0;
|
||||
if(!enumerate || enumerate(physical,NULL,&count,NULL)!=VK_SUCCESS || count>2048)return 0;
|
||||
VkExtensionProperties *exts=calloc(count,sizeof(*exts));
|
||||
if(!exts)return 0;
|
||||
int ok=enumerate(physical,NULL,&count,exts)==VK_SUCCESS;
|
||||
for(unsigned j=0;j<sizeof(surf_device_exts)/sizeof(*surf_device_exts);j++){
|
||||
int found=0;for(uint32_t i=0;i<count;i++)found|=!strcmp(exts[i].extensionName,surf_device_exts[j]);
|
||||
ok &= found;
|
||||
}
|
||||
free(exts);return ok;
|
||||
}
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsDeviceKHR(XrInstance instance,XrSystemId system,
|
||||
VkInstance vulkanInstance,VkPhysicalDevice *physical) {
|
||||
PFN_xrGetVulkanGraphicsDeviceKHR fn=(PFN_xrGetVulkanGraphicsDeviceKHR)lookup(instance,"xrGetVulkanGraphicsDeviceKHR");
|
||||
if(!surface_native)return fn?fn(instance,system,vulkanInstance,physical):XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
XrResult result=fn?fn(instance,system,vulkanInstance,physical):XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if(XR_SUCCEEDED(result) && physical){vk.instance=vulkanInstance;vk.physical=*physical;}
|
||||
return result;
|
||||
}
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanDeviceExtensionsKHR(XrInstance instance,XrSystemId system,
|
||||
uint32_t capacity,uint32_t *count,char *buffer) {
|
||||
PFN_xrGetVulkanDeviceExtensionsKHR fn=(PFN_xrGetVulkanDeviceExtensionsKHR)lookup(instance,"xrGetVulkanDeviceExtensionsKHR");
|
||||
if(!fn)return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if(!surface_native)return fn(instance,system,capacity,count,buffer);
|
||||
void *lib=dlopen("libvulkan.so",RTLD_NOW|RTLD_LOCAL);
|
||||
PFN_vkGetInstanceProcAddr gipa=lib?(PFN_vkGetInstanceProcAddr)dlsym(lib,"vkGetInstanceProcAddr"):NULL;
|
||||
if(!surf_device_supported(gipa,vk.instance,vk.physical))return fn(instance,system,capacity,count,buffer);
|
||||
uint32_t original=0;XrResult result=fn(instance,system,0,&original,NULL);
|
||||
if(XR_FAILED(result) || !count || original>65536)return result;
|
||||
char *text=calloc(original+1024,1);if(!text)return XR_ERROR_OUT_OF_MEMORY;
|
||||
result=fn(instance,system,original,&original,text);
|
||||
if(XR_SUCCEEDED(result)){
|
||||
for(unsigned i=0;i<sizeof(surf_device_exts)/sizeof(*surf_device_exts);i++){
|
||||
if(!surf_extension_present(text,surf_device_exts[i])){if(*text)strcat(text," ");strcat(text,surf_device_exts[i]);}
|
||||
}
|
||||
*count=(uint32_t)strlen(text)+1;
|
||||
if(capacity && (capacity<*count || !buffer))result=XR_ERROR_SIZE_INSUFFICIENT;
|
||||
else if(capacity)memcpy(buffer,text,*count);
|
||||
}
|
||||
free(text);return result;
|
||||
}
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanDeviceKHR(XrInstance instance,const XrVulkanDeviceCreateInfoKHR *info,
|
||||
VkDevice *device,VkResult *vulkanResult) {
|
||||
PFN_xrCreateVulkanDeviceKHR fn=(PFN_xrCreateVulkanDeviceKHR)lookup(instance,"xrCreateVulkanDeviceKHR");
|
||||
if(!fn)return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if(!surface_native)return fn(instance,info,device,vulkanResult);
|
||||
if(!info || !info->vulkanCreateInfo || !surf_device_supported(info->pfnGetInstanceProcAddr,
|
||||
vk.instance,info->vulkanPhysicalDevice))return fn(instance,info,device,vulkanResult);
|
||||
VkDeviceCreateInfo ci=*info->vulkanCreateInfo;
|
||||
const char **names=calloc(ci.enabledExtensionCount+8,sizeof(*names));
|
||||
if(!names)return XR_ERROR_OUT_OF_MEMORY;
|
||||
for(uint32_t i=0;i<ci.enabledExtensionCount;i++)names[i]=ci.ppEnabledExtensionNames[i];
|
||||
for(unsigned j=0;j<8;j++){
|
||||
int found=0;for(uint32_t i=0;i<ci.enabledExtensionCount;i++)found|=!strcmp(names[i],surf_device_exts[j]);
|
||||
if(!found)names[ci.enabledExtensionCount++]=surf_device_exts[j];
|
||||
}
|
||||
ci.ppEnabledExtensionNames=names;
|
||||
XrVulkanDeviceCreateInfoKHR fixed=*info;fixed.vulkanCreateInfo=&ci;
|
||||
XrResult result=fn(instance,&fixed,device,vulkanResult);free(names);return result;
|
||||
}
|
||||
#include "eye_debug.c"
|
||||
|
||||
// OpenXR requires xrGet*GraphicsRequirementsKHR before xrCreateSession; Meta's runtime doesn't enforce it, the Frame's
|
||||
@@ -1082,7 +938,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateSwapchainImages(XrSwapchain swapchain,
|
||||
XrSwapchainImageBaseHeader *images) {
|
||||
PFN_xrEnumerateSwapchainImages fn = (PFN_xrEnumerateSwapchainImages)lookup(active_instance, "xrEnumerateSwapchainImages");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return standin_enumerate(swapchain, capacity, count, images);
|
||||
XrResult result = equirect_emul && emul_is_virtual(swapchain) ? emul_virtual_enumerate(swapchain, capacity, count, images)
|
||||
: fn(swapchain, capacity, count, images);
|
||||
if (XR_SUCCEEDED(result) && images && capacity && count) {
|
||||
@@ -1097,7 +952,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateSwapchainImages(XrSwapchain swapchain,
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrWaitSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageWaitInfo *info) {
|
||||
PFN_xrWaitSwapchainImage fn = (PFN_xrWaitSwapchainImage)lookup(active_instance, "xrWaitSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
XrResult result = fn(swapchain, info);
|
||||
__atomic_add_fetch(&sc_waits, 1, __ATOMIC_RELAXED);
|
||||
if (result != XR_SUCCESS) __atomic_add_fetch(&sc_wait_fails, 1, __ATOMIC_RELAXED);
|
||||
@@ -1107,7 +961,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrWaitSwapchainImage(XrSwapchain swapchain, const
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrReleaseSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageReleaseInfo *info) {
|
||||
PFN_xrReleaseSwapchainImage fn = (PFN_xrReleaseSwapchainImage)lookup(active_instance, "xrReleaseSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
__atomic_add_fetch(&sc_releases, 1, __ATOMIC_RELAXED);
|
||||
return fn(swapchain, info);
|
||||
}
|
||||
@@ -1116,11 +969,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrAcquireSwapchainImage(XrSwapchain swapchain, co
|
||||
uint32_t *index) {
|
||||
PFN_xrAcquireSwapchainImage fn = (PFN_xrAcquireSwapchainImage)lookup(active_instance, "xrAcquireSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) { // adapter-served cube stand-in: one image
|
||||
if (!index) return XR_ERROR_VALIDATION_FAILURE;
|
||||
*index = 0;
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
if (equirect_emul && emul_is_virtual(swapchain)) { // adapter-served write-once picture: one image
|
||||
if (!index) return XR_ERROR_VALIDATION_FAILURE;
|
||||
*index = 0;
|
||||
@@ -1137,37 +985,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrAcquireSwapchainImage(XrSwapchain swapchain, co
|
||||
return result;
|
||||
}
|
||||
|
||||
// Copy scene content only while the oldest acquired image is successfully waited
|
||||
// and still application-owned. Release itself is forwarded immediately.
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL surf_composite_release(XrSwapchain handle,const XrSwapchainImageReleaseInfo *info) {
|
||||
pthread_mutex_lock(&flip_lock);
|
||||
tracked_swapchain *t=find_tracked(handle,0);
|
||||
if(t && t->acquired_count && t->waited_count)surf_scene_capture(t,t->acquired[0]);
|
||||
pthread_mutex_unlock(&flip_lock);
|
||||
XrResult result=equirect_emul?hook_xrReleaseSwapchainImage(handle,info):
|
||||
((PFN_xrReleaseSwapchainImage)lookup(active_instance,"xrReleaseSwapchainImage"))(handle,info);
|
||||
if(XR_SUCCEEDED(result)) {
|
||||
surf_scene_release_commit(handle);
|
||||
pthread_mutex_lock(&flip_lock);t=find_tracked(handle,0);
|
||||
if(t && t->acquired_count) {
|
||||
memmove(t->acquired,t->acquired+1,(--t->acquired_count)*sizeof(t->acquired[0]));
|
||||
if(t->waited_count)t->waited_count--;
|
||||
}
|
||||
pthread_mutex_unlock(&flip_lock);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL surf_composite_wait(XrSwapchain handle,const XrSwapchainImageWaitInfo *info) {
|
||||
XrResult result=equirect_emul?hook_xrWaitSwapchainImage(handle,info):
|
||||
((PFN_xrWaitSwapchainImage)lookup(active_instance,"xrWaitSwapchainImage"))(handle,info);
|
||||
if(result==XR_SUCCESS) {
|
||||
pthread_mutex_lock(&flip_lock);tracked_swapchain *t=find_tracked(handle,0);
|
||||
if(t && t->waited_count<t->acquired_count)t->waited_count++;
|
||||
pthread_mutex_unlock(&flip_lock);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- tracking diagnostics
|
||||
static XrSpace view_space_handle = XR_NULL_HANDLE;
|
||||
|
||||
@@ -1188,9 +1005,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrPollEvent(XrInstance instance, XrEventDataBuffe
|
||||
if (got) return XR_SUCCESS;
|
||||
}
|
||||
if (sync_guard) pthread_mutex_lock(&sync_lock);
|
||||
focus_log_next = fn; // the runtime's own focus changes are logged, before focus_hold hides any
|
||||
XrResult result = focus_hold && event ? focus_hold_poll(focus_log_poll, instance, event)
|
||||
: focus_log_poll(instance, event);
|
||||
XrResult result = focus_hold && event ? focus_hold_poll(fn, instance, event) : fn(instance, event);
|
||||
if (sync_guard) {
|
||||
if (result == XR_SUCCESS && event && session_state_of(event) == XR_SESSION_STATE_FOCUSED)
|
||||
sync_resume_at = monotonic_ns() + SYNC_GUARD_PAUSE_NS;
|
||||
@@ -1264,10 +1079,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrWaitFrame(XrSession session, const XrFrameWaitI
|
||||
// predictedDisplayTime is about one display period ahead of "now".
|
||||
xr_time_offset = (int64_t)(state->predictedDisplayTime - state->predictedDisplayPeriod) - mono;
|
||||
xr_time_calibrated = 1;
|
||||
last_display_period = state->predictedDisplayPeriod;
|
||||
pose_time_sample(xr_time_offset);
|
||||
pose_time_display(state->predictedDisplayTime);
|
||||
pose_time_note_offset((long long)(state->predictedDisplayTime - mono));
|
||||
if (layer_debug) debug_aim_vs_grip(state->predictedDisplayTime);
|
||||
}
|
||||
return result;
|
||||
@@ -1332,19 +1143,10 @@ XRAPI_ATTR XrResult XRAPI_CALL xrLocateViews(XrSession session, const XrViewLoca
|
||||
uint32_t capacity, uint32_t *count, XrView *views) {
|
||||
PFN_xrLocateViews fn = (PFN_xrLocateViews)lookup(active_instance, "xrLocateViews");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
XrViewLocateInfo moved;
|
||||
if (info && pose_time_fix) {
|
||||
moved = *info;
|
||||
moved.displayTime = pose_time_fixed(info->displayTime);
|
||||
info = &moved;
|
||||
}
|
||||
if (info) pose_time_note("xrLocateViews", (uint64_t)(uintptr_t)info->space, 0, info->displayTime);
|
||||
int cacheable = pose_consistency && info && state && count && views && capacity > 0;
|
||||
if (cacheable && pose_cache_lookup(session, info, state, capacity, count, views)) return XR_SUCCESS;
|
||||
XrResult result = fn(session, info, state, capacity, count, views);
|
||||
if (cacheable && result == XR_SUCCESS) pose_cache_store(session, info, state, *count, views);
|
||||
if(surface_native && surface_emul && XR_SUCCEEDED(result) && count)
|
||||
surf_views_record(session,info,state,*count<capacity?*count:capacity,views);
|
||||
if (equirect_emul && XR_SUCCEEDED(result) && info && count && views && state &&
|
||||
(state->viewStateFlags & XR_VIEW_STATE_ORIENTATION_VALID_BIT))
|
||||
emul_on_locate_views(info->space, info->displayTime, *count < capacity ? *count : capacity, views);
|
||||
@@ -1421,7 +1223,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
|
||||
frame_open = 0;
|
||||
__atomic_add_fetch(&frame_ends, 1, __ATOMIC_RELAXED);
|
||||
snap_end_frame(info);
|
||||
if(surface_native)++sc_serial;
|
||||
if (eye_debug) eye_debug_end_frame(session, info);
|
||||
{ // frame pacing statistics every ~5 s: fps and submitted-vs-predicted display time
|
||||
static struct timespec start;
|
||||
@@ -1456,7 +1257,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
|
||||
__atomic_exchange_n(&input_sync_ok, 0, __ATOMIC_RELAXED), input_last_sync_result,
|
||||
__atomic_exchange_n(&input_bool_reads, 0, __ATOMIC_RELAXED),
|
||||
__atomic_exchange_n(&input_bool_true, 0, __ATOMIC_RELAXED));
|
||||
pose_time_report();
|
||||
frames = 0; drift_sum = drift_max = 0;
|
||||
}
|
||||
}
|
||||
@@ -1500,38 +1300,9 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
|
||||
XrCompositionLayerProjectionView views[64][2];
|
||||
XrCompositionLayerQuad quads[64];
|
||||
uint32_t count = 0, dropped = 0, swapped = 0, passthrough = 0;
|
||||
const XrCompositionLayerBaseHeader *surface_projections[SURF_MAX];
|
||||
int surface_projection_count = 0;
|
||||
for (uint32_t i = 0; i < info->layerCount; ++i) {
|
||||
const XrCompositionLayerBaseHeader *layer = info->layers[i];
|
||||
if (!layer) { ++dropped; continue; }
|
||||
if (emul_is_equirect(layer)) {
|
||||
const XrCompositionLayerBaseHeader *replacement = surface_native ? surf_projection_frame(session, info, layer) : NULL;
|
||||
if (replacement) {
|
||||
int already = 0;
|
||||
for (int k = 0; k < surface_projection_count; ++k) already |= surface_projections[k] == replacement;
|
||||
if (!already && surface_projection_count < SURF_MAX) {
|
||||
surface_projections[surface_projection_count++] = replacement;
|
||||
// An opaque native hemisphere covering the guarded stereo
|
||||
// view hides every earlier layer. Cull only that hidden
|
||||
// prefix: video becomes the primary projection, while
|
||||
// later subtitles/menus keep their original order. Fades
|
||||
// and uncovered views use the ordinary layered path.
|
||||
const XrCompositionLayerBaseHeader *combined=NULL;
|
||||
if(surface_native && count==1 && kept[0]->type==XR_TYPE_COMPOSITION_LAYER_PROJECTION && surf_composite_candidate(info,layer))
|
||||
combined=surf_composite_frame(session,info,(const void*)kept[0],replacement);
|
||||
if(combined) {kept[0]=combined;++swapped;}
|
||||
else if (surf_projection_occludes(replacement)) {
|
||||
dropped += count;
|
||||
count = 0;
|
||||
passthrough = 0;
|
||||
}
|
||||
if(!combined)kept[count++] = replacement;
|
||||
}
|
||||
++swapped;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (emulate_passthrough && layer->type == XR_TYPE_COMPOSITION_LAYER_PASSTHROUGH_FB) {
|
||||
++passthrough; // replaced by the runtime's camera environment below
|
||||
continue;
|
||||
@@ -1577,12 +1348,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
|
||||
++dropped; // an emulated video surface without a frame yet
|
||||
continue;
|
||||
}
|
||||
if (layer_uses_standin(layer)) { // a cube layer whose swapchain the runtime refused (cube_standin.c)
|
||||
static int logged;
|
||||
if (logged++ < 3) LOG("cube_standin: dropped a layer (type=%d) that shows a stand-in swapchain", layer->type);
|
||||
++dropped;
|
||||
continue;
|
||||
}
|
||||
if (!layer || (layer_fix && !layer_usable(layer))) { ++dropped; continue; }
|
||||
if (layer->type == XR_TYPE_COMPOSITION_LAYER_QUAD) {
|
||||
const XrCompositionLayerQuad *flipped = flip_quad(session, (const XrCompositionLayerQuad *)layer, &quads[count]);
|
||||
@@ -1913,14 +1678,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateApiLayerProperties(uint32_t capacity,
|
||||
// For native/xrshim: emulated functions that overport's dispatcher doesn't know (it never asks us for them).
|
||||
__attribute__((visibility("default"))) PFN_xrVoidFunction framebridge_extension_proc(const char *name) {
|
||||
pthread_once(&init_once, initialize);
|
||||
if(surface_native && name){
|
||||
#define NATIVE_PROC(fn) if(!strcmp(name,#fn))return (PFN_xrVoidFunction)fn;
|
||||
NATIVE_PROC(xrGetVulkanGraphicsDeviceKHR)
|
||||
NATIVE_PROC(xrGetVulkanDeviceExtensionsKHR)
|
||||
NATIVE_PROC(xrCreateVulkanDeviceKHR)
|
||||
NATIVE_PROC(xrCreateVulkanInstanceKHR)
|
||||
#undef NATIVE_PROC
|
||||
}
|
||||
return name ? render_model_emulation(name) : NULL;
|
||||
}
|
||||
|
||||
@@ -1970,14 +1727,6 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr(XrInstance instance, const
|
||||
HOOK(xrEnumerateInstanceExtensionProperties)
|
||||
// Per-game hooks: only installed when their setting is on, so other games run through exactly the same calls.
|
||||
#define HOOK_AS(fn, impl) if (!strcmp(name, #fn)) { *function = (PFN_xrVoidFunction)impl; return XR_SUCCESS; }
|
||||
if (surface_native) {
|
||||
HOOK(xrGetVulkanGraphicsDeviceKHR)
|
||||
HOOK(xrGetVulkanDeviceExtensionsKHR)
|
||||
HOOK(xrCreateVulkanDeviceKHR)
|
||||
HOOK(xrCreateVulkanInstanceKHR)
|
||||
HOOK_AS(xrReleaseSwapchainImage, surf_composite_release)
|
||||
HOOK_AS(xrWaitSwapchainImage, surf_composite_wait)
|
||||
}
|
||||
if (equirect_emul) {
|
||||
HOOK_AS(xrReleaseSwapchainImage, hook_xrReleaseSwapchainImage)
|
||||
HOOK_AS(xrWaitSwapchainImage, hook_xrWaitSwapchainImage)
|
||||
@@ -1989,27 +1738,14 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr(XrInstance instance, const
|
||||
}
|
||||
if (surface_emul) HOOK_AS(xrCreateSwapchainAndroidSurfaceKHR, hook_xrCreateSwapchainAndroidSurfaceKHR)
|
||||
if (eye_debug || release_wait) HOOK_AS(xrReleaseSwapchainImage, eye_hook_xrReleaseSwapchainImage)
|
||||
if (layer_debug || cube_standin) { // counters + cube stand-ins; every other wait/release hook above takes precedence
|
||||
if (layer_debug) { // counters only; every other wait/release hook above takes precedence
|
||||
HOOK(xrWaitSwapchainImage)
|
||||
HOOK(xrReleaseSwapchainImage)
|
||||
}
|
||||
if (cube_standin && (!strcmp(name, "xrUpdateSwapchainFB") || !strcmp(name, "xrGetSwapchainStateFB"))) {
|
||||
XrResult result = next_gipa(instance, name, function); // only wrapped where the runtime has it
|
||||
if (XR_FAILED(result) || !*function) return result;
|
||||
if (!strcmp(name, "xrUpdateSwapchainFB")) {
|
||||
real_update_swapchain = (PFN_xrUpdateSwapchainFB)*function;
|
||||
*function = (PFN_xrVoidFunction)standin_update_swapchain;
|
||||
} else {
|
||||
real_get_swapchain_state = (PFN_xrGetSwapchainStateFB)*function;
|
||||
*function = (PFN_xrVoidFunction)standin_get_swapchain_state;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (sync_guard || layer_debug || input_diag) HOOK_AS(xrSyncActions, hook_xrSyncActions)
|
||||
if (layer_debug) HOOK_AS(xrGetActionStateBoolean, hook_xrGetActionStateBoolean)
|
||||
if (layer_debug || aim_correction_on() || profile_remap || input_diag || proximity_emul)
|
||||
if (layer_debug || aim_correction_on() || profile_remap || input_diag)
|
||||
HOOK_AS(xrSuggestInteractionProfileBindings, hook_xrSuggestInteractionProfileBindings)
|
||||
if (proximity_emul) HOOK_AS(xrCreateAction, hook_xrCreateAction)
|
||||
if (layer_debug || aim_correction_on()) {
|
||||
HOOK_AS(xrCreateActionSpace, hook_xrCreateActionSpace)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct { XrStructureType type; void *next; uint32_t image; } emul_gles_i
|
||||
X(eglChooseConfig) X(eglCreatePbufferSurface) X(eglDestroySurface) X(eglGetCurrentContext) X(eglGetError) \
|
||||
X(eglQueryString)
|
||||
#define EMUL_GL_FUNCS(X) X(glFenceSync) X(glDeleteSync) X(glWaitSync) X(glClientWaitSync) X(glFlush) \
|
||||
X(glGenFramebuffers) X(glDeleteFramebuffers) X(glBindFramebuffer) X(glFramebufferTexture2D) X(glCheckFramebufferStatus) X(glViewport) \
|
||||
X(glGenFramebuffers) X(glBindFramebuffer) X(glFramebufferTexture2D) X(glCheckFramebufferStatus) X(glViewport) \
|
||||
X(glUseProgram) X(glCreateShader) X(glShaderSource) X(glCompileShader) X(glGetShaderiv) X(glGetShaderInfoLog) \
|
||||
X(glDeleteShader) X(glCreateProgram) X(glAttachShader) X(glLinkProgram) X(glGetProgramiv) X(glGetProgramInfoLog) \
|
||||
X(glGetUniformLocation) X(glUniform1i) X(glUniform1f) X(glUniform3f) X(glUniform4f) X(glUniformMatrix3fv) \
|
||||
@@ -304,7 +304,6 @@ static void emul_on_destroy_swapchain(XrSwapchain handle) {
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrReleaseSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageReleaseInfo *info) {
|
||||
PFN_xrReleaseSwapchainImage fn = (PFN_xrReleaseSwapchainImage)lookup(active_instance, "xrReleaseSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
pthread_mutex_lock(&emul_lock);
|
||||
emul_source *s = emul_active() ? emul_find_source(swapchain, 0) : NULL;
|
||||
int index = s && s->acquired_count ? (int)s->acquired[0] : -1;
|
||||
@@ -336,7 +335,6 @@ static XRAPI_ATTR XrResult XRAPI_CALL hook_xrReleaseSwapchainImage(XrSwapchain s
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrWaitSwapchainImage(XrSwapchain swapchain, const XrSwapchainImageWaitInfo *info) {
|
||||
PFN_xrWaitSwapchainImage fn = (PFN_xrWaitSwapchainImage)lookup(active_instance, "xrWaitSwapchainImage");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (is_standin(swapchain)) return XR_SUCCESS;
|
||||
XrResult result = emul_is_virtual(swapchain) ? XR_SUCCESS : fn(swapchain, info);
|
||||
pthread_mutex_lock(&emul_lock);
|
||||
emul_source *s = emul_active() ? emul_find_source(swapchain, 0) : NULL;
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
// Included by frame_adapter.c: the times games locate poses at (pose_time_fix, pose_debug).
|
||||
//
|
||||
// pose_debug (diagnostics): every ~5 s, per located space (xrLocateSpace/xrLocateSpaces) and for xrLocateViews, the
|
||||
// number of calls and the min/max of (requested time - the last xrWaitFrame's predictedDisplayTime); for
|
||||
// xrConvertTimespecTimeToTimeKHR the same for its answers, plus the spread of the XrTime-vs-CLOCK_MONOTONIC offset
|
||||
// measured at xrWaitFrame.
|
||||
|
||||
static XrDuration last_display_period;
|
||||
|
||||
#define PT_SLOTS 12
|
||||
typedef struct {
|
||||
const char *kind;
|
||||
uint64_t space, base;
|
||||
int count;
|
||||
long long min, max; // ns relative to the last predicted display time
|
||||
} pt_stat;
|
||||
static pt_stat pt_stats[PT_SLOTS];
|
||||
static int pt_overflow;
|
||||
static long long pt_offset_min, pt_offset_max;
|
||||
static int pt_offset_count;
|
||||
static pthread_mutex_t pt_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void pose_time_note(const char *kind, uint64_t space, uint64_t base, XrTime time) {
|
||||
if (!pose_debug || !last_predicted_time) return;
|
||||
long long d = (long long)(time - last_predicted_time);
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
int i = 0;
|
||||
while (i < PT_SLOTS && pt_stats[i].count &&
|
||||
!(pt_stats[i].kind == kind && pt_stats[i].space == space && pt_stats[i].base == base))
|
||||
++i;
|
||||
if (i == PT_SLOTS) {
|
||||
++pt_overflow;
|
||||
} else {
|
||||
pt_stat *s = &pt_stats[i];
|
||||
if (!s->count) s->kind = kind, s->space = space, s->base = base, s->min = s->max = d;
|
||||
if (d < s->min) s->min = d;
|
||||
if (d > s->max) s->max = d;
|
||||
++s->count;
|
||||
}
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
|
||||
// The offset sampled at xrWaitFrame dips (by up to 2.5 s) whenever xrWaitFrame returns late after a hitch, which put
|
||||
// corrected times up to 2 s in the future (headless survey, 2026-10-09). The steady value is the largest recent sample:
|
||||
// pose_time_fix uses the maximum of the last PT_RING samples (~2 s at 72 Hz; the offset drifts only ~0.14 s per hour).
|
||||
#define PT_RING 144
|
||||
static int64_t pt_ring[PT_RING];
|
||||
static int pt_ring_n, pt_ring_i;
|
||||
|
||||
static void pose_time_sample(int64_t offset) { // XrTime "now" minus CLOCK_MONOTONIC, from xrWaitFrame
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
pt_ring[pt_ring_i] = offset;
|
||||
pt_ring_i = (pt_ring_i + 1) % PT_RING;
|
||||
if (pt_ring_n < PT_RING) ++pt_ring_n;
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
|
||||
// The last few predicted display times (xrWaitFrame): a pose asked for at one of them is the game rendering a frame
|
||||
// and is never moved. On a Frame whose XrTime runs only ~70 ms ahead of the monotonic clock (GitHub #49), such a
|
||||
// request could look nearer the monotonic "now" than XrTime's and was moved 68 ms into the future.
|
||||
#define PT_DISPLAY_RING 6
|
||||
#define PT_DISPLAY_MATCH 1000000ll // 1 ms
|
||||
static XrTime pt_display[PT_DISPLAY_RING];
|
||||
static int pt_display_i;
|
||||
|
||||
static void pose_time_display(XrTime predicted) { // from xrWaitFrame
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
pt_display[pt_display_i] = predicted;
|
||||
pt_display_i = (pt_display_i + 1) % PT_DISPLAY_RING;
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
|
||||
static int pose_time_is_display(XrTime time) {
|
||||
int found = 0;
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
for (int i = 0; i < PT_DISPLAY_RING && !found; i++) {
|
||||
long long d = (long long)(time - pt_display[i]);
|
||||
found = pt_display[i] && d <= PT_DISPLAY_MATCH && d >= -PT_DISPLAY_MATCH;
|
||||
}
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
return found;
|
||||
}
|
||||
|
||||
static int64_t pose_time_offset(void) {
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
int64_t best = pt_ring_n ? pt_ring[0] : 0;
|
||||
for (int i = 1; i < pt_ring_n; i++)
|
||||
if (pt_ring[i] > best) best = pt_ring[i];
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
return best;
|
||||
}
|
||||
|
||||
static void pose_time_note_offset(long long offset) {
|
||||
if (!pose_debug) return;
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
if (!pt_offset_count || offset < pt_offset_min) pt_offset_min = offset;
|
||||
if (!pt_offset_count || offset > pt_offset_max) pt_offset_max = offset;
|
||||
++pt_offset_count;
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
|
||||
// pose_time_fix: Meta's OVRPlugin takes "now" from CLOCK_MONOTONIC and passes it on as an XrTime unchanged (no
|
||||
// conversion reaches FrameBridge: OVRPort's dispatcher answers XR_KHR_convert_timespec_time itself, 1:1, since the
|
||||
// Frame's runtime lacks it). On a Quest XrTime is the monotonic clock; on the Frame it runs ahead (2.56 s measured on
|
||||
// SteamOS 0.4.5, 0.05-0.9 s seen on older builds), so every "now" pose (Unity's physics step, OVRInput's controller
|
||||
// poses) was located that far in the past and the hands trailed the controllers (BattleSisters, Sniper Elite VR).
|
||||
// A located time nearer the monotonic clock than XrTime's "now" is taken as a monotonic timestamp and moved to the
|
||||
// same moment in XrTime (offset measured at xrWaitFrame); a time more than PT_PAST_LIMIT before the predicted display
|
||||
// time that isn't one (BattleSisters asks for its head at XrTime 0.1 s; Robo Recall, Phantom, Vader, Time Stall and
|
||||
// The Room VR at ~0 every frame) is located at the predicted display time, the time the game renders with.
|
||||
// A monotonic timestamp is only told apart when the clocks are more than PT_MONO_PERIODS display periods apart, and the
|
||||
// time must be clearly nearer the monotonic "now" (at most a third of its distance to XrTime's "now"); a time equal to
|
||||
// a recent predicted display time is never moved (GitHub #49: XrTime only ~68 ms ahead, display-time requests moved).
|
||||
#define PT_PAST_LIMIT 500000000ll // 0.5 s: no runtime keeps a longer pose history; real past queries are far shorter
|
||||
#define PT_MIN_OFFSET 5000000ll // XrTime and the monotonic clock this close: nothing to tell apart or to fix
|
||||
#define PT_MONO_PERIODS 4
|
||||
#define PT_DEFAULT_PERIOD 13888889ll // 72 Hz, before xrWaitFrame reported a period
|
||||
static int pt_fixed_mono, pt_fixed_past;
|
||||
static long long pt_fixed_min;
|
||||
|
||||
static XrTime pose_time_fixed(XrTime time) {
|
||||
if (!pose_time_fix || !last_predicted_time || pt_ring_n < 8) return time; // a few frames of offset samples first
|
||||
int64_t offset = pose_time_offset(); // XrTime "now" minus the monotonic clock (robust, see above)
|
||||
if (offset < PT_MIN_OFFSET && offset > -PT_MIN_OFFSET) return time;
|
||||
if (pose_time_is_display(time)) return time; // the frame (or a recent one) the game renders
|
||||
long long period = last_display_period > 0 ? (long long)last_display_period : PT_DEFAULT_PERIOD;
|
||||
long long abs_offset = offset < 0 ? -offset : offset;
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
long long mono = (long long)ts.tv_sec * 1000000000ll + ts.tv_nsec;
|
||||
long long d_mono = (long long)time - mono, d_xr = (long long)time - (mono + offset);
|
||||
long long abs_mono = d_mono < 0 ? -d_mono : d_mono, abs_xr = d_xr < 0 ? -d_xr : d_xr;
|
||||
XrTime fixed;
|
||||
int kind;
|
||||
if (abs_offset > PT_MONO_PERIODS * period && abs_mono < PT_PAST_LIMIT && 3 * abs_mono < abs_xr) {
|
||||
fixed = (XrTime)(time + offset), kind = 0; // a monotonic timestamp
|
||||
} else if ((long long)(time - last_predicted_time) < -PT_PAST_LIMIT) {
|
||||
fixed = last_predicted_time, kind = 1; // far in the past: the frame's display time
|
||||
} else {
|
||||
return time;
|
||||
}
|
||||
if (pose_debug) {
|
||||
long long d = (long long)(time - last_predicted_time);
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
if (!(pt_fixed_mono + pt_fixed_past) || d < pt_fixed_min) pt_fixed_min = d;
|
||||
++*(kind ? &pt_fixed_past : &pt_fixed_mono);
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
static int logged[2];
|
||||
if (logged[kind]++ < 3)
|
||||
LOG("pose_time_fix: pose asked for at %.1f ms from the predicted display time (%s) located at %.1f ms",
|
||||
(long long)(time - last_predicted_time) / 1e6, kind ? "far in the past" : "a monotonic-clock time",
|
||||
(long long)(fixed - last_predicted_time) / 1e6);
|
||||
return fixed;
|
||||
}
|
||||
|
||||
// called from the pacing statistics in xrEndFrame
|
||||
static void pose_time_report(void) {
|
||||
if (!pose_debug) return;
|
||||
pthread_mutex_lock(&pt_lock);
|
||||
LOG("pose_debug: period %.2f ms; XrTime - monotonic at xrWaitFrame (%d): %.2f..%.2f ms", last_display_period / 1e6,
|
||||
pt_offset_count, pt_offset_min / 1e6, pt_offset_max / 1e6);
|
||||
for (int i = 0; i < PT_SLOTS && pt_stats[i].count; ++i)
|
||||
LOG("pose_debug: %s space=0x%llx base=0x%llx: %d calls, time - predicted display time %.2f..%.2f ms",
|
||||
pt_stats[i].kind, (unsigned long long)pt_stats[i].space, (unsigned long long)pt_stats[i].base,
|
||||
pt_stats[i].count, pt_stats[i].min / 1e6, pt_stats[i].max / 1e6);
|
||||
if (pt_overflow) LOG("pose_debug: %d calls not counted (more than %d spaces)", pt_overflow, PT_SLOTS);
|
||||
if (pt_fixed_mono + pt_fixed_past)
|
||||
LOG("pose_debug: pose_time_fix moved %d monotonic-clock times and %d far-past times (earliest asked %.2f ms)",
|
||||
pt_fixed_mono, pt_fixed_past, pt_fixed_min / 1e6);
|
||||
memset(pt_stats, 0, sizeof(pt_stats));
|
||||
pt_overflow = pt_offset_count = pt_fixed_mono = pt_fixed_past = 0;
|
||||
pthread_mutex_unlock(&pt_lock);
|
||||
}
|
||||
@@ -163,39 +163,6 @@ static void focus_hold_note(int state) {
|
||||
else if (state >= 0 && state != XR_SESSION_STATE_FOCUSED) is_focused = 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- focus log (always on: rare events, cheap)
|
||||
// Every time the runtime takes focus away and gives it back, as the runtime reports it (before focus_hold hides a dip
|
||||
// from the app): FramePort's session triage counts these dips after a play session and suggests a longer
|
||||
// focus_hold_ms when they keep reaching the game.
|
||||
static PFN_xrPollEvent focus_log_next;
|
||||
static int focus_log_focused;
|
||||
static int64_t focus_log_lost_at;
|
||||
static int focus_log_lost_state;
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL focus_log_poll(XrInstance instance, XrEventDataBuffer *event) {
|
||||
XrResult r = focus_log_next(instance, event);
|
||||
if (r != XR_SUCCESS || !event) return r;
|
||||
int state = session_state_of(event);
|
||||
if (state < 0) return r;
|
||||
if (state == XR_SESSION_STATE_FOCUSED) {
|
||||
if (focus_log_lost_at)
|
||||
LOG("focus: back after %.0f ms (lost to state %d)", (monotonic_ns() - focus_log_lost_at) / 1e6,
|
||||
focus_log_lost_state);
|
||||
focus_log_focused = 1;
|
||||
focus_log_lost_at = 0;
|
||||
} else if (focus_log_focused && (state == XR_SESSION_STATE_VISIBLE || state == XR_SESSION_STATE_SYNCHRONIZED)) {
|
||||
focus_log_focused = 0;
|
||||
focus_log_lost_at = monotonic_ns();
|
||||
focus_log_lost_state = state;
|
||||
LOG("focus: lost (state %d)", state);
|
||||
} else if (state != XR_SESSION_STATE_VISIBLE && state != XR_SESSION_STATE_SYNCHRONIZED) {
|
||||
focus_log_focused = 0; // stopping, loss pending, exiting: the session ends, not a dip
|
||||
if (focus_log_lost_at) LOG("focus: session ending (state %d)", state);
|
||||
focus_log_lost_at = 0;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static XrResult focus_hold_poll(PFN_xrPollEvent fn, XrInstance instance, XrEventDataBuffer *event) {
|
||||
for (;;) {
|
||||
if (held.delivering) { // hand held events to the app, oldest first
|
||||
@@ -318,90 +285,6 @@ static int touch_has(const char *path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- finger proximity from touch (proximity_emul)
|
||||
// Meta's OVRPlugin reports a thumb or index finger resting near the controller through XR_FB_touch_controller_proximity
|
||||
// (.../thumb_fb/proximity_fb, .../trigger/proximity_fb). The Frame's runtime doesn't have it; OVRPort's loader offers
|
||||
// it to the game anyway, and the proximity actions never get a working binding: "near" stays false, so games that
|
||||
// animate the hands from it show a thumb that never moves (Unreal's ThumbUp axis is "no thumb proximity", e.g. Vader
|
||||
// Immortal; found by Klownicle, GitHub #49). With proximity_emul those actions are bound to the capacitive touch inputs
|
||||
// instead (OpenXR combines several bindings of one boolean action with OR): thumb = thumbstick, face buttons or thumb
|
||||
// rest touched; index (proximity_emul=2) = trigger touched. Only when the runtime lacks the extension itself.
|
||||
static XrAction thumb_proximity_action, trigger_proximity_action;
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrCreateAction(XrActionSet set, const XrActionCreateInfo *info,
|
||||
XrAction *action) {
|
||||
PFN_xrCreateAction fn = (PFN_xrCreateAction)lookup(active_instance, "xrCreateAction");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
XrResult r = fn(set, info, action);
|
||||
if (XR_SUCCEEDED(r) && info && action) { // OVRPlugin's action names
|
||||
if (!strcmp(info->actionName, "hand_thumb_proximity")) thumb_proximity_action = *action;
|
||||
else if (!strcmp(info->actionName, "hand_trigger_proximity")) trigger_proximity_action = *action;
|
||||
else return r;
|
||||
LOG("proximity_emul: game action %s found", info->actionName);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static const char *const THUMB_TOUCH_LEFT[] = {"x/touch", "y/touch", "thumbstick/touch", "thumbrest/touch"};
|
||||
static const char *const THUMB_TOUCH_RIGHT[] = {"a/touch", "b/touch", "thumbstick/touch", "thumbrest/touch"};
|
||||
|
||||
static int add_binding(XrInstance instance, PFN_xrStringToPath to_path, XrActionSuggestedBinding *b, uint32_t *n,
|
||||
XrAction action, const char *hand, const char *input) {
|
||||
char path[XR_MAX_PATH_LENGTH];
|
||||
snprintf(path, sizeof(path), "/user/hand/%s/input/%s", hand, input);
|
||||
XrPath p;
|
||||
if (XR_FAILED(to_path(instance, path, &p))) return 0;
|
||||
for (uint32_t i = 0; i < *n; ++i)
|
||||
if (b[i].action == action && b[i].binding == p) return 0;
|
||||
b[*n].action = action;
|
||||
b[(*n)++].binding = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Suggests Touch bindings with finger proximity bound to the touch inputs (proximity_emul), falling back to the
|
||||
// bindings as given when the runtime refuses them.
|
||||
static XrResult suggest_touch(XrInstance instance, PFN_xrSuggestInteractionProfileBindings fn,
|
||||
PFN_xrPathToString to_string, const XrInteractionProfileSuggestedBinding *suggested) {
|
||||
PFN_xrStringToPath to_path = (PFN_xrStringToPath)lookup(instance, "xrStringToPath");
|
||||
if (!proximity_emul || runtime_has_proximity || !to_path || !to_string) return fn(instance, suggested);
|
||||
XrAction thumb = thumb_proximity_action, index = proximity_emul > 1 ? trigger_proximity_action : XR_NULL_HANDLE;
|
||||
uint32_t n = suggested->countSuggestedBindings, kept = 0, dropped = 0, added = 0;
|
||||
XrActionSuggestedBinding *b = calloc(n + 2 * 5, sizeof(*b));
|
||||
if (!b) return fn(instance, suggested);
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
char path[XR_MAX_PATH_LENGTH];
|
||||
uint32_t size = 0;
|
||||
const XrActionSuggestedBinding *s = &suggested->suggestedBindings[i];
|
||||
if (XR_SUCCEEDED(to_string(instance, s->binding, sizeof(path), &size, path)) && strstr(path, "/proximity_")) {
|
||||
// the game's own proximity binding, which the runtime doesn't know: its action is bound to touch below
|
||||
if (strstr(path, "/thumb")) { if (!thumb) thumb = s->action; }
|
||||
else if (proximity_emul > 1 && !index) index = s->action;
|
||||
++dropped;
|
||||
continue;
|
||||
}
|
||||
b[kept++] = *s;
|
||||
}
|
||||
for (int hand = 0; hand < 2; ++hand) {
|
||||
const char *name = hand ? "right" : "left";
|
||||
const char *const *thumb_inputs = hand ? THUMB_TOUCH_RIGHT : THUMB_TOUCH_LEFT;
|
||||
for (int c = 0; thumb && c < 4; ++c) added += add_binding(instance, to_path, b, &kept, thumb, name, thumb_inputs[c]);
|
||||
if (index) added += add_binding(instance, to_path, b, &kept, index, name, "trigger/touch");
|
||||
}
|
||||
XrResult r;
|
||||
if (!added && !dropped) r = fn(instance, suggested);
|
||||
else {
|
||||
XrInteractionProfileSuggestedBinding copy = *suggested;
|
||||
copy.countSuggestedBindings = kept;
|
||||
copy.suggestedBindings = b;
|
||||
r = fn(instance, ©);
|
||||
LOG("proximity_emul: finger proximity bound to touch (%u binding(s) added, %u proximity path(s) replaced): %d",
|
||||
added, dropped, r);
|
||||
if (XR_FAILED(r)) r = fn(instance, suggested);
|
||||
}
|
||||
free(b);
|
||||
return r;
|
||||
}
|
||||
|
||||
static XrResult remap_to_touch(XrInstance instance, PFN_xrSuggestInteractionProfileBindings fn,
|
||||
PFN_xrPathToString to_string, const XrInteractionProfileSuggestedBinding *suggested,
|
||||
const char *profile) {
|
||||
@@ -422,7 +305,7 @@ static XrResult remap_to_touch(XrInstance instance, PFN_xrSuggestInteractionProf
|
||||
copy.interactionProfile = touch;
|
||||
copy.countSuggestedBindings = kept;
|
||||
copy.suggestedBindings = b;
|
||||
XrResult r = kept ? suggest_touch(instance, fn, to_string, ©) : XR_ERROR_PATH_UNSUPPORTED;
|
||||
XrResult r = kept ? fn(instance, ©) : XR_ERROR_PATH_UNSUPPORTED;
|
||||
free(b);
|
||||
LOG("controller profile %s -> oculus/touch_controller (%u bindings, %u dropped): %d", profile + 22, kept,
|
||||
n - kept, r);
|
||||
@@ -442,14 +325,12 @@ static XRAPI_ATTR XrResult XRAPI_CALL hook_xrSuggestInteractionProfileBindings(X
|
||||
if (XR_SUCCEEDED(to_string(instance, suggested->suggestedBindings[i].binding, sizeof(path), &size, path)))
|
||||
note_pose_binding(suggested->suggestedBindings[i].action, path);
|
||||
}
|
||||
XrResult r = fn(instance, suggested);
|
||||
input_diag_suggested(instance, suggested, r, to_string); // the runtime's answer to the game's own suggestion
|
||||
if (!profile_remap || !suggested || !to_string) return r;
|
||||
char profile[XR_MAX_PATH_LENGTH] = {0};
|
||||
uint32_t size = 0;
|
||||
int known = suggested && to_string &&
|
||||
XR_SUCCEEDED(to_string(instance, suggested->interactionProfile, sizeof(profile), &size, profile));
|
||||
XrResult r = known && !strcmp(profile, TOUCH_PROFILE) ? suggest_touch(instance, fn, to_string, suggested)
|
||||
: fn(instance, suggested);
|
||||
input_diag_suggested(instance, suggested, r, to_string); // the runtime's answer to the game's own suggestion
|
||||
if (!profile_remap || !known) return r;
|
||||
if (XR_FAILED(to_string(instance, suggested->interactionProfile, sizeof(profile), &size, profile))) return r;
|
||||
if (!strcmp(profile, TOUCH_PROFILE)) {
|
||||
if (XR_SUCCEEDED(r)) app_suggested_touch = 1; // the app's own Touch bindings win over a remap
|
||||
return r;
|
||||
|
||||
@@ -1,383 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Included after surface_projection.c. Snapshots scene images BEFORE release,
|
||||
// then composes decoded video + scene into one primary projection on the GPU.
|
||||
#include "surface_composite.h"
|
||||
#include "surface_composite_spv.h"
|
||||
|
||||
#define SC_SCENES 4
|
||||
typedef struct {
|
||||
XrSwapchain handle;
|
||||
VkImage image;
|
||||
VkImageView view;
|
||||
VkDeviceMemory memory;
|
||||
VkCommandBuffer commands[MAX_IMAGES];
|
||||
VkFence fences[MAX_IMAGES];
|
||||
int pending[MAX_IMAGES], ready;
|
||||
uint64_t serial,captured_release,releases;
|
||||
uint32_t width,height,layers;
|
||||
} surf_scene_snapshot;
|
||||
static surf_scene_snapshot sc_scenes[SC_SCENES];
|
||||
static uint64_t sc_serial;
|
||||
static int64_t sc_capture_until;
|
||||
|
||||
// Unity attaches both structures even when their transforms are identity.
|
||||
// Apply supported transforms in our shader; reject other chains rather than
|
||||
// silently discarding semantics when flattening the original scene.
|
||||
static int sc_scene_supported(const XrCompositionLayerProjection *scene) {
|
||||
int reason=0;
|
||||
if(!scene || scene->viewCount!=2 || !scene->views)return 0;
|
||||
int count=0;
|
||||
for(const XrBaseInStructure *n=scene->next;n;n=n->next) {
|
||||
if(++count>16){reason=-1;break;}
|
||||
if(n->type==XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR)continue;
|
||||
if(n->type==XR_TYPE_COMPOSITION_LAYER_IMAGE_LAYOUT_FB) {
|
||||
const XrCompositionLayerImageLayoutFB *layout=(const void*)n;
|
||||
if(!(layout->flags&~XR_COMPOSITION_LAYER_IMAGE_LAYOUT_VERTICAL_FLIP_BIT_FB))continue;
|
||||
}
|
||||
reason=n->type;break;
|
||||
}
|
||||
for(int e=0;e<2 && !reason;e++)if(scene->views[e].next)
|
||||
reason=((const XrBaseInStructure*)scene->views[e].next)->type;
|
||||
static int previous;
|
||||
if(reason && reason!=previous)LOG("surface_composite: unsupported scene extension %d; retaining ordinary composition",reason);
|
||||
previous=reason;return !reason;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
XrSwapchain output;
|
||||
VkImage images[MAX_IMAGES];
|
||||
VkImageView views[MAX_IMAGES];
|
||||
VkFramebuffer framebuffers[MAX_IMAGES];
|
||||
VkRenderPass render_pass;
|
||||
VkSampler sampler;
|
||||
VkDescriptorPool pool;
|
||||
VkDescriptorSetLayout set_layout;
|
||||
VkDescriptorSet sets[MAX_IMAGES][2];
|
||||
VkPipelineLayout layout;
|
||||
VkPipeline pipeline;
|
||||
VkCommandBuffer commands[MAX_IMAGES];
|
||||
VkFence fences[MAX_IMAGES];
|
||||
int pending[MAX_IMAGES], ready, acquired, failed;
|
||||
uint32_t count,index;
|
||||
XrTime time;
|
||||
XrCompositionLayerProjection layer;
|
||||
XrCompositionLayerProjectionView eyes[2];
|
||||
int64_t log_time;
|
||||
uint64_t frames,holds;
|
||||
} surf_composite;
|
||||
static surf_composite sc_outputs[SURF_MAX];
|
||||
|
||||
static void sc_barrier(VkCommandBuffer cmd,VkImage image,uint32_t layers,VkImageLayout from,VkImageLayout to,
|
||||
VkAccessFlags src,VkAccessFlags dst) {
|
||||
VkImageMemoryBarrier b={VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,NULL,src,dst,from,to,
|
||||
VK_QUEUE_FAMILY_IGNORED,VK_QUEUE_FAMILY_IGNORED,image,{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,layers}};
|
||||
vk.CmdPipelineBarrier(cmd,VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
0,0,NULL,0,NULL,1,&b);
|
||||
}
|
||||
static int sc_command(VkCommandBuffer *cmd,VkFence *fence) {
|
||||
VkCommandBufferAllocateInfo ai={VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,NULL,vk.pool,VK_COMMAND_BUFFER_LEVEL_PRIMARY,1};
|
||||
VkFenceCreateInfo fi={VK_STRUCTURE_TYPE_FENCE_CREATE_INFO};
|
||||
if(vk.AllocateCommandBuffers(vk.device,&ai,cmd)!=VK_SUCCESS)return 0;
|
||||
if(vk.CreateFence(vk.device,&fi,NULL,fence)==VK_SUCCESS)return 1;
|
||||
PFN_vkFreeCommandBuffers free_cmd=(PFN_vkFreeCommandBuffers)vk.GetDeviceProcAddr(vk.device,"vkFreeCommandBuffers");
|
||||
free_cmd(vk.device,vk.pool,1,cmd);*cmd=VK_NULL_HANDLE;return 0;
|
||||
}
|
||||
static int sc_reuse(VkFence fence,int *pending) {
|
||||
if(!*pending)return 1;
|
||||
if(svk.GetFenceStatus(vk.device,fence)!=VK_SUCCESS)return 0;
|
||||
if(vk.ResetFences(vk.device,1,&fence)!=VK_SUCCESS)return 0;
|
||||
*pending=0;return 1;
|
||||
}
|
||||
static void sc_retire(VkCommandBuffer *commands,VkFence *fences,int *pending,uint32_t count) {
|
||||
PFN_vkDestroyFence destroy=(PFN_vkDestroyFence)vk.GetDeviceProcAddr(vk.device,"vkDestroyFence");
|
||||
PFN_vkFreeCommandBuffers free_cmd=(PFN_vkFreeCommandBuffers)vk.GetDeviceProcAddr(vk.device,"vkFreeCommandBuffers");
|
||||
for(uint32_t i=0;i<count;i++) {
|
||||
if(pending[i])vk.WaitForFences(vk.device,1,&fences[i],VK_TRUE,UINT64_MAX);
|
||||
if(fences[i])destroy(vk.device,fences[i],NULL);
|
||||
if(commands[i])free_cmd(vk.device,vk.pool,1,&commands[i]);
|
||||
}
|
||||
}
|
||||
static void surf_scene_destroy(XrSwapchain handle) {
|
||||
if(!handle || spvk.ready<=0)return;
|
||||
// A compositor command can still be sampling this mirror after its
|
||||
// snapshot copy completes. Retire those readers before destroying a view.
|
||||
for(int k=0;k<SURF_MAX;k++)for(uint32_t j=0;j<sc_outputs[k].count;j++)
|
||||
if(sc_outputs[k].pending[j])vk.WaitForFences(vk.device,1,&sc_outputs[k].fences[j],VK_TRUE,UINT64_MAX);
|
||||
for(int i=0;i<SC_SCENES;i++)if(sc_scenes[i].handle==handle) {
|
||||
surf_scene_snapshot *s=&sc_scenes[i];
|
||||
sc_retire(s->commands,s->fences,s->pending,MAX_IMAGES);
|
||||
if(s->view)spvk.DestroyImageView(vk.device,s->view,NULL);
|
||||
if(s->image)spvk.DestroyImage(vk.device,s->image,NULL);
|
||||
if(s->memory)spvk.FreeMemory(vk.device,s->memory,NULL);
|
||||
memset(s,0,sizeof(*s));
|
||||
}
|
||||
}
|
||||
static void surf_composite_destroy(surf_projection *p) {
|
||||
surf_composite *c=&sc_outputs[p-surf_projections];
|
||||
sc_retire(c->commands,c->fences,c->pending,c->count);
|
||||
if(c->pipeline)spvk.DestroyPipeline(vk.device,c->pipeline,NULL);
|
||||
if(c->layout)spvk.DestroyPipelineLayout(vk.device,c->layout,NULL);
|
||||
if(c->pool)spvk.DestroyDescriptorPool(vk.device,c->pool,NULL);
|
||||
if(c->set_layout)spvk.DestroyDescriptorSetLayout(vk.device,c->set_layout,NULL);
|
||||
if(c->sampler)spvk.DestroySampler(vk.device,c->sampler,NULL);
|
||||
for(uint32_t i=0;i<c->count;i++) {
|
||||
if(c->framebuffers[i])spvk.DestroyFramebuffer(vk.device,c->framebuffers[i],NULL);
|
||||
if(c->views[i])spvk.DestroyImageView(vk.device,c->views[i],NULL);
|
||||
}
|
||||
if(c->render_pass)spvk.DestroyRenderPass(vk.device,c->render_pass,NULL);
|
||||
if(c->output) {
|
||||
PFN_xrDestroySwapchain fn=(PFN_xrDestroySwapchain)lookup(active_instance,"xrDestroySwapchain");
|
||||
if(c->acquired) {
|
||||
PFN_xrWaitSwapchainImage wait=(PFN_xrWaitSwapchainImage)lookup(active_instance,"xrWaitSwapchainImage");
|
||||
PFN_xrReleaseSwapchainImage release=(PFN_xrReleaseSwapchainImage)lookup(active_instance,"xrReleaseSwapchainImage");
|
||||
XrSwapchainImageWaitInfo wi={XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO,NULL,XR_INFINITE_DURATION};
|
||||
XrSwapchainImageReleaseInfo ri={XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};
|
||||
if(wait(c->output,&wi)==XR_SUCCESS)release(c->output,&ri);
|
||||
}
|
||||
if(fn)fn(c->output);
|
||||
}
|
||||
memset(c,0,sizeof(*c));
|
||||
}
|
||||
|
||||
// Called while the application still owns this successfully waited image.
|
||||
// Queue ordering includes the application's rendering and this snapshot copy;
|
||||
// no CPU readback, post-release access, or deferred OpenXR release is needed.
|
||||
static void surf_scene_capture(tracked_swapchain *t,uint32_t index) {
|
||||
if(!surface_native || monotonic_ns()>sc_capture_until || !t || index>=t->image_count ||
|
||||
spvk.ready<=0 || t->info.sampleCount!=1 || t->info.arraySize!=2 ||
|
||||
!(t->info.usageFlags&XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT) ||
|
||||
!(t->info.usageFlags&XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT))return;
|
||||
surf_scene_snapshot *s=NULL;
|
||||
for(int i=0;i<SC_SCENES;i++)if(sc_scenes[i].handle==t->handle){s=&sc_scenes[i];break;}
|
||||
if(!s)for(int i=0;i<SC_SCENES;i++)if(!sc_scenes[i].handle){s=&sc_scenes[i];s->handle=t->handle;break;}
|
||||
if(!s)return;
|
||||
if(!s->view) {
|
||||
s->width=t->info.width;s->height=t->info.height;s->layers=t->info.arraySize;
|
||||
if(!surf_private_image(s->width,s->height,s->layers,(VkFormat)t->info.format,
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT,&s->image,&s->memory,&s->view)) {
|
||||
surf_scene_destroy(t->handle);return;
|
||||
}
|
||||
}
|
||||
if(!s->commands[index] && !sc_command(&s->commands[index],&s->fences[index]))return;
|
||||
if(!sc_reuse(s->fences[index],&s->pending[index]))return;
|
||||
VkCommandBuffer cmd=s->commands[index];
|
||||
VkCommandBufferBeginInfo begin={VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,NULL,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
|
||||
if(vk.ResetCommandBuffer(cmd,0)!=VK_SUCCESS || vk.BeginCommandBuffer(cmd,&begin)!=VK_SUCCESS)return;
|
||||
sc_barrier(cmd,t->images[index],s->layers,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,VK_ACCESS_TRANSFER_READ_BIT);
|
||||
sc_barrier(cmd,s->image,s->layers,s->ready?VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,s->ready?VK_ACCESS_SHADER_READ_BIT:0,VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
VkImageCopy copy={{VK_IMAGE_ASPECT_COLOR_BIT,0,0,s->layers},{0,0,0},
|
||||
{VK_IMAGE_ASPECT_COLOR_BIT,0,0,s->layers},{0,0,0},{s->width,s->height,1}};
|
||||
spvk.CmdCopyImage(cmd,t->images[index],VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,s->image,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,1,©);
|
||||
sc_barrier(cmd,s->image,s->layers,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,VK_ACCESS_SHADER_READ_BIT);
|
||||
sc_barrier(cmd,t->images[index],s->layers,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_READ_BIT,VK_ACCESS_COLOR_ATTACHMENT_READ_BIT|VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
|
||||
if(vk.EndCommandBuffer(cmd)!=VK_SUCCESS)return;
|
||||
VkSubmitInfo submit={VK_STRUCTURE_TYPE_SUBMIT_INFO,NULL,0,NULL,NULL,1,&cmd};
|
||||
if(vk.QueueSubmit(vk.queue,1,&submit,s->fences[index])!=VK_SUCCESS)return;
|
||||
s->pending[index]=1;s->ready=1;s->serial=sc_serial+1;s->captured_release=s->releases+1;
|
||||
}
|
||||
|
||||
static int sc_setup(XrSession session,surf_projection *p,surf_composite *c) {
|
||||
if(c->pipeline)return 1;
|
||||
if(c->failed)return 0;
|
||||
PFN_xrCreateSwapchain create=(PFN_xrCreateSwapchain)lookup(active_instance,"xrCreateSwapchain");
|
||||
PFN_xrEnumerateSwapchainImages enumerate=(PFN_xrEnumerateSwapchainImages)lookup(active_instance,"xrEnumerateSwapchainImages");
|
||||
XrSwapchainCreateInfo ci={XR_TYPE_SWAPCHAIN_CREATE_INFO,NULL,0,
|
||||
XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT|XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
VK_FORMAT_R8G8B8A8_SRGB,1,2*p->size,p->size,1,1,1};
|
||||
if(!create || !enumerate || XR_FAILED(create(session,&ci,&c->output)))goto fail;
|
||||
XrSwapchainImageVulkanKHR images[MAX_IMAGES];
|
||||
for(int i=0;i<MAX_IMAGES;i++)images[i]=(XrSwapchainImageVulkanKHR){XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR};
|
||||
if(XR_FAILED(enumerate(c->output,MAX_IMAGES,&c->count,(void*)images)) || !c->count || c->count>MAX_IMAGES) {
|
||||
c->count=0;goto fail;
|
||||
}
|
||||
for(uint32_t i=0;i<c->count;i++) {
|
||||
c->images[i]=images[i].image;
|
||||
if(!sc_command(&c->commands[i],&c->fences[i]))goto fail;
|
||||
}
|
||||
VkAttachmentDescription attachment={0,VK_FORMAT_R8G8B8A8_SRGB,VK_SAMPLE_COUNT_1_BIT,
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE,VK_ATTACHMENT_STORE_OP_STORE,VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE,VK_IMAGE_LAYOUT_UNDEFINED,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
|
||||
VkAttachmentReference reference={0,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
|
||||
VkSubpassDescription subpass={0,VK_PIPELINE_BIND_POINT_GRAPHICS,0,NULL,1,&reference};
|
||||
VkSubpassDependency dependency={VK_SUBPASS_EXTERNAL,0,VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT|VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
VK_ACCESS_MEMORY_WRITE_BIT|VK_ACCESS_MEMORY_READ_BIT,VK_ACCESS_SHADER_READ_BIT|VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT};
|
||||
VkRenderPassCreateInfo rpi={VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,NULL,0,1,&attachment,1,&subpass,1,&dependency};
|
||||
if(spvk.CreateRenderPass(vk.device,&rpi,NULL,&c->render_pass)!=VK_SUCCESS)goto fail;
|
||||
for(uint32_t i=0;i<c->count;i++) {
|
||||
VkImageViewCreateInfo vi={VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,NULL,0,c->images[i],VK_IMAGE_VIEW_TYPE_2D,
|
||||
VK_FORMAT_R8G8B8A8_SRGB,{0,0,0,0},{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,1}};
|
||||
if(spvk.CreateImageView(vk.device,&vi,NULL,&c->views[i])!=VK_SUCCESS)goto fail;
|
||||
VkFramebufferCreateInfo fi={VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,NULL,0,c->render_pass,1,&c->views[i],2*p->size,p->size,1};
|
||||
if(spvk.CreateFramebuffer(vk.device,&fi,NULL,&c->framebuffers[i])!=VK_SUCCESS)goto fail;
|
||||
}
|
||||
VkSamplerCreateInfo si={VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,NULL,0,VK_FILTER_LINEAR,VK_FILTER_LINEAR,
|
||||
VK_SAMPLER_MIPMAP_MODE_NEAREST,VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
|
||||
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE};
|
||||
if(spvk.CreateSampler(vk.device,&si,NULL,&c->sampler)!=VK_SUCCESS)goto fail;
|
||||
VkDescriptorSetLayoutBinding bindings[2]={{0,VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,1,VK_SHADER_STAGE_FRAGMENT_BIT},
|
||||
{1,VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,1,VK_SHADER_STAGE_FRAGMENT_BIT}};
|
||||
VkDescriptorSetLayoutCreateInfo li={VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,NULL,0,2,bindings};
|
||||
if(spvk.CreateDescriptorSetLayout(vk.device,&li,NULL,&c->set_layout)!=VK_SUCCESS)goto fail;
|
||||
VkDescriptorPoolSize sizes[1]={{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,4*c->count}};
|
||||
VkDescriptorPoolCreateInfo pi={VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,NULL,0,2*c->count,1,sizes};
|
||||
if(spvk.CreateDescriptorPool(vk.device,&pi,NULL,&c->pool)!=VK_SUCCESS)goto fail;
|
||||
for(uint32_t i=0;i<c->count;i++)for(int e=0;e<2;e++) {
|
||||
VkDescriptorSetAllocateInfo ai={VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,NULL,c->pool,1,&c->set_layout};
|
||||
if(spvk.AllocateDescriptorSets(vk.device,&ai,&c->sets[i][e])!=VK_SUCCESS)goto fail;
|
||||
}
|
||||
VkPushConstantRange range={VK_SHADER_STAGE_FRAGMENT_BIT,0,sizeof(surf_composite_params)};
|
||||
VkPipelineLayoutCreateInfo pli={VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,NULL,0,1,&c->set_layout,1,&range};
|
||||
if(spvk.CreatePipelineLayout(vk.device,&pli,NULL,&c->layout)!=VK_SUCCESS)goto fail;
|
||||
VkShaderModule modules[2]={0};
|
||||
VkShaderModuleCreateInfo mi={VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,NULL,0,sizeof(surface_composite_vert_spv),surface_composite_vert_spv};
|
||||
if(spvk.CreateShaderModule(vk.device,&mi,NULL,&modules[0])!=VK_SUCCESS)goto fail;
|
||||
mi.codeSize=sizeof(surface_composite_frag_spv);mi.pCode=surface_composite_frag_spv;
|
||||
if(spvk.CreateShaderModule(vk.device,&mi,NULL,&modules[1])!=VK_SUCCESS) {
|
||||
spvk.DestroyShaderModule(vk.device,modules[0],NULL);goto fail;
|
||||
}
|
||||
VkPipelineShaderStageCreateInfo stages[2]={
|
||||
{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,NULL,0,VK_SHADER_STAGE_VERTEX_BIT,modules[0],"main"},
|
||||
{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,NULL,0,VK_SHADER_STAGE_FRAGMENT_BIT,modules[1],"main"}};
|
||||
VkPipelineVertexInputStateCreateInfo vertices={VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
|
||||
VkPipelineInputAssemblyStateCreateInfo assembly={VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,NULL,0,VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST};
|
||||
VkPipelineViewportStateCreateInfo viewport={VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,NULL,0,1,NULL,1,NULL};
|
||||
VkPipelineRasterizationStateCreateInfo raster={VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,NULL,0,VK_FALSE,VK_FALSE,
|
||||
VK_POLYGON_MODE_FILL,VK_CULL_MODE_NONE,VK_FRONT_FACE_COUNTER_CLOCKWISE,VK_FALSE,0,0,0,1};
|
||||
VkPipelineMultisampleStateCreateInfo samples={VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,NULL,0,VK_SAMPLE_COUNT_1_BIT};
|
||||
VkPipelineColorBlendAttachmentState blend={.colorWriteMask=VK_COLOR_COMPONENT_R_BIT|VK_COLOR_COMPONENT_G_BIT|VK_COLOR_COMPONENT_B_BIT|VK_COLOR_COMPONENT_A_BIT};
|
||||
VkPipelineColorBlendStateCreateInfo blends={VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,NULL,0,VK_FALSE,VK_LOGIC_OP_COPY,1,&blend};
|
||||
VkDynamicState dynamic_states[2]={VK_DYNAMIC_STATE_VIEWPORT,VK_DYNAMIC_STATE_SCISSOR};
|
||||
VkPipelineDynamicStateCreateInfo dynamic={VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,NULL,0,2,dynamic_states};
|
||||
VkGraphicsPipelineCreateInfo pci={VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,NULL,0,2,stages,&vertices,&assembly,NULL,&viewport,
|
||||
&raster,&samples,NULL,&blends,&dynamic,c->layout,c->render_pass,0,VK_NULL_HANDLE,-1};
|
||||
VkResult result=spvk.CreateGraphicsPipelines(vk.device,VK_NULL_HANDLE,1,&pci,NULL,&c->pipeline);
|
||||
for(int k=0;k<2;k++)spvk.DestroyShaderModule(vk.device,modules[k],NULL);
|
||||
if(result!=VK_SUCCESS)goto fail;
|
||||
LOG("surface_composite: one primary stereo scene, %ux%u per eye",p->size,p->size);return 1;
|
||||
fail:
|
||||
surf_composite_destroy(p);c->failed=1;
|
||||
LOG("surface_composite: setup failed; retaining ordinary composition");return 0;
|
||||
}
|
||||
|
||||
static const XrCompositionLayerBaseHeader *surf_composite_frame(XrSession session,const XrFrameEndInfo *info,
|
||||
const XrCompositionLayerProjection *scene,const XrCompositionLayerBaseHeader *video) {
|
||||
surf_projection *p=NULL;
|
||||
for(int i=0;i<SURF_MAX;i++)if(video==(const void*)&surf_projections[i].layer && surfs[i].native_project) {
|
||||
p=&surf_projections[i];break;
|
||||
}
|
||||
if(!p || !p->cache_ready || !sc_scene_supported(scene))return NULL;
|
||||
if(p->presented_job.params[0][7]!=0 || p->presented_job.params[1][7]!=0)return NULL;
|
||||
sc_capture_until=monotonic_ns()+500000000ll;
|
||||
surf_composite *c=&sc_outputs[p-surf_projections];
|
||||
surf_scene_snapshot *sources[2]={0};
|
||||
for(int e=0;e<2;e++)for(int i=0;i<SC_SCENES;i++)if(sc_scenes[i].handle==scene->views[e].subImage.swapchain) {
|
||||
sources[e]=&sc_scenes[i];break;
|
||||
}
|
||||
if(p->cached_job.space!=surfs[p-surf_projections].video_job.space)return NULL;
|
||||
if(!sources[0] || !sources[1] || sources[0]->captured_release!=sources[0]->releases || sources[1]->captured_release!=sources[1]->releases)goto held;
|
||||
for(int e=0;e<2;e++)if(scene->views[e].next || scene->views[e].subImage.imageArrayIndex>=sources[e]->layers)goto held;
|
||||
if(!sc_setup(session,p,c))return NULL;
|
||||
PFN_xrAcquireSwapchainImage acquire=(PFN_xrAcquireSwapchainImage)lookup(active_instance,"xrAcquireSwapchainImage");
|
||||
PFN_xrWaitSwapchainImage wait=(PFN_xrWaitSwapchainImage)lookup(active_instance,"xrWaitSwapchainImage");
|
||||
PFN_xrReleaseSwapchainImage release=(PFN_xrReleaseSwapchainImage)lookup(active_instance,"xrReleaseSwapchainImage");
|
||||
XrSwapchainImageAcquireInfo ai={XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO};
|
||||
XrSwapchainImageWaitInfo wi={XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO,NULL,0};
|
||||
XrSwapchainImageReleaseInfo ri={XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};
|
||||
if(!c->acquired) {
|
||||
if(XR_FAILED(acquire(c->output,&ai,&c->index)))goto held;
|
||||
c->acquired=1;
|
||||
}
|
||||
if(wait(c->output,&wi)!=XR_SUCCESS)goto held;
|
||||
if(c->index>=c->count) {release(c->output,&ri);c->acquired=0;goto held;}
|
||||
uint32_t index=c->index;
|
||||
if(!sc_reuse(c->fences[index],&c->pending[index]))goto held;
|
||||
surf_swapchain *s=&surfs[p-surf_projections];
|
||||
pthread_mutex_lock(&surf_lock);surf_video_job current=s->video_job;pthread_mutex_unlock(&surf_lock);
|
||||
VkCommandBuffer cmd=c->commands[index];
|
||||
VkCommandBufferBeginInfo begin={VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,NULL,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
|
||||
if(vk.ResetCommandBuffer(cmd,0)!=VK_SUCCESS || vk.BeginCommandBuffer(cmd,&begin)!=VK_SUCCESS)goto held;
|
||||
VkRenderPassBeginInfo rbi={VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,NULL,c->render_pass,c->framebuffers[index],
|
||||
{{0,0},{2*p->size,p->size}},0,NULL};
|
||||
spvk.CmdBeginRenderPass(cmd,&rbi,VK_SUBPASS_CONTENTS_INLINE);
|
||||
spvk.CmdBindPipeline(cmd,VK_PIPELINE_BIND_POINT_GRAPHICS,c->pipeline);
|
||||
for(int e=0;e<2;e++) {
|
||||
VkDescriptorImageInfo di[2]={{c->sampler,p->video_cache_view,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL},
|
||||
{c->sampler,sources[e]->view,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}};
|
||||
VkWriteDescriptorSet writes[2];
|
||||
for(int k=0;k<2;k++)writes[k]=(VkWriteDescriptorSet){VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,NULL,c->sets[index][e],k,0,1,
|
||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,&di[k]};
|
||||
spvk.UpdateDescriptorSets(vk.device,2,writes,0,NULL);
|
||||
spvk.CmdBindDescriptorSets(cmd,VK_PIPELINE_BIND_POINT_GRAPHICS,c->layout,0,1,&c->sets[index][e],0,NULL);
|
||||
surf_composite_params params=surf_composite_parameters(&p->cached_job,¤t,e,
|
||||
scene->views[e].subImage.imageRect,sources[e]->width,sources[e]->height,scene->views[e].subImage.imageArrayIndex);
|
||||
params.scene_options[0]=(scene->layerFlags&XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT)!=0;
|
||||
params.scene_options[1]=(scene->layerFlags&XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT)!=0;
|
||||
for(const XrBaseInStructure *n=scene->next;n;n=n->next) {
|
||||
if(n->type==XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR) {
|
||||
const XrCompositionLayerColorScaleBiasKHR *color=(const void*)n;
|
||||
memcpy(params.scene_scale,&color->colorScale,16);memcpy(params.scene_bias,&color->colorBias,16);
|
||||
}
|
||||
if(n->type==XR_TYPE_COMPOSITION_LAYER_IMAGE_LAYOUT_FB)
|
||||
params.scene_options[2]=(((const XrCompositionLayerImageLayoutFB*)n)->flags&XR_COMPOSITION_LAYER_IMAGE_LAYOUT_VERTICAL_FLIP_BIT_FB)!=0;
|
||||
}
|
||||
VkViewport viewport={(float)(e*p->size),0,(float)p->size,(float)p->size,0,1};
|
||||
VkRect2D scissor={{e*(int32_t)p->size,0},{p->size,p->size}};
|
||||
spvk.CmdSetViewport(cmd,0,1,&viewport);spvk.CmdSetScissor(cmd,0,1,&scissor);
|
||||
spvk.CmdPushConstants(cmd,c->layout,VK_SHADER_STAGE_FRAGMENT_BIT,0,sizeof(params),¶ms);
|
||||
spvk.CmdDraw(cmd,3,1,0,0);
|
||||
}
|
||||
spvk.CmdEndRenderPass(cmd);
|
||||
if(vk.EndCommandBuffer(cmd)!=VK_SUCCESS)goto held;
|
||||
VkSubmitInfo submit={VK_STRUCTURE_TYPE_SUBMIT_INFO,NULL,0,NULL,NULL,1,&cmd};
|
||||
if(vk.QueueSubmit(vk.queue,1,&submit,c->fences[index])!=VK_SUCCESS)goto held;
|
||||
c->pending[index]=1;
|
||||
if(XR_FAILED(release(c->output,&ri)))goto held;
|
||||
c->acquired=0;
|
||||
for(int e=0;e<2;e++) {
|
||||
c->eyes[e]=scene->views[e];c->eyes[e].next=NULL;
|
||||
c->eyes[e].subImage=(XrSwapchainSubImage){c->output,{{e*(int32_t)p->size,0},{(int32_t)p->size,(int32_t)p->size}},0};
|
||||
}
|
||||
c->layer=*scene;c->layer.layerFlags &= ~XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT;c->layer.next=NULL;c->layer.views=c->eyes;c->ready=1;c->time=info->displayTime;c->frames++;
|
||||
if(monotonic_ns()-c->log_time>5000000000ll) {
|
||||
LOG("surface_composite: %llu new scene frames, %llu held; no scene/overlay promotion",(unsigned long long)c->frames,(unsigned long long)c->holds);
|
||||
c->log_time=monotonic_ns();
|
||||
}
|
||||
return (const void*)&c->layer;
|
||||
held:
|
||||
c->holds++;
|
||||
return c->ready && c->layer.space==scene->space?(const void*)&c->layer:NULL;
|
||||
}
|
||||
|
||||
static int surf_composite_candidate(const XrFrameEndInfo *info,const XrCompositionLayerBaseHeader *video) {
|
||||
if(!info || !info->layerCount || !info->layers[0] || info->layers[0]->type!=XR_TYPE_COMPOSITION_LAYER_PROJECTION ||
|
||||
!emul_is_equirect(video))return 0;
|
||||
const XrCompositionLayerProjection *scene=(const void*)info->layers[0];
|
||||
if(!sc_scene_supported(scene))return 0;
|
||||
emul_common target=emul_common_of(video);
|
||||
for(uint32_t i=1;i<info->layerCount;i++) {
|
||||
const XrCompositionLayerBaseHeader *layer=info->layers[i];
|
||||
if(layer==video)return 1;
|
||||
if(!layer)continue;
|
||||
if(!emul_is_equirect(layer))return 0;
|
||||
emul_common other=emul_common_of(layer);
|
||||
if(other.sub.swapchain!=target.sub.swapchain || other.space!=target.space)return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static void surf_scene_release_commit(XrSwapchain handle) {
|
||||
for(int i=0;i<SC_SCENES;i++)if(sc_scenes[i].handle==handle){sc_scenes[i].releases++;break;}
|
||||
}
|
||||
static int surf_composite_cached_only(const XrFrameEndInfo *info,surf_projection *p,
|
||||
const surf_video_job *rendered,const surf_video_job *current) {
|
||||
surf_composite *c=&sc_outputs[p-surf_projections];
|
||||
const XrCompositionLayerProjection *scene=(const void*)info->layers[0];
|
||||
return c->ready && !p->acquired && c->layer.space==scene->space && rendered->space==current->space &&
|
||||
rendered->params[0][7]==0 && rendered->params[1][7]==0 && !c->failed;
|
||||
}
|
||||
|
||||
static int surf_composite_active(surf_projection *p) {return sc_outputs[p-surf_projections].ready;}
|
||||
@@ -1,39 +0,0 @@
|
||||
#version 450
|
||||
// Reproject the decoded video into the game camera, then compose in linear light.
|
||||
// Every output pixel belongs to one primary projection, including fades/edges.
|
||||
layout(location=0) in vec2 uv;
|
||||
layout(location=0) out vec4 outputColor;
|
||||
layout(binding=0) uniform sampler2D videoImage;
|
||||
layout(binding=1) uniform sampler2DArray sceneImage;
|
||||
layout(push_constant) uniform Params {
|
||||
vec4 rotation; vec4 outputTans; vec4 videoTans;
|
||||
vec4 sceneRect; vec4 options; vec4 sceneOptions; vec4 sceneScale; vec4 sceneBias;
|
||||
} p;
|
||||
vec3 rotate(vec4 q,vec3 v){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}
|
||||
void main(){
|
||||
vec2 scenePixel=0.5/vec2(textureSize(sceneImage,0).xy);
|
||||
vec2 sceneCoord=vec2(uv.x,p.sceneOptions.z>0 ? 1-uv.y : uv.y);
|
||||
vec2 sceneUV=clamp(p.sceneRect.xy+sceneCoord*p.sceneRect.zw,p.sceneRect.xy+scenePixel,p.sceneRect.xy+p.sceneRect.zw-scenePixel);
|
||||
vec4 scene=textureLod(sceneImage,vec3(sceneUV,p.options.y),0);
|
||||
// Projection rows follow Vulkan/OpenXR's top-to-bottom convention.
|
||||
vec3 ray=rotate(p.rotation,vec3(mix(p.outputTans.x,p.outputTans.y,uv.x),mix(p.outputTans.w,p.outputTans.z,uv.y),-1));
|
||||
vec2 vuv=(ray.xy/-ray.z-p.videoTans.xz)/(p.videoTans.yw-p.videoTans.xz); vuv.y=1-vuv.y;
|
||||
vec4 video=vec4(0);
|
||||
if(ray.z<0 && all(greaterThanEqual(vuv,vec2(0))) && all(lessThanEqual(vuv,vec2(1))))
|
||||
{
|
||||
vec2 videoPixel=0.5/vec2(textureSize(videoImage,0));
|
||||
vec4 videoRect=vec4(p.options.x*.5,0,.5,1);
|
||||
vec2 videoUV=clamp(videoRect.xy+vuv*videoRect.zw,videoRect.xy+videoPixel,videoRect.xy+videoRect.zw-videoPixel);
|
||||
video=textureLod(videoImage,videoUV,0);
|
||||
}
|
||||
float alpha=p.options.z>0 ? video.a : 1;
|
||||
vec3 rgb=p.options.w>0 ? video.rgb*alpha : video.rgb;
|
||||
float sceneAlpha=p.sceneOptions.x>0 ? scene.a : 1;
|
||||
vec3 sceneRGB=p.sceneOptions.y>0 ? scene.rgb*sceneAlpha : scene.rgb;
|
||||
// OpenXR colour transforms act on straight colour, then restore premultiplication.
|
||||
vec4 sceneStraight=vec4(sceneAlpha>0 ? sceneRGB/sceneAlpha : vec3(0),sceneAlpha);
|
||||
sceneStraight=sceneStraight*max(p.sceneScale,vec4(0))+p.sceneBias;
|
||||
sceneAlpha=sceneStraight.a;sceneRGB=sceneStraight.rgb*sceneAlpha;
|
||||
vec4 result=vec4(rgb+sceneRGB*(1-alpha),alpha+sceneAlpha*(1-alpha));
|
||||
outputColor=result;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Parameters for composing a cached movie view into the game's scene camera.
|
||||
#ifndef FRAMEBRIDGE_SURFACE_COMPOSITE_H
|
||||
#define FRAMEBRIDGE_SURFACE_COMPOSITE_H
|
||||
#include "surface_video.h"
|
||||
typedef struct {
|
||||
float rotation[4], output_tans[4], video_tans[4];
|
||||
float scene_rect[4], options[4], scene_options[4], scene_scale[4], scene_bias[4];
|
||||
} surf_composite_params;
|
||||
static surf_composite_params surf_composite_parameters(const surf_video_job *rendered,
|
||||
const surf_video_job *current,int eye,XrRect2Di rect,uint32_t width,uint32_t height,uint32_t array_index) {
|
||||
surf_composite_params p={0};
|
||||
// The current view must already be transformed into the panorama space.
|
||||
XrPosef source=surf_video_pose(rendered,current,eye);
|
||||
XrQuaternionf relative=lm_qmul(lm_qconj(source.orientation),current->views[eye].pose.orientation);
|
||||
memcpy(p.rotation,&relative,sizeof(relative));
|
||||
for(int i=0;i<4;i++) {
|
||||
p.output_tans[i]=current->params[eye][8+i]/SURF_VIDEO_GUARD;
|
||||
p.video_tans[i]=rendered->params[eye][8+i];
|
||||
}
|
||||
p.scene_rect[0]=rect.offset.x/(float)width;p.scene_rect[1]=rect.offset.y/(float)height;
|
||||
p.scene_rect[2]=rect.extent.width/(float)width;p.scene_rect[3]=rect.extent.height/(float)height;
|
||||
for(int i=0;i<4;i++)p.scene_scale[i]=1;
|
||||
p.options[0]=(float)eye;p.options[1]=(float)array_index;
|
||||
p.options[2]=(rendered->flags&XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT)!=0;
|
||||
p.options[3]=(rendered->flags&XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT)!=0;
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
#version 450
|
||||
layout(location=0) out vec2 uv;
|
||||
void main(){vec2 p=vec2((gl_VertexIndex<<1)&2,gl_VertexIndex&2);uv=p;gl_Position=vec4(p*2-1,0,1);}
|
||||
@@ -1,300 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Generated by glslc; Vulkan 1.0.
|
||||
static const uint32_t surface_composite_vert_spv[]={
|
||||
0x07230203,0x00010000,0x000d000a,0x0000002e,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x00000018,0x00000020,
|
||||
0x00030003,0x00000002,0x000001c2,0x000a0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
|
||||
0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
|
||||
0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x00657669,0x00040005,0x00000004,0x6e69616d,
|
||||
0x00000000,0x00030005,0x00000009,0x00000070,0x00060005,0x0000000c,0x565f6c67,0x65747265,
|
||||
0x646e4978,0x00007865,0x00030005,0x00000018,0x00007675,0x00060005,0x0000001e,0x505f6c67,
|
||||
0x65567265,0x78657472,0x00000000,0x00060006,0x0000001e,0x00000000,0x505f6c67,0x7469736f,
|
||||
0x006e6f69,0x00070006,0x0000001e,0x00000001,0x505f6c67,0x746e696f,0x657a6953,0x00000000,
|
||||
0x00070006,0x0000001e,0x00000002,0x435f6c67,0x4470696c,0x61747369,0x0065636e,0x00070006,
|
||||
0x0000001e,0x00000003,0x435f6c67,0x446c6c75,0x61747369,0x0065636e,0x00030005,0x00000020,
|
||||
0x00000000,0x00040047,0x0000000c,0x0000000b,0x0000002a,0x00040047,0x00000018,0x0000001e,
|
||||
0x00000000,0x00050048,0x0000001e,0x00000000,0x0000000b,0x00000000,0x00050048,0x0000001e,
|
||||
0x00000001,0x0000000b,0x00000001,0x00050048,0x0000001e,0x00000002,0x0000000b,0x00000003,
|
||||
0x00050048,0x0000001e,0x00000003,0x0000000b,0x00000004,0x00030047,0x0000001e,0x00000002,
|
||||
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
|
||||
0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,
|
||||
0x00040015,0x0000000a,0x00000020,0x00000001,0x00040020,0x0000000b,0x00000001,0x0000000a,
|
||||
0x0004003b,0x0000000b,0x0000000c,0x00000001,0x0004002b,0x0000000a,0x0000000e,0x00000001,
|
||||
0x0004002b,0x0000000a,0x00000010,0x00000002,0x00040020,0x00000017,0x00000003,0x00000007,
|
||||
0x0004003b,0x00000017,0x00000018,0x00000003,0x00040017,0x0000001a,0x00000006,0x00000004,
|
||||
0x00040015,0x0000001b,0x00000020,0x00000000,0x0004002b,0x0000001b,0x0000001c,0x00000001,
|
||||
0x0004001c,0x0000001d,0x00000006,0x0000001c,0x0006001e,0x0000001e,0x0000001a,0x00000006,
|
||||
0x0000001d,0x0000001d,0x00040020,0x0000001f,0x00000003,0x0000001e,0x0004003b,0x0000001f,
|
||||
0x00000020,0x00000003,0x0004002b,0x0000000a,0x00000021,0x00000000,0x0004002b,0x00000006,
|
||||
0x00000023,0x40000000,0x0004002b,0x00000006,0x00000025,0x3f800000,0x0004002b,0x00000006,
|
||||
0x00000028,0x00000000,0x00040020,0x0000002c,0x00000003,0x0000001a,0x00050036,0x00000002,
|
||||
0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,
|
||||
0x00000007,0x0004003d,0x0000000a,0x0000000d,0x0000000c,0x000500c4,0x0000000a,0x0000000f,
|
||||
0x0000000d,0x0000000e,0x000500c7,0x0000000a,0x00000011,0x0000000f,0x00000010,0x0004006f,
|
||||
0x00000006,0x00000012,0x00000011,0x0004003d,0x0000000a,0x00000013,0x0000000c,0x000500c7,
|
||||
0x0000000a,0x00000014,0x00000013,0x00000010,0x0004006f,0x00000006,0x00000015,0x00000014,
|
||||
0x00050050,0x00000007,0x00000016,0x00000012,0x00000015,0x0003003e,0x00000009,0x00000016,
|
||||
0x0004003d,0x00000007,0x00000019,0x00000009,0x0003003e,0x00000018,0x00000019,0x0004003d,
|
||||
0x00000007,0x00000022,0x00000009,0x0005008e,0x00000007,0x00000024,0x00000022,0x00000023,
|
||||
0x00050050,0x00000007,0x00000026,0x00000025,0x00000025,0x00050083,0x00000007,0x00000027,
|
||||
0x00000024,0x00000026,0x00050051,0x00000006,0x00000029,0x00000027,0x00000000,0x00050051,
|
||||
0x00000006,0x0000002a,0x00000027,0x00000001,0x00070050,0x0000001a,0x0000002b,0x00000029,
|
||||
0x0000002a,0x00000028,0x00000025,0x00050041,0x0000002c,0x0000002d,0x00000020,0x00000021,
|
||||
0x0003003e,0x0000002d,0x0000002b,0x000100fd,0x00010038,
|
||||
};
|
||||
static const uint32_t surface_composite_frag_spv[]={
|
||||
0x07230203,0x00010000,0x000d000a,0x00000153,0x00000000,0x00020011,0x00000001,0x00020011,
|
||||
0x00000032,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,
|
||||
0x00000000,0x00000001,0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000003a,
|
||||
0x00000151,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x000a0004,
|
||||
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,
|
||||
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,
|
||||
0x00657669,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x0000000e,0x61746f72,
|
||||
0x76286574,0x763b3466,0x003b3366,0x00030005,0x0000000c,0x00000071,0x00030005,0x0000000d,
|
||||
0x00000076,0x00050005,0x00000027,0x6e656373,0x78695065,0x00006c65,0x00050005,0x0000002c,
|
||||
0x6e656373,0x616d4965,0x00006567,0x00050005,0x00000038,0x6e656373,0x6f6f4365,0x00006472,
|
||||
0x00030005,0x0000003a,0x00007675,0x00040005,0x0000003f,0x61726150,0x0000736d,0x00060006,
|
||||
0x0000003f,0x00000000,0x61746f72,0x6e6f6974,0x00000000,0x00060006,0x0000003f,0x00000001,
|
||||
0x7074756f,0x61547475,0x0000736e,0x00060006,0x0000003f,0x00000002,0x65646976,0x6e61546f,
|
||||
0x00000073,0x00060006,0x0000003f,0x00000003,0x6e656373,0x63655265,0x00000074,0x00050006,
|
||||
0x0000003f,0x00000004,0x6974706f,0x00736e6f,0x00070006,0x0000003f,0x00000005,0x6e656373,
|
||||
0x74704f65,0x736e6f69,0x00000000,0x00060006,0x0000003f,0x00000006,0x6e656373,0x61635365,
|
||||
0x0000656c,0x00060006,0x0000003f,0x00000007,0x6e656373,0x61694265,0x00000073,0x00030005,
|
||||
0x00000041,0x00000070,0x00040005,0x00000057,0x6e656373,0x00565565,0x00040005,0x00000072,
|
||||
0x6e656373,0x00000065,0x00030005,0x0000007c,0x00796172,0x00040005,0x0000008e,0x61726170,
|
||||
0x0000006d,0x00040005,0x00000091,0x61726170,0x0000006d,0x00030005,0x00000093,0x00767576,
|
||||
0x00040005,0x000000ac,0x65646976,0x0000006f,0x00050005,0x000000c2,0x65646976,0x7869506f,
|
||||
0x00006c65,0x00050005,0x000000c6,0x65646976,0x616d496f,0x00006567,0x00050005,0x000000cd,
|
||||
0x65646976,0x6365526f,0x00000074,0x00040005,0x000000d2,0x65646976,0x0056556f,0x00040005,
|
||||
0x000000e9,0x68706c61,0x00000061,0x00030005,0x000000f4,0x00626772,0x00050005,0x00000103,
|
||||
0x6e656373,0x706c4165,0x00006168,0x00050005,0x0000010e,0x6e656373,0x42475265,0x00000000,
|
||||
0x00060005,0x0000011d,0x6e656373,0x72745365,0x68676961,0x00000074,0x00040005,0x0000013f,
|
||||
0x75736572,0x0000746c,0x00050005,0x00000151,0x7074756f,0x6f437475,0x00726f6c,0x00040047,
|
||||
0x0000002c,0x00000022,0x00000000,0x00040047,0x0000002c,0x00000021,0x00000001,0x00040047,
|
||||
0x0000003a,0x0000001e,0x00000000,0x00050048,0x0000003f,0x00000000,0x00000023,0x00000000,
|
||||
0x00050048,0x0000003f,0x00000001,0x00000023,0x00000010,0x00050048,0x0000003f,0x00000002,
|
||||
0x00000023,0x00000020,0x00050048,0x0000003f,0x00000003,0x00000023,0x00000030,0x00050048,
|
||||
0x0000003f,0x00000004,0x00000023,0x00000040,0x00050048,0x0000003f,0x00000005,0x00000023,
|
||||
0x00000050,0x00050048,0x0000003f,0x00000006,0x00000023,0x00000060,0x00050048,0x0000003f,
|
||||
0x00000007,0x00000023,0x00000070,0x00030047,0x0000003f,0x00000002,0x00040047,0x000000c6,
|
||||
0x00000022,0x00000000,0x00040047,0x000000c6,0x00000021,0x00000000,0x00040047,0x00000151,
|
||||
0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
|
||||
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,0x00000008,
|
||||
0x00000007,0x00000007,0x00040017,0x00000009,0x00000006,0x00000003,0x00040020,0x0000000a,
|
||||
0x00000007,0x00000009,0x00050021,0x0000000b,0x00000009,0x00000008,0x0000000a,0x0004002b,
|
||||
0x00000006,0x00000011,0x40000000,0x00040015,0x00000018,0x00000020,0x00000000,0x0004002b,
|
||||
0x00000018,0x00000019,0x00000003,0x00040020,0x0000001a,0x00000007,0x00000006,0x00040017,
|
||||
0x00000025,0x00000006,0x00000002,0x00040020,0x00000026,0x00000007,0x00000025,0x0004002b,
|
||||
0x00000006,0x00000028,0x3f000000,0x00090019,0x00000029,0x00000006,0x00000001,0x00000000,
|
||||
0x00000001,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000002a,0x00000029,0x00040020,
|
||||
0x0000002b,0x00000000,0x0000002a,0x0004003b,0x0000002b,0x0000002c,0x00000000,0x00040015,
|
||||
0x0000002e,0x00000020,0x00000001,0x0004002b,0x0000002e,0x0000002f,0x00000000,0x00040017,
|
||||
0x00000031,0x0000002e,0x00000003,0x00040017,0x00000033,0x0000002e,0x00000002,0x00040020,
|
||||
0x00000039,0x00000001,0x00000025,0x0004003b,0x00000039,0x0000003a,0x00000001,0x0004002b,
|
||||
0x00000018,0x0000003b,0x00000000,0x00040020,0x0000003c,0x00000001,0x00000006,0x000a001e,
|
||||
0x0000003f,0x00000007,0x00000007,0x00000007,0x00000007,0x00000007,0x00000007,0x00000007,
|
||||
0x00000007,0x00040020,0x00000040,0x00000009,0x0000003f,0x0004003b,0x00000040,0x00000041,
|
||||
0x00000009,0x0004002b,0x0000002e,0x00000042,0x00000005,0x0004002b,0x00000018,0x00000043,
|
||||
0x00000002,0x00040020,0x00000044,0x00000009,0x00000006,0x0004002b,0x00000006,0x00000047,
|
||||
0x00000000,0x00020014,0x00000048,0x0004002b,0x00000006,0x0000004d,0x3f800000,0x0004002b,
|
||||
0x00000018,0x0000004e,0x00000001,0x0004002b,0x0000002e,0x00000058,0x00000003,0x00040020,
|
||||
0x00000059,0x00000009,0x00000007,0x0004002b,0x0000002e,0x00000075,0x00000004,0x0004002b,
|
||||
0x0000002e,0x0000007d,0x00000001,0x0004002b,0x00000006,0x0000008c,0xbf800000,0x0004002b,
|
||||
0x0000002e,0x0000009b,0x00000002,0x0007002c,0x00000007,0x000000ad,0x00000047,0x00000047,
|
||||
0x00000047,0x00000047,0x0005002c,0x00000025,0x000000b4,0x00000047,0x00000047,0x00040017,
|
||||
0x000000b5,0x00000048,0x00000002,0x0005002c,0x00000025,0x000000bc,0x0000004d,0x0000004d,
|
||||
0x00090019,0x000000c3,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,
|
||||
0x00000000,0x0003001b,0x000000c4,0x000000c3,0x00040020,0x000000c5,0x00000000,0x000000c4,
|
||||
0x0004003b,0x000000c5,0x000000c6,0x00000000,0x0006002c,0x00000009,0x00000128,0x00000047,
|
||||
0x00000047,0x00000047,0x0004002b,0x0000002e,0x00000130,0x00000006,0x0004002b,0x0000002e,
|
||||
0x00000135,0x00000007,0x00040020,0x00000150,0x00000003,0x00000007,0x0004003b,0x00000150,
|
||||
0x00000151,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
|
||||
0x00000005,0x0004003b,0x00000026,0x00000027,0x00000007,0x0004003b,0x00000026,0x00000038,
|
||||
0x00000007,0x0004003b,0x0000001a,0x0000004a,0x00000007,0x0004003b,0x00000026,0x00000057,
|
||||
0x00000007,0x0004003b,0x00000008,0x00000072,0x00000007,0x0004003b,0x0000000a,0x0000007c,
|
||||
0x00000007,0x0004003b,0x00000008,0x0000008e,0x00000007,0x0004003b,0x0000000a,0x00000091,
|
||||
0x00000007,0x0004003b,0x00000026,0x00000093,0x00000007,0x0004003b,0x00000008,0x000000ac,
|
||||
0x00000007,0x0004003b,0x00000026,0x000000c2,0x00000007,0x0004003b,0x00000008,0x000000cd,
|
||||
0x00000007,0x0004003b,0x00000026,0x000000d2,0x00000007,0x0004003b,0x0000001a,0x000000e9,
|
||||
0x00000007,0x0004003b,0x0000001a,0x000000ed,0x00000007,0x0004003b,0x0000000a,0x000000f4,
|
||||
0x00000007,0x0004003b,0x0000000a,0x000000f8,0x00000007,0x0004003b,0x0000001a,0x00000103,
|
||||
0x00000007,0x0004003b,0x0000001a,0x00000107,0x00000007,0x0004003b,0x0000000a,0x0000010e,
|
||||
0x00000007,0x0004003b,0x0000000a,0x00000112,0x00000007,0x0004003b,0x00000008,0x0000011d,
|
||||
0x00000007,0x0004003b,0x0000000a,0x00000120,0x00000007,0x0004003b,0x00000008,0x0000013f,
|
||||
0x00000007,0x0004003d,0x0000002a,0x0000002d,0x0000002c,0x00040064,0x00000029,0x00000030,
|
||||
0x0000002d,0x00050067,0x00000031,0x00000032,0x00000030,0x0000002f,0x0007004f,0x00000033,
|
||||
0x00000034,0x00000032,0x00000032,0x00000000,0x00000001,0x0004006f,0x00000025,0x00000035,
|
||||
0x00000034,0x00050050,0x00000025,0x00000036,0x00000028,0x00000028,0x00050088,0x00000025,
|
||||
0x00000037,0x00000036,0x00000035,0x0003003e,0x00000027,0x00000037,0x00050041,0x0000003c,
|
||||
0x0000003d,0x0000003a,0x0000003b,0x0004003d,0x00000006,0x0000003e,0x0000003d,0x00060041,
|
||||
0x00000044,0x00000045,0x00000041,0x00000042,0x00000043,0x0004003d,0x00000006,0x00000046,
|
||||
0x00000045,0x000500ba,0x00000048,0x00000049,0x00000046,0x00000047,0x000300f7,0x0000004c,
|
||||
0x00000000,0x000400fa,0x00000049,0x0000004b,0x00000052,0x000200f8,0x0000004b,0x00050041,
|
||||
0x0000003c,0x0000004f,0x0000003a,0x0000004e,0x0004003d,0x00000006,0x00000050,0x0000004f,
|
||||
0x00050083,0x00000006,0x00000051,0x0000004d,0x00000050,0x0003003e,0x0000004a,0x00000051,
|
||||
0x000200f9,0x0000004c,0x000200f8,0x00000052,0x00050041,0x0000003c,0x00000053,0x0000003a,
|
||||
0x0000004e,0x0004003d,0x00000006,0x00000054,0x00000053,0x0003003e,0x0000004a,0x00000054,
|
||||
0x000200f9,0x0000004c,0x000200f8,0x0000004c,0x0004003d,0x00000006,0x00000055,0x0000004a,
|
||||
0x00050050,0x00000025,0x00000056,0x0000003e,0x00000055,0x0003003e,0x00000038,0x00000056,
|
||||
0x00050041,0x00000059,0x0000005a,0x00000041,0x00000058,0x0004003d,0x00000007,0x0000005b,
|
||||
0x0000005a,0x0007004f,0x00000025,0x0000005c,0x0000005b,0x0000005b,0x00000000,0x00000001,
|
||||
0x0004003d,0x00000025,0x0000005d,0x00000038,0x00050041,0x00000059,0x0000005e,0x00000041,
|
||||
0x00000058,0x0004003d,0x00000007,0x0000005f,0x0000005e,0x0007004f,0x00000025,0x00000060,
|
||||
0x0000005f,0x0000005f,0x00000002,0x00000003,0x00050085,0x00000025,0x00000061,0x0000005d,
|
||||
0x00000060,0x00050081,0x00000025,0x00000062,0x0000005c,0x00000061,0x00050041,0x00000059,
|
||||
0x00000063,0x00000041,0x00000058,0x0004003d,0x00000007,0x00000064,0x00000063,0x0007004f,
|
||||
0x00000025,0x00000065,0x00000064,0x00000064,0x00000000,0x00000001,0x0004003d,0x00000025,
|
||||
0x00000066,0x00000027,0x00050081,0x00000025,0x00000067,0x00000065,0x00000066,0x00050041,
|
||||
0x00000059,0x00000068,0x00000041,0x00000058,0x0004003d,0x00000007,0x00000069,0x00000068,
|
||||
0x0007004f,0x00000025,0x0000006a,0x00000069,0x00000069,0x00000000,0x00000001,0x00050041,
|
||||
0x00000059,0x0000006b,0x00000041,0x00000058,0x0004003d,0x00000007,0x0000006c,0x0000006b,
|
||||
0x0007004f,0x00000025,0x0000006d,0x0000006c,0x0000006c,0x00000002,0x00000003,0x00050081,
|
||||
0x00000025,0x0000006e,0x0000006a,0x0000006d,0x0004003d,0x00000025,0x0000006f,0x00000027,
|
||||
0x00050083,0x00000025,0x00000070,0x0000006e,0x0000006f,0x0008000c,0x00000025,0x00000071,
|
||||
0x00000001,0x0000002b,0x00000062,0x00000067,0x00000070,0x0003003e,0x00000057,0x00000071,
|
||||
0x0004003d,0x0000002a,0x00000073,0x0000002c,0x0004003d,0x00000025,0x00000074,0x00000057,
|
||||
0x00060041,0x00000044,0x00000076,0x00000041,0x00000075,0x0000004e,0x0004003d,0x00000006,
|
||||
0x00000077,0x00000076,0x00050051,0x00000006,0x00000078,0x00000074,0x00000000,0x00050051,
|
||||
0x00000006,0x00000079,0x00000074,0x00000001,0x00060050,0x00000009,0x0000007a,0x00000078,
|
||||
0x00000079,0x00000077,0x00070058,0x00000007,0x0000007b,0x00000073,0x0000007a,0x00000002,
|
||||
0x00000047,0x0003003e,0x00000072,0x0000007b,0x00060041,0x00000044,0x0000007e,0x00000041,
|
||||
0x0000007d,0x0000003b,0x0004003d,0x00000006,0x0000007f,0x0000007e,0x00060041,0x00000044,
|
||||
0x00000080,0x00000041,0x0000007d,0x0000004e,0x0004003d,0x00000006,0x00000081,0x00000080,
|
||||
0x00050041,0x0000003c,0x00000082,0x0000003a,0x0000003b,0x0004003d,0x00000006,0x00000083,
|
||||
0x00000082,0x0008000c,0x00000006,0x00000084,0x00000001,0x0000002e,0x0000007f,0x00000081,
|
||||
0x00000083,0x00060041,0x00000044,0x00000085,0x00000041,0x0000007d,0x00000019,0x0004003d,
|
||||
0x00000006,0x00000086,0x00000085,0x00060041,0x00000044,0x00000087,0x00000041,0x0000007d,
|
||||
0x00000043,0x0004003d,0x00000006,0x00000088,0x00000087,0x00050041,0x0000003c,0x00000089,
|
||||
0x0000003a,0x0000004e,0x0004003d,0x00000006,0x0000008a,0x00000089,0x0008000c,0x00000006,
|
||||
0x0000008b,0x00000001,0x0000002e,0x00000086,0x00000088,0x0000008a,0x00060050,0x00000009,
|
||||
0x0000008d,0x00000084,0x0000008b,0x0000008c,0x00050041,0x00000059,0x0000008f,0x00000041,
|
||||
0x0000002f,0x0004003d,0x00000007,0x00000090,0x0000008f,0x0003003e,0x0000008e,0x00000090,
|
||||
0x0003003e,0x00000091,0x0000008d,0x00060039,0x00000009,0x00000092,0x0000000e,0x0000008e,
|
||||
0x00000091,0x0003003e,0x0000007c,0x00000092,0x0004003d,0x00000009,0x00000094,0x0000007c,
|
||||
0x0007004f,0x00000025,0x00000095,0x00000094,0x00000094,0x00000000,0x00000001,0x00050041,
|
||||
0x0000001a,0x00000096,0x0000007c,0x00000043,0x0004003d,0x00000006,0x00000097,0x00000096,
|
||||
0x0004007f,0x00000006,0x00000098,0x00000097,0x00050050,0x00000025,0x00000099,0x00000098,
|
||||
0x00000098,0x00050088,0x00000025,0x0000009a,0x00000095,0x00000099,0x00050041,0x00000059,
|
||||
0x0000009c,0x00000041,0x0000009b,0x0004003d,0x00000007,0x0000009d,0x0000009c,0x0007004f,
|
||||
0x00000025,0x0000009e,0x0000009d,0x0000009d,0x00000000,0x00000002,0x00050083,0x00000025,
|
||||
0x0000009f,0x0000009a,0x0000009e,0x00050041,0x00000059,0x000000a0,0x00000041,0x0000009b,
|
||||
0x0004003d,0x00000007,0x000000a1,0x000000a0,0x0007004f,0x00000025,0x000000a2,0x000000a1,
|
||||
0x000000a1,0x00000001,0x00000003,0x00050041,0x00000059,0x000000a3,0x00000041,0x0000009b,
|
||||
0x0004003d,0x00000007,0x000000a4,0x000000a3,0x0007004f,0x00000025,0x000000a5,0x000000a4,
|
||||
0x000000a4,0x00000000,0x00000002,0x00050083,0x00000025,0x000000a6,0x000000a2,0x000000a5,
|
||||
0x00050088,0x00000025,0x000000a7,0x0000009f,0x000000a6,0x0003003e,0x00000093,0x000000a7,
|
||||
0x00050041,0x0000001a,0x000000a8,0x00000093,0x0000004e,0x0004003d,0x00000006,0x000000a9,
|
||||
0x000000a8,0x00050083,0x00000006,0x000000aa,0x0000004d,0x000000a9,0x00050041,0x0000001a,
|
||||
0x000000ab,0x00000093,0x0000004e,0x0003003e,0x000000ab,0x000000aa,0x0003003e,0x000000ac,
|
||||
0x000000ad,0x00050041,0x0000001a,0x000000ae,0x0000007c,0x00000043,0x0004003d,0x00000006,
|
||||
0x000000af,0x000000ae,0x000500b8,0x00000048,0x000000b0,0x000000af,0x00000047,0x000300f7,
|
||||
0x000000b2,0x00000000,0x000400fa,0x000000b0,0x000000b1,0x000000b2,0x000200f8,0x000000b1,
|
||||
0x0004003d,0x00000025,0x000000b3,0x00000093,0x000500be,0x000000b5,0x000000b6,0x000000b3,
|
||||
0x000000b4,0x0004009b,0x00000048,0x000000b7,0x000000b6,0x000200f9,0x000000b2,0x000200f8,
|
||||
0x000000b2,0x000700f5,0x00000048,0x000000b8,0x000000b0,0x0000004c,0x000000b7,0x000000b1,
|
||||
0x000300f7,0x000000ba,0x00000000,0x000400fa,0x000000b8,0x000000b9,0x000000ba,0x000200f8,
|
||||
0x000000b9,0x0004003d,0x00000025,0x000000bb,0x00000093,0x000500bc,0x000000b5,0x000000bd,
|
||||
0x000000bb,0x000000bc,0x0004009b,0x00000048,0x000000be,0x000000bd,0x000200f9,0x000000ba,
|
||||
0x000200f8,0x000000ba,0x000700f5,0x00000048,0x000000bf,0x000000b8,0x000000b2,0x000000be,
|
||||
0x000000b9,0x000300f7,0x000000c1,0x00000000,0x000400fa,0x000000bf,0x000000c0,0x000000c1,
|
||||
0x000200f8,0x000000c0,0x0004003d,0x000000c4,0x000000c7,0x000000c6,0x00040064,0x000000c3,
|
||||
0x000000c8,0x000000c7,0x00050067,0x00000033,0x000000c9,0x000000c8,0x0000002f,0x0004006f,
|
||||
0x00000025,0x000000ca,0x000000c9,0x00050050,0x00000025,0x000000cb,0x00000028,0x00000028,
|
||||
0x00050088,0x00000025,0x000000cc,0x000000cb,0x000000ca,0x0003003e,0x000000c2,0x000000cc,
|
||||
0x00060041,0x00000044,0x000000ce,0x00000041,0x00000075,0x0000003b,0x0004003d,0x00000006,
|
||||
0x000000cf,0x000000ce,0x00050085,0x00000006,0x000000d0,0x000000cf,0x00000028,0x00070050,
|
||||
0x00000007,0x000000d1,0x000000d0,0x00000047,0x00000028,0x0000004d,0x0003003e,0x000000cd,
|
||||
0x000000d1,0x0004003d,0x00000007,0x000000d3,0x000000cd,0x0007004f,0x00000025,0x000000d4,
|
||||
0x000000d3,0x000000d3,0x00000000,0x00000001,0x0004003d,0x00000025,0x000000d5,0x00000093,
|
||||
0x0004003d,0x00000007,0x000000d6,0x000000cd,0x0007004f,0x00000025,0x000000d7,0x000000d6,
|
||||
0x000000d6,0x00000002,0x00000003,0x00050085,0x00000025,0x000000d8,0x000000d5,0x000000d7,
|
||||
0x00050081,0x00000025,0x000000d9,0x000000d4,0x000000d8,0x0004003d,0x00000007,0x000000da,
|
||||
0x000000cd,0x0007004f,0x00000025,0x000000db,0x000000da,0x000000da,0x00000000,0x00000001,
|
||||
0x0004003d,0x00000025,0x000000dc,0x000000c2,0x00050081,0x00000025,0x000000dd,0x000000db,
|
||||
0x000000dc,0x0004003d,0x00000007,0x000000de,0x000000cd,0x0007004f,0x00000025,0x000000df,
|
||||
0x000000de,0x000000de,0x00000000,0x00000001,0x0004003d,0x00000007,0x000000e0,0x000000cd,
|
||||
0x0007004f,0x00000025,0x000000e1,0x000000e0,0x000000e0,0x00000002,0x00000003,0x00050081,
|
||||
0x00000025,0x000000e2,0x000000df,0x000000e1,0x0004003d,0x00000025,0x000000e3,0x000000c2,
|
||||
0x00050083,0x00000025,0x000000e4,0x000000e2,0x000000e3,0x0008000c,0x00000025,0x000000e5,
|
||||
0x00000001,0x0000002b,0x000000d9,0x000000dd,0x000000e4,0x0003003e,0x000000d2,0x000000e5,
|
||||
0x0004003d,0x000000c4,0x000000e6,0x000000c6,0x0004003d,0x00000025,0x000000e7,0x000000d2,
|
||||
0x00070058,0x00000007,0x000000e8,0x000000e6,0x000000e7,0x00000002,0x00000047,0x0003003e,
|
||||
0x000000ac,0x000000e8,0x000200f9,0x000000c1,0x000200f8,0x000000c1,0x00060041,0x00000044,
|
||||
0x000000ea,0x00000041,0x00000075,0x00000043,0x0004003d,0x00000006,0x000000eb,0x000000ea,
|
||||
0x000500ba,0x00000048,0x000000ec,0x000000eb,0x00000047,0x000300f7,0x000000ef,0x00000000,
|
||||
0x000400fa,0x000000ec,0x000000ee,0x000000f2,0x000200f8,0x000000ee,0x00050041,0x0000001a,
|
||||
0x000000f0,0x000000ac,0x00000019,0x0004003d,0x00000006,0x000000f1,0x000000f0,0x0003003e,
|
||||
0x000000ed,0x000000f1,0x000200f9,0x000000ef,0x000200f8,0x000000f2,0x0003003e,0x000000ed,
|
||||
0x0000004d,0x000200f9,0x000000ef,0x000200f8,0x000000ef,0x0004003d,0x00000006,0x000000f3,
|
||||
0x000000ed,0x0003003e,0x000000e9,0x000000f3,0x00060041,0x00000044,0x000000f5,0x00000041,
|
||||
0x00000075,0x00000019,0x0004003d,0x00000006,0x000000f6,0x000000f5,0x000500ba,0x00000048,
|
||||
0x000000f7,0x000000f6,0x00000047,0x000300f7,0x000000fa,0x00000000,0x000400fa,0x000000f7,
|
||||
0x000000f9,0x000000ff,0x000200f8,0x000000f9,0x0004003d,0x00000007,0x000000fb,0x000000ac,
|
||||
0x0008004f,0x00000009,0x000000fc,0x000000fb,0x000000fb,0x00000000,0x00000001,0x00000002,
|
||||
0x0004003d,0x00000006,0x000000fd,0x000000e9,0x0005008e,0x00000009,0x000000fe,0x000000fc,
|
||||
0x000000fd,0x0003003e,0x000000f8,0x000000fe,0x000200f9,0x000000fa,0x000200f8,0x000000ff,
|
||||
0x0004003d,0x00000007,0x00000100,0x000000ac,0x0008004f,0x00000009,0x00000101,0x00000100,
|
||||
0x00000100,0x00000000,0x00000001,0x00000002,0x0003003e,0x000000f8,0x00000101,0x000200f9,
|
||||
0x000000fa,0x000200f8,0x000000fa,0x0004003d,0x00000009,0x00000102,0x000000f8,0x0003003e,
|
||||
0x000000f4,0x00000102,0x00060041,0x00000044,0x00000104,0x00000041,0x00000042,0x0000003b,
|
||||
0x0004003d,0x00000006,0x00000105,0x00000104,0x000500ba,0x00000048,0x00000106,0x00000105,
|
||||
0x00000047,0x000300f7,0x00000109,0x00000000,0x000400fa,0x00000106,0x00000108,0x0000010c,
|
||||
0x000200f8,0x00000108,0x00050041,0x0000001a,0x0000010a,0x00000072,0x00000019,0x0004003d,
|
||||
0x00000006,0x0000010b,0x0000010a,0x0003003e,0x00000107,0x0000010b,0x000200f9,0x00000109,
|
||||
0x000200f8,0x0000010c,0x0003003e,0x00000107,0x0000004d,0x000200f9,0x00000109,0x000200f8,
|
||||
0x00000109,0x0004003d,0x00000006,0x0000010d,0x00000107,0x0003003e,0x00000103,0x0000010d,
|
||||
0x00060041,0x00000044,0x0000010f,0x00000041,0x00000042,0x0000004e,0x0004003d,0x00000006,
|
||||
0x00000110,0x0000010f,0x000500ba,0x00000048,0x00000111,0x00000110,0x00000047,0x000300f7,
|
||||
0x00000114,0x00000000,0x000400fa,0x00000111,0x00000113,0x00000119,0x000200f8,0x00000113,
|
||||
0x0004003d,0x00000007,0x00000115,0x00000072,0x0008004f,0x00000009,0x00000116,0x00000115,
|
||||
0x00000115,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000006,0x00000117,0x00000103,
|
||||
0x0005008e,0x00000009,0x00000118,0x00000116,0x00000117,0x0003003e,0x00000112,0x00000118,
|
||||
0x000200f9,0x00000114,0x000200f8,0x00000119,0x0004003d,0x00000007,0x0000011a,0x00000072,
|
||||
0x0008004f,0x00000009,0x0000011b,0x0000011a,0x0000011a,0x00000000,0x00000001,0x00000002,
|
||||
0x0003003e,0x00000112,0x0000011b,0x000200f9,0x00000114,0x000200f8,0x00000114,0x0004003d,
|
||||
0x00000009,0x0000011c,0x00000112,0x0003003e,0x0000010e,0x0000011c,0x0004003d,0x00000006,
|
||||
0x0000011e,0x00000103,0x000500ba,0x00000048,0x0000011f,0x0000011e,0x00000047,0x000300f7,
|
||||
0x00000122,0x00000000,0x000400fa,0x0000011f,0x00000121,0x00000127,0x000200f8,0x00000121,
|
||||
0x0004003d,0x00000009,0x00000123,0x0000010e,0x0004003d,0x00000006,0x00000124,0x00000103,
|
||||
0x00060050,0x00000009,0x00000125,0x00000124,0x00000124,0x00000124,0x00050088,0x00000009,
|
||||
0x00000126,0x00000123,0x00000125,0x0003003e,0x00000120,0x00000126,0x000200f9,0x00000122,
|
||||
0x000200f8,0x00000127,0x0003003e,0x00000120,0x00000128,0x000200f9,0x00000122,0x000200f8,
|
||||
0x00000122,0x0004003d,0x00000009,0x00000129,0x00000120,0x0004003d,0x00000006,0x0000012a,
|
||||
0x00000103,0x00050051,0x00000006,0x0000012b,0x00000129,0x00000000,0x00050051,0x00000006,
|
||||
0x0000012c,0x00000129,0x00000001,0x00050051,0x00000006,0x0000012d,0x00000129,0x00000002,
|
||||
0x00070050,0x00000007,0x0000012e,0x0000012b,0x0000012c,0x0000012d,0x0000012a,0x0003003e,
|
||||
0x0000011d,0x0000012e,0x0004003d,0x00000007,0x0000012f,0x0000011d,0x00050041,0x00000059,
|
||||
0x00000131,0x00000041,0x00000130,0x0004003d,0x00000007,0x00000132,0x00000131,0x0007000c,
|
||||
0x00000007,0x00000133,0x00000001,0x00000028,0x00000132,0x000000ad,0x00050085,0x00000007,
|
||||
0x00000134,0x0000012f,0x00000133,0x00050041,0x00000059,0x00000136,0x00000041,0x00000135,
|
||||
0x0004003d,0x00000007,0x00000137,0x00000136,0x00050081,0x00000007,0x00000138,0x00000134,
|
||||
0x00000137,0x0003003e,0x0000011d,0x00000138,0x00050041,0x0000001a,0x00000139,0x0000011d,
|
||||
0x00000019,0x0004003d,0x00000006,0x0000013a,0x00000139,0x0003003e,0x00000103,0x0000013a,
|
||||
0x0004003d,0x00000007,0x0000013b,0x0000011d,0x0008004f,0x00000009,0x0000013c,0x0000013b,
|
||||
0x0000013b,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000006,0x0000013d,0x00000103,
|
||||
0x0005008e,0x00000009,0x0000013e,0x0000013c,0x0000013d,0x0003003e,0x0000010e,0x0000013e,
|
||||
0x0004003d,0x00000009,0x00000140,0x000000f4,0x0004003d,0x00000009,0x00000141,0x0000010e,
|
||||
0x0004003d,0x00000006,0x00000142,0x000000e9,0x00050083,0x00000006,0x00000143,0x0000004d,
|
||||
0x00000142,0x0005008e,0x00000009,0x00000144,0x00000141,0x00000143,0x00050081,0x00000009,
|
||||
0x00000145,0x00000140,0x00000144,0x0004003d,0x00000006,0x00000146,0x000000e9,0x0004003d,
|
||||
0x00000006,0x00000147,0x00000103,0x0004003d,0x00000006,0x00000148,0x000000e9,0x00050083,
|
||||
0x00000006,0x00000149,0x0000004d,0x00000148,0x00050085,0x00000006,0x0000014a,0x00000147,
|
||||
0x00000149,0x00050081,0x00000006,0x0000014b,0x00000146,0x0000014a,0x00050051,0x00000006,
|
||||
0x0000014c,0x00000145,0x00000000,0x00050051,0x00000006,0x0000014d,0x00000145,0x00000001,
|
||||
0x00050051,0x00000006,0x0000014e,0x00000145,0x00000002,0x00070050,0x00000007,0x0000014f,
|
||||
0x0000014c,0x0000014d,0x0000014e,0x0000014b,0x0003003e,0x0000013f,0x0000014f,0x0004003d,
|
||||
0x00000007,0x00000152,0x0000013f,0x0003003e,0x00000151,0x00000152,0x000100fd,0x00010038,
|
||||
0x00050036,0x00000009,0x0000000e,0x00000000,0x0000000b,0x00030037,0x00000008,0x0000000c,
|
||||
0x00030037,0x0000000a,0x0000000d,0x000200f8,0x0000000f,0x0004003d,0x00000009,0x00000010,
|
||||
0x0000000d,0x0004003d,0x00000007,0x00000012,0x0000000c,0x0008004f,0x00000009,0x00000013,
|
||||
0x00000012,0x00000012,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000007,0x00000014,
|
||||
0x0000000c,0x0008004f,0x00000009,0x00000015,0x00000014,0x00000014,0x00000000,0x00000001,
|
||||
0x00000002,0x0004003d,0x00000009,0x00000016,0x0000000d,0x0007000c,0x00000009,0x00000017,
|
||||
0x00000001,0x00000044,0x00000015,0x00000016,0x00050041,0x0000001a,0x0000001b,0x0000000c,
|
||||
0x00000019,0x0004003d,0x00000006,0x0000001c,0x0000001b,0x0004003d,0x00000009,0x0000001d,
|
||||
0x0000000d,0x0005008e,0x00000009,0x0000001e,0x0000001d,0x0000001c,0x00050081,0x00000009,
|
||||
0x0000001f,0x00000017,0x0000001e,0x0007000c,0x00000009,0x00000020,0x00000001,0x00000044,
|
||||
0x00000013,0x0000001f,0x0005008e,0x00000009,0x00000021,0x00000020,0x00000011,0x00050081,
|
||||
0x00000009,0x00000022,0x00000010,0x00000021,0x000200fe,0x00000022,0x00010038,
|
||||
};
|
||||
@@ -1,331 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Decoder -> AImageReader -> fused GLES YUV conversion/projection -> shared RGBA
|
||||
// eye views -> Vulkan copy to the runtime. The original decoded image is not
|
||||
// downscaled or converted into a full-size intermediate. No picture readback or
|
||||
// CPU colour conversion; no YCbCr feature forced onto the application's device.
|
||||
// Published buffers are retained until the Vulkan fence completes. The full
|
||||
// panorama import path remains available to the independent reference fixture.
|
||||
static struct {
|
||||
media_status_t (*reader_new)(int32_t,int32_t,int32_t,uint64_t,int32_t,AImageReader**);
|
||||
media_status_t (*reader_window)(AImageReader*,ANativeWindow**);
|
||||
media_status_t (*reader_latest)(AImageReader*,AImage**);
|
||||
media_status_t (*reader_next)(AImageReader*,AImage**);
|
||||
media_status_t (*image_time)(const AImage*,int64_t*);
|
||||
void (*reader_delete)(AImageReader*);
|
||||
media_status_t (*image_buffer)(const AImage*,AHardwareBuffer**);
|
||||
void (*image_delete)(AImage*);
|
||||
int (*allocate)(const AHardwareBuffer_Desc*,AHardwareBuffer**);
|
||||
void (*describe)(const AHardwareBuffer*,AHardwareBuffer_Desc*);
|
||||
void (*release)(AHardwareBuffer*);
|
||||
jobject (*to_surface)(JNIEnv*,ANativeWindow*);
|
||||
PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC client;
|
||||
PFNEGLCREATEIMAGEKHRPROC create;
|
||||
PFNEGLDESTROYIMAGEKHRPROC destroy;
|
||||
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC bind;
|
||||
void (*finish)(void);
|
||||
PFN_vkGetAndroidHardwareBufferPropertiesANDROID properties;
|
||||
PFN_vkCreateImage create_image;
|
||||
PFN_vkDestroyImage destroy_image;
|
||||
PFN_vkAllocateMemory allocate_memory;
|
||||
PFN_vkFreeMemory free_memory;
|
||||
PFN_vkBindImageMemory bind_memory;
|
||||
PFN_vkCreateImageView create_view;
|
||||
PFN_vkDestroyImageView destroy_view;
|
||||
} sn;
|
||||
static int surf_native_load(void) {
|
||||
if(!vk.GetDeviceProcAddr)return 0;
|
||||
sn.properties=(PFN_vkGetAndroidHardwareBufferPropertiesANDROID)vk.GetDeviceProcAddr(vk.device,
|
||||
"vkGetAndroidHardwareBufferPropertiesANDROID");
|
||||
if(!sn.properties){LOG("surface_native: external-memory device extension unavailable");return 0;}
|
||||
void *media=dlopen("libmediandk.so",RTLD_NOW|RTLD_LOCAL);
|
||||
void *window=dlopen("libnativewindow.so",RTLD_NOW|RTLD_LOCAL);
|
||||
void *gles=dlopen("libGLESv3.so",RTLD_NOW|RTLD_LOCAL);
|
||||
if(!media || !window || !gles){LOG("surface_native: missing platform library: %s",dlerror());return 0;}
|
||||
#define SN_SYM(field,lib,name) *(void**)&sn.field=dlsym(lib,name);if(!sn.field){LOG("surface_native: missing %s",name);return 0;}
|
||||
SN_SYM(reader_new,media,"AImageReader_newWithUsage")
|
||||
SN_SYM(reader_window,media,"AImageReader_getWindow")
|
||||
SN_SYM(reader_latest,media,"AImageReader_acquireLatestImage")
|
||||
SN_SYM(reader_next,media,"AImageReader_acquireNextImage")
|
||||
SN_SYM(image_time,media,"AImage_getTimestamp")
|
||||
SN_SYM(reader_delete,media,"AImageReader_delete")
|
||||
SN_SYM(image_buffer,media,"AImage_getHardwareBuffer") SN_SYM(image_delete,media,"AImage_delete")
|
||||
SN_SYM(allocate,window,"AHardwareBuffer_allocate") SN_SYM(describe,window,"AHardwareBuffer_describe")
|
||||
SN_SYM(release,window,"AHardwareBuffer_release")
|
||||
#ifndef SURF_NATIVE_ALLOCATOR_TEST
|
||||
// A native GPU fixture has no Java VM; only the application needs this bridge.
|
||||
void *android=dlopen("libandroid.so",RTLD_NOW|RTLD_LOCAL);
|
||||
if(!android)return 0;
|
||||
SN_SYM(to_surface,android,"ANativeWindow_toSurface")
|
||||
#endif
|
||||
SN_SYM(finish,gles,"glFinish")
|
||||
#undef SN_SYM
|
||||
#define SN_VK(field,name) sn.field=(PFN_vk##name)vk.GetDeviceProcAddr(vk.device,"vk" #name);if(!sn.field)return 0;
|
||||
SN_VK(create_image,CreateImage) SN_VK(destroy_image,DestroyImage) SN_VK(allocate_memory,AllocateMemory)
|
||||
SN_VK(free_memory,FreeMemory) SN_VK(bind_memory,BindImageMemory)
|
||||
SN_VK(create_view,CreateImageView) SN_VK(destroy_view,DestroyImageView)
|
||||
#undef SN_VK
|
||||
void *egl=dlopen("libEGL.so",RTLD_NOW|RTLD_LOCAL);
|
||||
__eglMustCastToProperFunctionPointerType (*get)(const char*)=egl?
|
||||
(__eglMustCastToProperFunctionPointerType (*)(const char*))dlsym(egl,"eglGetProcAddress"):NULL;
|
||||
if(!get)return 0;
|
||||
sn.client=(PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC)get("eglGetNativeClientBufferANDROID");
|
||||
sn.create=(PFNEGLCREATEIMAGEKHRPROC)get("eglCreateImageKHR");
|
||||
sn.destroy=(PFNEGLDESTROYIMAGEKHRPROC)get("eglDestroyImageKHR");
|
||||
sn.bind=(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)get("glEGLImageTargetTexture2DOES");
|
||||
return sn.client && sn.create && sn.destroy && sn.bind;
|
||||
}
|
||||
static void surf_native_slot_destroy(surf_native_slot *slot) {
|
||||
if(slot->view)sn.destroy_view(vk.device,slot->view,NULL);
|
||||
if(slot->image)sn.destroy_image(vk.device,slot->image,NULL);
|
||||
if(slot->memory)sn.free_memory(vk.device,slot->memory,NULL);
|
||||
if(slot->buffer)sn.release(slot->buffer);
|
||||
slot->view=VK_NULL_HANDLE;slot->image=VK_NULL_HANDLE;slot->memory=VK_NULL_HANDLE;slot->buffer=NULL;
|
||||
}
|
||||
static int surf_native_allocate(surf_native_slot *slot,EGLDisplay display,uint32_t width,uint32_t height) {
|
||||
AHardwareBuffer_Desc desc={.width=width,.height=height,.layers=1,
|
||||
.format=AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM,
|
||||
.usage=AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE|AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT};
|
||||
if(sn.allocate(&desc,&slot->buffer))return 0;
|
||||
VkAndroidHardwareBufferFormatPropertiesANDROID format={VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID};
|
||||
VkAndroidHardwareBufferPropertiesANDROID props={VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID,&format};
|
||||
if(sn.properties(vk.device,slot->buffer,&props)!=VK_SUCCESS || format.format!=VK_FORMAT_R8G8B8A8_UNORM)goto fail;
|
||||
VkExternalMemoryImageCreateInfo external={VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,NULL,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID};
|
||||
VkImageCreateInfo image={VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,&external,0,VK_IMAGE_TYPE_2D,format.format,
|
||||
{width,height,1},1,1,VK_SAMPLE_COUNT_1_BIT,VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
|
||||
VK_SHARING_MODE_EXCLUSIVE,0,NULL,VK_IMAGE_LAYOUT_UNDEFINED};
|
||||
if(sn.create_image(vk.device,&image,NULL,&slot->image)!=VK_SUCCESS)goto fail;
|
||||
uint32_t type=0;while(type<32 && !(props.memoryTypeBits&(1u<<type)))type++;
|
||||
if(type==32)goto fail;
|
||||
VkImportAndroidHardwareBufferInfoANDROID imported={VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID,NULL,slot->buffer};
|
||||
VkMemoryDedicatedAllocateInfo dedicated={VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,&imported,slot->image,VK_NULL_HANDLE};
|
||||
VkMemoryAllocateInfo alloc={VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,&dedicated,props.allocationSize,type};
|
||||
if(sn.allocate_memory(vk.device,&alloc,NULL,&slot->memory)!=VK_SUCCESS ||
|
||||
sn.bind_memory(vk.device,slot->image,slot->memory,0)!=VK_SUCCESS)goto fail;
|
||||
VkImageViewCreateInfo view={VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,NULL,0,slot->image,VK_IMAGE_VIEW_TYPE_2D,
|
||||
format.format,{0,0,0,0},{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,1}};
|
||||
if(sn.create_view(vk.device,&view,NULL,&slot->view)!=VK_SUCCESS)goto fail;
|
||||
slot->egl_image=sn.create(display,EGL_NO_CONTEXT,EGL_NATIVE_BUFFER_ANDROID,sn.client(slot->buffer),NULL);
|
||||
if(slot->egl_image==EGL_NO_IMAGE_KHR)goto fail;
|
||||
p_glGenTextures(1,&slot->texture);p_glBindTexture(GL_TEXTURE_2D,slot->texture);
|
||||
sn.bind(GL_TEXTURE_2D,slot->egl_image);
|
||||
slot->width=width;slot->height=height;
|
||||
return p_glGetError()==GL_NO_ERROR;
|
||||
fail:
|
||||
surf_native_slot_destroy(slot);return 0;
|
||||
}
|
||||
// Runs on the surface worker's EGL context. The pose snapshot is published
|
||||
// together with the completed image, so the compositor can timewarp correctly.
|
||||
static void surf_video_draw(GLuint program,const GLint uniforms[8],GLuint external,
|
||||
const surf_video_job *job) {
|
||||
p_glUseProgram(program);p_glActiveTexture(GL_TEXTURE0);p_glBindTexture(GL_TEXTURE_EXTERNAL_OES,external);
|
||||
for(int eye=0;eye<2;eye++){
|
||||
p_glViewport((GLint)(eye*job->size),0,(GLsizei)job->size,(GLsizei)job->size);
|
||||
for(int i=0;i<8;i++){
|
||||
const float *v=job->params[eye]+4*i;
|
||||
p_glUniform4f(uniforms[i],v[0],v[1],v[2],v[3]);
|
||||
}
|
||||
p_glDrawArrays(GL_TRIANGLES,0,3);
|
||||
}
|
||||
}
|
||||
#if !defined(SURF_NATIVE_ALLOCATOR_TEST) || defined(SURF_NATIVE_WORKER_TEST)
|
||||
static void surf_native_worker(surf_swapchain *s,JNIEnv *env,EGLDisplay display) {
|
||||
AImageReader *reader=NULL;ANativeWindow *window=NULL;
|
||||
GLuint program=0,external=0,fbo=0,vao=0;
|
||||
enum {PENDING_IMAGES=4,ACQUIRED_IMAGES=5};
|
||||
AImage *held=NULL,*pending[PENDING_IMAGES]={0};int64_t pending_time[PENDING_IMAGES]={0};int pending_count=0;
|
||||
EGLImageKHR input=EGL_NO_IMAGE_KHR;
|
||||
AHardwareBuffer_Desc desc={0};uint64_t last_job=0;GLint uniforms[8]={0};
|
||||
int64_t source_time=0;
|
||||
surf_video_job rendered_job={0};int video_dirty=0;
|
||||
#ifdef SURF_NATIVE_WORKER_TEST
|
||||
// A native fixture supplies the real reader/codec without a Java VM.
|
||||
(void)env;reader=surf_worker_test_reader;
|
||||
#else
|
||||
if(sn.reader_new((int32_t)s->width,(int32_t)s->height,AIMAGE_FORMAT_PRIVATE,
|
||||
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE,s->native_project?ACQUIRED_IMAGES:3,&reader)!=AMEDIA_OK ||
|
||||
sn.reader_window(reader,&window)!=AMEDIA_OK)goto fail;
|
||||
jobject local=sn.to_surface(env,window);
|
||||
if(!local || (*env)->ExceptionCheck(env)){(*env)->ExceptionClear(env);goto fail;}
|
||||
s->surface=(*env)->NewGlobalRef(env,local);(*env)->DeleteLocalRef(env,local);
|
||||
if(!s->surface)goto fail;
|
||||
#endif
|
||||
const char *fragment="#version 300 es\n#extension GL_OES_EGL_image_external_essl3 : require\n"
|
||||
"precision highp float;uniform samplerExternalOES tex;in vec2 uv;out vec4 color;"
|
||||
"void main(){color=texture(tex,uv);}";
|
||||
GLuint vertex=emul_compile(GL_VERTEX_SHADER,"",surf_vs),pixel=emul_compile(GL_FRAGMENT_SHADER,"",
|
||||
s->native_project?surf_video_fragment:fragment);
|
||||
if(!vertex || !pixel)goto fail;
|
||||
program=p_glCreateProgram();p_glAttachShader(program,vertex);p_glAttachShader(program,pixel);p_glLinkProgram(program);
|
||||
GLint ok=0;p_glGetProgramiv(program,GL_LINK_STATUS,&ok);if(!ok)goto fail;
|
||||
if(s->native_project)for(int i=0;i<8;i++)uniforms[i]=p_glGetUniformLocation(program,surf_video_uniforms[i]);
|
||||
p_glGenTextures(1,&external);p_glBindTexture(GL_TEXTURE_EXTERNAL_OES,external);
|
||||
s_glTexParameteri(GL_TEXTURE_EXTERNAL_OES,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||
s_glTexParameteri(GL_TEXTURE_EXTERNAL_OES,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||
s_glTexParameteri(GL_TEXTURE_EXTERNAL_OES,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
|
||||
s_glTexParameteri(GL_TEXTURE_EXTERNAL_OES,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
|
||||
p_glGenFramebuffers(1,&fbo);p_glGenVertexArrays(1,&vao);
|
||||
pthread_mutex_lock(&surf_lock);s->ready=1;pthread_cond_broadcast(&surf_cond);pthread_mutex_unlock(&surf_lock);
|
||||
LOG("surface_native: shared GPU video surface ready (%s)",s->native_project?"fused visible-view conversion":"full panorama");
|
||||
int64_t start=0,frames=0,views=0,draw_ns=0,reused=0,held_views=0,anchored_views=0,recentred_views=0;
|
||||
while(!s->stop){
|
||||
int index=-1;
|
||||
surf_video_job job;
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
if(s->video_job.seq==last_job && !s->stop){
|
||||
struct timespec until;clock_gettime(CLOCK_REALTIME,&until);until.tv_nsec+=1000000;
|
||||
if(until.tv_nsec>=1000000000){until.tv_sec++;until.tv_nsec-=1000000000;}
|
||||
pthread_cond_timedwait(&surf_cond,&surf_lock,&until);
|
||||
}
|
||||
job=s->video_job;
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++)if(s->native_slots[i].state==0){index=i;s->native_slots[i].state=1;break;}
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if(index<0){struct timespec pause={0,250000};nanosleep(&pause,NULL);continue;}
|
||||
surf_native_slot *slot=&s->native_slots[index];
|
||||
AImage *image=NULL;
|
||||
if(s->native_project){
|
||||
// Acquire future pictures promptly: leaving them in a droppable
|
||||
// producer queue loses pictures before their presentation time.
|
||||
// Keep at most four future pictures plus the currently sampled one.
|
||||
int64_t now=monotonic_ns(),target=surf_video_target(now,job.time);
|
||||
while(pending_count && !surf_video_future(pending_time[0],now,target)){
|
||||
if(image)sn.image_delete(image);
|
||||
image=pending[0];pending_count--;
|
||||
memmove(pending,pending+1,pending_count*sizeof(*pending));
|
||||
memmove(pending_time,pending_time+1,pending_count*sizeof(*pending_time));
|
||||
}
|
||||
while(pending_count<PENDING_IMAGES && pending_count+(held!=NULL)+(image!=NULL)<ACQUIRED_IMAGES){
|
||||
AImage *next=NULL;if(sn.reader_next(reader,&next)!=AMEDIA_OK)break;
|
||||
int64_t timestamp=0;sn.image_time(next,×tamp);
|
||||
if(surf_video_future(timestamp,now,target)){
|
||||
pending[pending_count]=next;pending_time[pending_count++]=timestamp;
|
||||
}else{
|
||||
if(image)sn.image_delete(image);image=next;
|
||||
}
|
||||
}
|
||||
}else sn.reader_latest(reader,&image);
|
||||
int new_image=image!=NULL;
|
||||
if(new_image){
|
||||
// Keep the decoder image acquired while GLES might sample it again
|
||||
// for head movement. Releasing it sooner lets the decoder overwrite it.
|
||||
if(input!=EGL_NO_IMAGE_KHR)sn.destroy(display,input);
|
||||
if(held)sn.image_delete(held);
|
||||
held=image;input=EGL_NO_IMAGE_KHR;
|
||||
sn.image_time(held,&source_time);
|
||||
AHardwareBuffer *buffer=NULL;
|
||||
int valid=sn.image_buffer(held,&buffer)==AMEDIA_OK;
|
||||
if(valid)sn.describe(buffer,&desc);
|
||||
if(!valid || !desc.width || !desc.height || desc.width>8192 || desc.height>8192)goto fail;
|
||||
input=sn.create(display,EGL_NO_CONTEXT,EGL_NATIVE_BUFFER_ANDROID,sn.client(buffer),NULL);
|
||||
if(input==EGL_NO_IMAGE_KHR)goto fail;
|
||||
p_glActiveTexture(GL_TEXTURE0);p_glBindTexture(GL_TEXTURE_EXTERNAL_OES,external);sn.bind(GL_TEXTURE_EXTERNAL_OES,input);
|
||||
frames++;video_dirty=1;
|
||||
}
|
||||
// Importing/acquiring a decoder buffer can take time. Pick the newest
|
||||
// request immediately before drawing instead of keeping the earlier pose.
|
||||
pthread_mutex_lock(&surf_lock);job=s->video_job;pthread_mutex_unlock(&surf_lock);
|
||||
// Coalesce video arrivals into the next application view request. Drawing
|
||||
// on both clocks would do up to video-fps + headset-fps work per second.
|
||||
if(!held || (s->native_project?(!job.size || job.seq==last_job):!new_image)){
|
||||
pthread_mutex_lock(&surf_lock);slot->state=0;pthread_mutex_unlock(&surf_lock);continue;
|
||||
}
|
||||
if(s->native_project && !video_dirty && surf_video_covers(&rendered_job,&job)){
|
||||
last_job=job.seq;reused++;
|
||||
pthread_mutex_lock(&surf_lock);slot->state=0;pthread_mutex_unlock(&surf_lock);continue;
|
||||
}
|
||||
uint32_t width=s->native_project?2*job.size:desc.width,height=s->native_project?job.size:desc.height;
|
||||
if(!slot->buffer || slot->width!=width || slot->height!=height){
|
||||
if(slot->texture)p_glDeleteTextures(1,&slot->texture);
|
||||
if(slot->egl_image)sn.destroy(display,slot->egl_image);
|
||||
slot->texture=0;slot->egl_image=EGL_NO_IMAGE_KHR;surf_native_slot_destroy(slot);
|
||||
if(!surf_native_allocate(slot,display,width,height))goto fail;
|
||||
LOG("surface_native: %ux%u decoded input -> %ux%u shared view",desc.width,desc.height,width,height);
|
||||
}
|
||||
p_glBindFramebuffer(GL_FRAMEBUFFER,fbo);
|
||||
p_glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,slot->texture,0);
|
||||
if(p_glCheckFramebufferStatus(GL_FRAMEBUFFER)!=GL_FRAMEBUFFER_COMPLETE)goto fail;
|
||||
p_glUseProgram(program);p_glUniform1i(p_glGetUniformLocation(program,"tex"),0);p_glBindVertexArray(vao);
|
||||
int64_t draw_start=monotonic_ns();
|
||||
surf_video_job draw=job;
|
||||
if(s->native_project){
|
||||
if(surf_video_anchor(&rendered_job,&job,&draw))anchored_views++;
|
||||
else recentred_views++;
|
||||
surf_video_draw(program,uniforms,external,&draw);
|
||||
}
|
||||
else {p_glViewport(0,0,(GLsizei)width,(GLsizei)height);p_glDrawArrays(GL_TRIANGLES,0,3);}
|
||||
sn.finish(); // external writes completed before the Vulkan ownership acquire
|
||||
if(!video_dirty)held_views++;
|
||||
draw_ns+=monotonic_ns()-draw_start;views++;last_job=job.seq;rendered_job=draw;video_dirty=0;
|
||||
GLenum error=p_glGetError();
|
||||
if(error)goto fail;
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++)if(s->native_slots[i].state==2)s->native_slots[i].state=0;
|
||||
slot->video=draw;slot->projected=s->native_project;slot->source_width=desc.width;slot->source_height=desc.height;
|
||||
slot->source_time=source_time;
|
||||
slot->seq=++s->seq;slot->state=2;s->frames++;
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
int64_t now=monotonic_ns();if(!start)start=now;
|
||||
if(now-start>5000000000ll){LOG("surface_native: %.1f video frames/s, %.1f views/s, visible-view GPU wait %.2f ms, no picture readback",
|
||||
frames*1e9/(now-start),views*1e9/(now-start),views?draw_ns/1e6/views:0);
|
||||
if(s->native_project)LOG("surface_native: held-picture redraws=%lld, compositor reuse=%lld, panorama radius=%.3f",
|
||||
(long long)held_views,(long long)reused,job.params[0][7]);
|
||||
if(s->native_project)LOG("surface_native: fixed sampling grid=%lld views, recentered=%lld views",
|
||||
(long long)anchored_views,(long long)recentred_views);
|
||||
frames=views=draw_ns=reused=held_views=anchored_views=recentred_views=0;start=now;}
|
||||
}
|
||||
goto done;
|
||||
fail:
|
||||
surf_fail(s,"shared GPU video initialization/delivery failed");
|
||||
done:
|
||||
sn.finish();
|
||||
if(input!=EGL_NO_IMAGE_KHR)sn.destroy(display,input);
|
||||
if(held)sn.image_delete(held);
|
||||
for(int i=0;i<pending_count;i++)sn.image_delete(pending[i]);
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++){
|
||||
surf_native_slot *slot=&s->native_slots[i];
|
||||
if(slot->texture)p_glDeleteTextures(1,&slot->texture);
|
||||
if(slot->egl_image)sn.destroy(display,slot->egl_image);
|
||||
slot->texture=0;slot->egl_image=EGL_NO_IMAGE_KHR;
|
||||
}
|
||||
if(external)p_glDeleteTextures(1,&external);if(fbo)p_glDeleteFramebuffers(1,&fbo);
|
||||
if(reader)sn.reader_delete(reader);
|
||||
}
|
||||
#endif
|
||||
static void surf_native_complete(surf_swapchain *s) {
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
if(s->native_pending>=0)s->native_slots[s->native_pending].state=0;
|
||||
s->native_pending=-1;pthread_mutex_unlock(&surf_lock);
|
||||
}
|
||||
static void surf_native_ownership(VkCommandBuffer command,surf_native_slot *slot,int acquire) {
|
||||
VkAccessFlags access=slot->projected?VK_ACCESS_TRANSFER_READ_BIT:VK_ACCESS_SHADER_READ_BIT;
|
||||
VkImageLayout layout=slot->projected?VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
VkImageMemoryBarrier barrier={VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,NULL,
|
||||
acquire?0:access,acquire?access:0,
|
||||
acquire?VK_IMAGE_LAYOUT_GENERAL:layout,
|
||||
acquire?layout:VK_IMAGE_LAYOUT_GENERAL,
|
||||
acquire?VK_QUEUE_FAMILY_FOREIGN_EXT:vk.family,acquire?vk.family:VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||
slot->image,{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,1}};
|
||||
vk.CmdPipelineBarrier(command,VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
0,0,NULL,0,NULL,1,&barrier);
|
||||
}
|
||||
static void surf_native_retire(surf_swapchain *s) {
|
||||
if(!s->native_mode || s->native_current<0)return;
|
||||
// Teardown is the only blocking handoff. The worker is stopped before a
|
||||
// swapchain is destroyed, so it cannot rewrite an image being retired.
|
||||
VkCommandBufferBeginInfo begin={VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,NULL,
|
||||
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,NULL};
|
||||
vk.ResetCommandBuffer(s->cmd,0);vk.BeginCommandBuffer(s->cmd,&begin);
|
||||
surf_native_ownership(s->cmd,&s->native_slots[s->native_current],0);
|
||||
vk.EndCommandBuffer(s->cmd);
|
||||
VkSubmitInfo submit={VK_STRUCTURE_TYPE_SUBMIT_INFO,NULL,0,NULL,NULL,1,&s->cmd,0,NULL};
|
||||
if(vk.QueueSubmit(vk.queue,1,&submit,s->fence)==VK_SUCCESS){
|
||||
vk.WaitForFences(vk.device,1,&s->fence,VK_TRUE,UINT64_MAX);vk.ResetFences(vk.device,1,&s->fence);
|
||||
}
|
||||
pthread_mutex_lock(&surf_lock);s->native_slots[s->native_current].state=0;
|
||||
s->native_current=-1;pthread_mutex_unlock(&surf_lock);
|
||||
}
|
||||
static void surf_native_destroy(surf_swapchain *s) {
|
||||
if(!s->native_mode)return;
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++)surf_native_slot_destroy(&s->native_slots[i]);
|
||||
}
|
||||
@@ -1,511 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Vulkan presentation for equirectangular Android video surfaces. The decoder's
|
||||
// native GPU path projects directly from YUV on the surface worker, then copies
|
||||
// the finished stereo view into a runtime swapchain. CPU-delivered/reference
|
||||
// panoramas use a compute shader. No unsupported equirect layer reaches runtime.
|
||||
#include "surface_projection_spv.h"
|
||||
typedef struct {
|
||||
XrSwapchain output;
|
||||
VkImage images[MAX_IMAGES], source, rendered, video_cache;
|
||||
VkImageView rendered_view, source_view, video_cache_view;
|
||||
VkDeviceMemory memory, rendered_memory, video_cache_memory;
|
||||
VkSampler sampler;
|
||||
VkDescriptorPool descriptors;
|
||||
VkDescriptorSetLayout set_layout;
|
||||
VkDescriptorSet set;
|
||||
VkPipelineLayout layout;
|
||||
VkPipeline pipeline;
|
||||
uint32_t count, size, width, height, acquired_index;
|
||||
int acquired;
|
||||
XrTime presented_time;
|
||||
XrTime tracking_log_time;
|
||||
uint64_t source_seq;
|
||||
int source_ready, ready, view_source, occludes, cache_ready;
|
||||
XrCompositionLayerProjection layer;
|
||||
XrCompositionLayerProjectionView eyes[2];
|
||||
surf_video_job presented_job, cached_job;
|
||||
} surf_projection;
|
||||
static surf_projection surf_projections[SURF_MAX];
|
||||
static struct {
|
||||
#define SP_FN(name) PFN_vk##name name;
|
||||
SP_FN(CreateImage) SP_FN(DestroyImage) SP_FN(GetImageMemoryRequirements) SP_FN(BindImageMemory)
|
||||
SP_FN(CreateImageView) SP_FN(DestroyImageView) SP_FN(CreateSampler) SP_FN(DestroySampler)
|
||||
SP_FN(CreateDescriptorSetLayout) SP_FN(DestroyDescriptorSetLayout) SP_FN(CreateDescriptorPool)
|
||||
SP_FN(DestroyDescriptorPool) SP_FN(AllocateDescriptorSets) SP_FN(UpdateDescriptorSets)
|
||||
SP_FN(CreatePipelineLayout) SP_FN(DestroyPipelineLayout) SP_FN(CreateShaderModule) SP_FN(DestroyShaderModule)
|
||||
SP_FN(CreateRenderPass) SP_FN(DestroyRenderPass) SP_FN(CreateFramebuffer) SP_FN(DestroyFramebuffer)
|
||||
SP_FN(CreateGraphicsPipelines) SP_FN(CmdBeginRenderPass) SP_FN(CmdEndRenderPass)
|
||||
SP_FN(CmdSetViewport) SP_FN(CmdSetScissor) SP_FN(CmdDraw)
|
||||
SP_FN(CreateComputePipelines) SP_FN(DestroyPipeline) SP_FN(CmdBindPipeline) SP_FN(CmdBindDescriptorSets)
|
||||
SP_FN(CmdPushConstants) SP_FN(CmdDispatch) SP_FN(CmdCopyImage) SP_FN(FreeMemory)
|
||||
#undef SP_FN
|
||||
int ready;
|
||||
} spvk;
|
||||
static int surf_projection_functions(void) {
|
||||
if(spvk.ready)return spvk.ready>0;
|
||||
spvk.ready=-1;
|
||||
#define SP_LOAD(name) spvk.name=(PFN_vk##name)vk.GetDeviceProcAddr(vk.device,"vk" #name); if(!spvk.name)return 0;
|
||||
SP_LOAD(CreateImage) SP_LOAD(DestroyImage) SP_LOAD(GetImageMemoryRequirements) SP_LOAD(BindImageMemory)
|
||||
SP_LOAD(CreateImageView) SP_LOAD(DestroyImageView) SP_LOAD(CreateSampler) SP_LOAD(DestroySampler)
|
||||
SP_LOAD(CreateDescriptorSetLayout) SP_LOAD(DestroyDescriptorSetLayout) SP_LOAD(CreateDescriptorPool)
|
||||
SP_LOAD(DestroyDescriptorPool) SP_LOAD(AllocateDescriptorSets) SP_LOAD(UpdateDescriptorSets)
|
||||
SP_LOAD(CreatePipelineLayout) SP_LOAD(DestroyPipelineLayout) SP_LOAD(CreateShaderModule) SP_LOAD(DestroyShaderModule)
|
||||
SP_LOAD(CreateRenderPass) SP_LOAD(DestroyRenderPass) SP_LOAD(CreateFramebuffer) SP_LOAD(DestroyFramebuffer)
|
||||
SP_LOAD(CreateGraphicsPipelines) SP_LOAD(CmdBeginRenderPass) SP_LOAD(CmdEndRenderPass)
|
||||
SP_LOAD(CmdSetViewport) SP_LOAD(CmdSetScissor) SP_LOAD(CmdDraw)
|
||||
SP_LOAD(CreateComputePipelines) SP_LOAD(DestroyPipeline) SP_LOAD(CmdBindPipeline) SP_LOAD(CmdBindDescriptorSets)
|
||||
SP_LOAD(CmdPushConstants) SP_LOAD(CmdDispatch) SP_LOAD(CmdCopyImage) SP_LOAD(FreeMemory)
|
||||
#undef SP_LOAD
|
||||
spvk.ready=1;return 1;
|
||||
}
|
||||
// All images belong to the session device; failures leave cleanup-safe handles.
|
||||
static int surf_private_image(uint32_t width,uint32_t height,uint32_t layers,VkFormat format,
|
||||
VkImageUsageFlags usage,VkImage *image,VkDeviceMemory *memory,VkImageView *view) {
|
||||
VkImageCreateInfo ci={VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,NULL,0,VK_IMAGE_TYPE_2D,format,
|
||||
{width,height,1},1,layers,VK_SAMPLE_COUNT_1_BIT,VK_IMAGE_TILING_OPTIMAL,usage,VK_SHARING_MODE_EXCLUSIVE};
|
||||
if(spvk.CreateImage(vk.device,&ci,NULL,image)!=VK_SUCCESS)return 0;
|
||||
VkMemoryRequirements req;spvk.GetImageMemoryRequirements(vk.device,*image,&req);
|
||||
VkPhysicalDeviceMemoryProperties props;svk.GetPhysicalDeviceMemoryProperties(vk.physical,&props);
|
||||
uint32_t type=UINT32_MAX;
|
||||
for(uint32_t i=0;i<props.memoryTypeCount;i++)if((req.memoryTypeBits&(1u<<i)) &&
|
||||
(props.memoryTypes[i].propertyFlags&VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)){type=i;break;}
|
||||
if(type==UINT32_MAX)return 0;
|
||||
VkMemoryAllocateInfo alloc={VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,NULL,req.size,type};
|
||||
if(svk.AllocateMemory(vk.device,&alloc,NULL,memory)!=VK_SUCCESS ||
|
||||
spvk.BindImageMemory(vk.device,*image,*memory,0)!=VK_SUCCESS)return 0;
|
||||
VkImageViewCreateInfo vi={VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,NULL,0,*image,
|
||||
layers>1?VK_IMAGE_VIEW_TYPE_2D_ARRAY:VK_IMAGE_VIEW_TYPE_2D,format,{0,0,0,0},
|
||||
{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,layers}};
|
||||
return spvk.CreateImageView(vk.device,&vi,NULL,view)==VK_SUCCESS;
|
||||
}
|
||||
static void surf_composite_destroy(surf_projection *p);
|
||||
static int surf_composite_active(surf_projection *p);
|
||||
static int surf_composite_candidate(const XrFrameEndInfo *info,const XrCompositionLayerBaseHeader *video);
|
||||
static int surf_composite_cached_only(const XrFrameEndInfo *info,surf_projection *p,const surf_video_job *rendered,const surf_video_job *current);
|
||||
static void surf_projection_destroy(surf_swapchain *s) {
|
||||
surf_projection *p=&surf_projections[s-surfs];
|
||||
if(!spvk.ready || spvk.ready<0)return;
|
||||
if(s->in_flight) {
|
||||
vk.WaitForFences(vk.device,1,&s->fence,VK_TRUE,UINT64_MAX);
|
||||
vk.ResetFences(vk.device,1,&s->fence);s->in_flight=0;
|
||||
}
|
||||
surf_native_complete(s);
|
||||
surf_native_retire(s);
|
||||
surf_composite_destroy(p);
|
||||
if(p->video_cache_view)spvk.DestroyImageView(vk.device,p->video_cache_view,NULL);
|
||||
if(p->video_cache)spvk.DestroyImage(vk.device,p->video_cache,NULL);
|
||||
if(p->video_cache_memory)spvk.FreeMemory(vk.device,p->video_cache_memory,NULL);
|
||||
if(p->rendered_view)spvk.DestroyImageView(vk.device,p->rendered_view,NULL);
|
||||
if(p->rendered)spvk.DestroyImage(vk.device,p->rendered,NULL);
|
||||
if(p->rendered_memory)spvk.FreeMemory(vk.device,p->rendered_memory,NULL);
|
||||
if(p->pipeline)spvk.DestroyPipeline(vk.device,p->pipeline,NULL);
|
||||
if(p->layout)spvk.DestroyPipelineLayout(vk.device,p->layout,NULL);
|
||||
if(p->descriptors)spvk.DestroyDescriptorPool(vk.device,p->descriptors,NULL);
|
||||
if(p->set_layout)spvk.DestroyDescriptorSetLayout(vk.device,p->set_layout,NULL);
|
||||
if(p->sampler)spvk.DestroySampler(vk.device,p->sampler,NULL);
|
||||
if(p->source_view)spvk.DestroyImageView(vk.device,p->source_view,NULL);
|
||||
if(p->source)spvk.DestroyImage(vk.device,p->source,NULL);
|
||||
if(p->memory)spvk.FreeMemory(vk.device,p->memory,NULL);
|
||||
if(p->output) {
|
||||
PFN_xrDestroySwapchain destroy=(PFN_xrDestroySwapchain)lookup(active_instance,"xrDestroySwapchain");
|
||||
if(destroy)destroy(p->output);
|
||||
}
|
||||
memset(p,0,sizeof(*p));
|
||||
}
|
||||
static int surf_projection_setup(XrSession session,surf_swapchain *s,surf_projection *p,uint32_t width,uint32_t height) {
|
||||
if(p->pipeline || (s->native_project && p->output))return 1;
|
||||
if(!surf_vk_ready() || !surf_staging(s) || !surf_projection_functions())return 0;
|
||||
const char *stage="runtime swapchain";
|
||||
p->size=equirect_res>=512 && equirect_res<=4096?(uint32_t)equirect_res:1536;
|
||||
if(s->native_mode && !equirect_res_set)p->size=2560;
|
||||
p->width=width;p->height=height;
|
||||
XrSwapchainCreateInfo ci={XR_TYPE_SWAPCHAIN_CREATE_INFO,NULL,0,
|
||||
XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT|XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT|XR_SWAPCHAIN_USAGE_SAMPLED_BIT,
|
||||
VK_FORMAT_R8G8B8A8_SRGB,1,2*p->size,p->size,1,1,1};
|
||||
PFN_xrCreateSwapchain create=(PFN_xrCreateSwapchain)lookup(active_instance,"xrCreateSwapchain");
|
||||
PFN_xrEnumerateSwapchainImages enumerate=(PFN_xrEnumerateSwapchainImages)lookup(active_instance,"xrEnumerateSwapchainImages");
|
||||
if(!create || !enumerate)goto fail;
|
||||
XrResult xr_result=create(session,&ci,&p->output);
|
||||
if(XR_FAILED(xr_result)) {
|
||||
static int create_failures;
|
||||
if(create_failures++<5)LOG("surface_projection: swapchain creation result=%d",xr_result);
|
||||
goto fail;
|
||||
}
|
||||
stage="runtime image enumeration";
|
||||
XrSwapchainImageVulkanKHR images[MAX_IMAGES];
|
||||
for(int i=0;i<MAX_IMAGES;i++)images[i]=(XrSwapchainImageVulkanKHR){XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR,NULL,VK_NULL_HANDLE};
|
||||
uint32_t image_count=0;
|
||||
if(XR_FAILED(enumerate(p->output,MAX_IMAGES,&image_count,(XrSwapchainImageBaseHeader*)images)) ||
|
||||
!image_count || image_count>MAX_IMAGES)goto fail;
|
||||
p->count=image_count;
|
||||
for(uint32_t i=0;i<p->count;i++)p->images[i]=images[i].image;
|
||||
if(s->native_project){
|
||||
stage="video composition cache";
|
||||
if(!surf_private_image(2*p->size,p->size,1,VK_FORMAT_R8G8B8A8_SRGB,
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
&p->video_cache,&p->video_cache_memory,&p->video_cache_view))goto fail;
|
||||
LOG("surface_projection: fused GPU video view ready (%ux%u per eye)",p->size,p->size);
|
||||
return 1;
|
||||
}
|
||||
stage="source image";
|
||||
VkImageCreateInfo image={VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,NULL,0,VK_IMAGE_TYPE_2D,VK_FORMAT_R8G8B8A8_UNORM,
|
||||
{width,height,1},1,1,VK_SAMPLE_COUNT_1_BIT,VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT,VK_SHARING_MODE_EXCLUSIVE,0,NULL,VK_IMAGE_LAYOUT_UNDEFINED};
|
||||
VkMemoryRequirements req;
|
||||
VkPhysicalDeviceMemoryProperties props;svk.GetPhysicalDeviceMemoryProperties(vk.physical,&props);
|
||||
uint32_t type=UINT32_MAX;
|
||||
VkMemoryAllocateInfo memory;
|
||||
VkImageViewCreateInfo view={VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,NULL,0,p->source,VK_IMAGE_VIEW_TYPE_2D,
|
||||
VK_FORMAT_R8G8B8A8_UNORM,{0,0,0,0},{VK_IMAGE_ASPECT_COLOR_BIT,0,1,0,1}};
|
||||
if(!s->native_mode){
|
||||
if(spvk.CreateImage(vk.device,&image,NULL,&p->source)!=VK_SUCCESS)goto fail;
|
||||
spvk.GetImageMemoryRequirements(vk.device,p->source,&req);
|
||||
for(uint32_t i=0;i<props.memoryTypeCount;i++)if((req.memoryTypeBits&(1u<<i)) &&
|
||||
(props.memoryTypes[i].propertyFlags&VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)){type=i;break;}
|
||||
if(type==UINT32_MAX)goto fail;
|
||||
memory=(VkMemoryAllocateInfo){VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,NULL,req.size,type};
|
||||
if(svk.AllocateMemory(vk.device,&memory,NULL,&p->memory)!=VK_SUCCESS ||
|
||||
spvk.BindImageMemory(vk.device,p->source,p->memory,0)!=VK_SUCCESS)goto fail;
|
||||
view.image=p->source;
|
||||
if(spvk.CreateImageView(vk.device,&view,NULL,&p->source_view)!=VK_SUCCESS)goto fail;
|
||||
}
|
||||
// The runtime supports sRGB swapchains, which cannot be storage images.
|
||||
// Compute into a private UNORM image and copy its encoded pixels unchanged.
|
||||
stage="private storage image";
|
||||
image.extent=(VkExtent3D){2*p->size,p->size,1};
|
||||
image.usage=VK_IMAGE_USAGE_STORAGE_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
if(spvk.CreateImage(vk.device,&image,NULL,&p->rendered)!=VK_SUCCESS)goto fail;
|
||||
spvk.GetImageMemoryRequirements(vk.device,p->rendered,&req);
|
||||
type=UINT32_MAX;
|
||||
for(uint32_t i=0;i<props.memoryTypeCount;i++)if((req.memoryTypeBits&(1u<<i)) &&
|
||||
(props.memoryTypes[i].propertyFlags&VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)){type=i;break;}
|
||||
if(type==UINT32_MAX)goto fail;
|
||||
memory=(VkMemoryAllocateInfo){VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,NULL,req.size,type};
|
||||
if(svk.AllocateMemory(vk.device,&memory,NULL,&p->rendered_memory)!=VK_SUCCESS ||
|
||||
spvk.BindImageMemory(vk.device,p->rendered,p->rendered_memory,0)!=VK_SUCCESS)goto fail;
|
||||
view.image=p->rendered;
|
||||
if(spvk.CreateImageView(vk.device,&view,NULL,&p->rendered_view)!=VK_SUCCESS)goto fail;
|
||||
stage="sampler and descriptors";
|
||||
VkSamplerCreateInfo sampler={VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,NULL,0,VK_FILTER_LINEAR,VK_FILTER_LINEAR,
|
||||
VK_SAMPLER_MIPMAP_MODE_NEAREST,VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
|
||||
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,0,VK_FALSE,1,VK_FALSE,VK_COMPARE_OP_ALWAYS,0,0,VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK,VK_FALSE};
|
||||
if(spvk.CreateSampler(vk.device,&sampler,NULL,&p->sampler)!=VK_SUCCESS)goto fail;
|
||||
VkDescriptorSetLayoutBinding bindings[2]={{0,VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,1,VK_SHADER_STAGE_COMPUTE_BIT,NULL},
|
||||
{1,VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,1,VK_SHADER_STAGE_COMPUTE_BIT,NULL}};
|
||||
VkDescriptorSetLayoutCreateInfo set={VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,NULL,0,2,bindings};
|
||||
if(spvk.CreateDescriptorSetLayout(vk.device,&set,NULL,&p->set_layout)!=VK_SUCCESS)goto fail;
|
||||
VkDescriptorPoolSize sizes[2]={{VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,1},{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,1}};
|
||||
VkDescriptorPoolCreateInfo pool={VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,NULL,0,1,2,sizes};
|
||||
if(spvk.CreateDescriptorPool(vk.device,&pool,NULL,&p->descriptors)!=VK_SUCCESS)goto fail;
|
||||
VkDescriptorSetAllocateInfo alloc={VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,NULL,p->descriptors,1,&p->set_layout};
|
||||
if(spvk.AllocateDescriptorSets(vk.device,&alloc,&p->set)!=VK_SUCCESS)goto fail;
|
||||
stage="compute pipeline";
|
||||
VkPushConstantRange range={VK_SHADER_STAGE_COMPUTE_BIT,0,128};
|
||||
VkPipelineLayoutCreateInfo layout={VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,NULL,0,1,&p->set_layout,1,&range};
|
||||
if(spvk.CreatePipelineLayout(vk.device,&layout,NULL,&p->layout)!=VK_SUCCESS)goto fail;
|
||||
VkShaderModule module;
|
||||
VkShaderModuleCreateInfo shader={VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,NULL,0,sizeof(surface_projection_spv),surface_projection_spv};
|
||||
if(spvk.CreateShaderModule(vk.device,&shader,NULL,&module)!=VK_SUCCESS)goto fail;
|
||||
VkComputePipelineCreateInfo pipeline={VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,NULL,0,
|
||||
{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,NULL,0,VK_SHADER_STAGE_COMPUTE_BIT,module,"main",NULL},p->layout,VK_NULL_HANDLE,0};
|
||||
VkResult result=spvk.CreateComputePipelines(vk.device,VK_NULL_HANDLE,1,&pipeline,NULL,&p->pipeline);
|
||||
spvk.DestroyShaderModule(vk.device,module,NULL);
|
||||
if(result!=VK_SUCCESS)goto fail;
|
||||
LOG("surface_projection: Vulkan stereo panorama renderer ready (%ux%u per eye)",p->size,p->size);return 1;
|
||||
fail:;
|
||||
static int failures;
|
||||
if(failures++<5)LOG("surface_projection: setup failed at %s; retaining original layer behavior",stage);
|
||||
surf_projection_destroy(s);return 0;
|
||||
}
|
||||
// Build both eyes at once. The worker carries this exact pose/space snapshot
|
||||
// with its finished image rather than labelling an old image with a newer pose.
|
||||
static int surf_video_request(XrSession session,const XrFrameEndInfo *info,
|
||||
const XrCompositionLayerBaseHeader *layer,surf_swapchain *s,surf_projection *p) {
|
||||
emul_common common=emul_common_of(layer);
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
int same=s->video_job.seq && s->video_job.time==info->displayTime && s->video_job.space==common.space;
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if(same)return 1;
|
||||
surf_video_job job={.time=info->displayTime,.space=common.space,.flags=layer->layerFlags,.size=p->size};
|
||||
job.views[0].type=job.views[1].type=XR_TYPE_VIEW;
|
||||
int source=surf_views_select(session,info,common.space,
|
||||
(PFN_xrLocateSpace)lookup(active_instance,"xrLocateSpace"),job.views);
|
||||
if(!source){
|
||||
PFN_xrLocateViews locate=(PFN_xrLocateViews)lookup(active_instance,"xrLocateViews");
|
||||
XrViewLocateInfo li={XR_TYPE_VIEW_LOCATE_INFO,NULL,XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO,info->displayTime,common.space};
|
||||
XrViewState state={XR_TYPE_VIEW_STATE};uint32_t count=0;
|
||||
if(!locate || XR_FAILED(locate(session,&li,&state,2,&count,job.views)) || count!=2 ||
|
||||
!(state.viewStateFlags&XR_VIEW_STATE_ORIENTATION_VALID_BIT))return 0;
|
||||
source=3;
|
||||
}
|
||||
if(p->view_source!=source){
|
||||
LOG("surface_projection: views from %s",source==1?"submitted projection":source==2?"application locate":"runtime locate");
|
||||
p->view_source=source;
|
||||
}
|
||||
for(int eye=0;eye<2;eye++){
|
||||
const XrCompositionLayerBaseHeader *selected=layer;
|
||||
for(uint32_t i=0;i<info->layerCount;i++)if(emul_is_equirect(info->layers[i])){
|
||||
emul_common c=emul_common_of(info->layers[i]);
|
||||
if(c.sub.swapchain==s->handle && c.space==common.space && (c.eye==XR_EYE_VISIBILITY_BOTH ||
|
||||
c.eye==(eye?XR_EYE_VISIBILITY_RIGHT:XR_EYE_VISIBILITY_LEFT))){selected=info->layers[i];break;}
|
||||
}
|
||||
emul_common c=emul_common_of(selected);XrView *view=&job.views[eye];
|
||||
job.panorama[eye]=c.pose;
|
||||
view->fov=surf_video_guard_fov(view->fov);
|
||||
XrQuaternionf rotation=lm_qmul(lm_qconj(c.pose.orientation),view->pose.orientation);
|
||||
XrVector3f origin=lm_rotate(lm_qconj(c.pose.orientation),(XrVector3f){view->pose.position.x-c.pose.position.x,
|
||||
view->pose.position.y-c.pose.position.y,view->pose.position.z-c.pose.position.z});
|
||||
float params[32]={rotation.x,rotation.y,rotation.z,rotation.w,origin.x,origin.y,origin.z,0,
|
||||
tanf(view->fov.angleLeft),tanf(view->fov.angleRight),tanf(view->fov.angleDown),tanf(view->fov.angleUp),
|
||||
c.sub.imageRect.offset.x/(float)s->width,c.sub.imageRect.offset.y/(float)s->height,
|
||||
c.sub.imageRect.extent.width/(float)s->width,c.sub.imageRect.extent.height/(float)s->height,
|
||||
0,0,0,(float)eye,1,1,0,0,1,1,1,1,0,0,0,0};
|
||||
if(selected->type==XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR){
|
||||
const XrCompositionLayerEquirect2KHR *e=(const void*)selected;
|
||||
params[7]=e->radius;params[16]=e->centralHorizontalAngle;params[17]=e->upperVerticalAngle;params[18]=e->lowerVerticalAngle;
|
||||
}else{
|
||||
const XrCompositionLayerEquirectKHR *e=(const void*)selected;
|
||||
params[7]=e->radius;params[20]=e->scale.x;params[21]=e->scale.y;params[22]=e->bias.x;params[23]=e->bias.y;
|
||||
}
|
||||
for(const XrBaseInStructure *n=selected->next;n;n=n->next)if(n->type==XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR){
|
||||
const XrCompositionLayerColorScaleBiasKHR *color=(const void*)n;
|
||||
memcpy(params+24,&color->colorScale,16);memcpy(params+28,&color->colorBias,16);
|
||||
}
|
||||
memcpy(job.params[eye],params,sizeof(params));
|
||||
}
|
||||
pthread_mutex_lock(&surf_lock);job.seq=s->video_job.seq+1;s->video_job=job;
|
||||
pthread_cond_broadcast(&surf_cond);pthread_mutex_unlock(&surf_lock);
|
||||
return 1;
|
||||
}
|
||||
static const XrCompositionLayerBaseHeader *surf_video_layer(surf_projection *p,const surf_video_job *current) {
|
||||
if(!p->ready)return NULL;
|
||||
int occludes=surf_video_occludes(&p->presented_job,current);
|
||||
if(occludes!=p->occludes && !surf_composite_active(p))LOG("surface_projection: opaque primary=%d (fades and uncovered views retain lower layers)",occludes);
|
||||
p->occludes=occludes;
|
||||
for(int eye=0;eye<2;eye++)p->eyes[eye].pose=occludes?
|
||||
surf_video_primary_pose(&p->presented_job,current,eye):surf_video_pose(&p->presented_job,current,eye);
|
||||
if(current->time-p->tracking_log_time>=5000000000ll){
|
||||
XrQuaternionf correction=lm_qmul(lm_qconj(p->eyes[0].pose.orientation),current->views[0].pose.orientation);
|
||||
XrQuaternionf layer_delta=lm_qmul(lm_qconj(p->presented_job.panorama[0].orientation),current->panorama[0].orientation);
|
||||
LOG("surface_projection: render age=%.2f ms, head correction=%.2f deg, layer rotation=%.2f deg, space=%p",
|
||||
(current->time-p->presented_job.time)/1e6,lm_angle(correction)*180/LM_PI,lm_angle(layer_delta)*180/LM_PI,
|
||||
(void*)(uintptr_t)current->space);
|
||||
p->tracking_log_time=current->time;
|
||||
}
|
||||
return (const void*)&p->layer;
|
||||
}
|
||||
static int surf_projection_occludes(const XrCompositionLayerBaseHeader *layer) {
|
||||
for(int i=0;i<SURF_MAX;i++)if(layer==(const void*)&surf_projections[i].layer)
|
||||
return surfs[i].native_project && surf_projections[i].ready && surf_projections[i].occludes;
|
||||
return 0;
|
||||
}
|
||||
static const XrCompositionLayerBaseHeader *surf_video_present(XrSession session,const XrFrameEndInfo *info,
|
||||
const XrCompositionLayerBaseHeader *layer,surf_swapchain *s,surf_projection *p) {
|
||||
if(!surf_projection_setup(session,s,p,s->width,s->height) || !surf_video_request(session,info,layer,s,p))return NULL;
|
||||
pthread_mutex_lock(&surf_lock);surf_video_job current=s->video_job;pthread_mutex_unlock(&surf_lock);
|
||||
// Request tracking updates even when our previous copy is still queued.
|
||||
if(s->in_flight){
|
||||
if(svk.GetFenceStatus(vk.device,s->fence)!=VK_SUCCESS)return surf_video_layer(p,¤t);
|
||||
vk.ResetFences(vk.device,1,&s->fence);s->in_flight=0;surf_native_complete(s);
|
||||
}
|
||||
// A worker can publish between the two eye calls; present the pair only once.
|
||||
if(p->ready && p->presented_time==info->displayTime)return surf_video_layer(p,¤t);
|
||||
int slot=-1;
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++)if(s->native_slots[i].state==2){slot=i;s->native_slots[i].state=3;break;}
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if(slot<0)return surf_video_layer(p,¤t);
|
||||
surf_native_slot *native=&s->native_slots[slot];
|
||||
if(!native->projected || native->width!=2*p->size || native->height!=p->size)goto unused;
|
||||
PFN_xrAcquireSwapchainImage acquire=(PFN_xrAcquireSwapchainImage)lookup(active_instance,"xrAcquireSwapchainImage");
|
||||
PFN_xrWaitSwapchainImage wait=(PFN_xrWaitSwapchainImage)lookup(active_instance,"xrWaitSwapchainImage");
|
||||
PFN_xrReleaseSwapchainImage release=(PFN_xrReleaseSwapchainImage)lookup(active_instance,"xrReleaseSwapchainImage");
|
||||
int compose=surf_composite_candidate(info,layer);
|
||||
int cached_only=compose && surf_composite_cached_only(info,p,&native->video,¤t);
|
||||
XrSwapchainImageAcquireInfo ai={XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO};
|
||||
XrSwapchainImageWaitInfo wi={XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO,NULL,0};
|
||||
XrSwapchainImageReleaseInfo ri={XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};uint32_t index;
|
||||
if(!acquire || !wait || !release)goto unused;
|
||||
if(!cached_only && !p->acquired){
|
||||
if(XR_FAILED(acquire(p->output,&ai,&p->acquired_index)))goto unused;
|
||||
p->acquired=1;
|
||||
}
|
||||
index=p->acquired_index;
|
||||
XrResult waited=cached_only?XR_SUCCESS:wait(p->output,&wi);
|
||||
// Timeout is a positive XrResult, but the image is not yet writable. Keep
|
||||
// it acquired and retry next frame rather than blocking the render thread.
|
||||
if(waited!=XR_SUCCESS)goto unused;
|
||||
if(!cached_only && index>=p->count){release(p->output,&ri);p->acquired=0;goto unused;}
|
||||
VkCommandBufferBeginInfo begin={VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,NULL,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
|
||||
vk.ResetCommandBuffer(s->cmd,0);vk.BeginCommandBuffer(s->cmd,&begin);
|
||||
surf_native_ownership(s->cmd,native,1);
|
||||
if(!cached_only)surf_barrier(s->cmd,p->images[index],VK_IMAGE_LAYOUT_UNDEFINED,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,0,VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
VkImageCopy copy={{VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},{0,0,0},{VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},{0,0,0},{2*p->size,p->size,1}};
|
||||
if(!cached_only)spvk.CmdCopyImage(s->cmd,native->image,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,p->images[index],VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,1,©);
|
||||
if(compose){
|
||||
surf_barrier(s->cmd,p->video_cache,p->cache_ready?VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,p->cache_ready?VK_ACCESS_SHADER_READ_BIT:0,VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
spvk.CmdCopyImage(s->cmd,native->image,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,p->video_cache,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,1,©);
|
||||
surf_barrier(s->cmd,p->video_cache,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,VK_ACCESS_SHADER_READ_BIT);
|
||||
}
|
||||
surf_native_ownership(s->cmd,native,0);
|
||||
if(!cached_only)surf_barrier(s->cmd,p->images[index],VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,VK_ACCESS_COLOR_ATTACHMENT_READ_BIT|VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
|
||||
vk.EndCommandBuffer(s->cmd);
|
||||
VkSubmitInfo submit={VK_STRUCTURE_TYPE_SUBMIT_INFO,NULL,0,NULL,NULL,1,&s->cmd};
|
||||
int ok=vk.QueueSubmit(vk.queue,1,&submit,s->fence)==VK_SUCCESS;
|
||||
if(!cached_only){release(p->output,&ri);p->acquired=0;}if(!ok)goto unused;
|
||||
s->native_pending=slot;s->in_flight=1;s->uploads++;if(compose){p->cache_ready=1;p->cached_job=native->video;}
|
||||
p->width=native->source_width;p->height=native->source_height;p->source_seq=native->seq;p->source_ready=1;
|
||||
for(int eye=0;eye<2;eye++)p->eyes[eye]=(XrCompositionLayerProjectionView){XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW,NULL,
|
||||
native->video.views[eye].pose,native->video.views[eye].fov,
|
||||
{p->output,{{eye*(int32_t)p->size,0},{(int32_t)p->size,(int32_t)p->size}},0}};
|
||||
p->layer=(XrCompositionLayerProjection){XR_TYPE_COMPOSITION_LAYER_PROJECTION,NULL,native->video.flags,native->video.space,2,p->eyes};
|
||||
p->presented_job=native->video;
|
||||
p->ready=1;p->presented_time=info->displayTime;return surf_video_layer(p,¤t);
|
||||
unused:
|
||||
pthread_mutex_lock(&surf_lock);native->state=native->seq==s->seq?2:0;pthread_mutex_unlock(&surf_lock);
|
||||
return surf_video_layer(p,¤t);
|
||||
}
|
||||
static const XrCompositionLayerBaseHeader *surf_projection_frame(XrSession session,const XrFrameEndInfo *info,
|
||||
const XrCompositionLayerBaseHeader *layer) {
|
||||
if(!surf_vulkan || !emul_is_equirect(layer))return NULL;
|
||||
emul_common common=emul_common_of(layer);
|
||||
surf_swapchain *s=surf_find(common.sub.swapchain);
|
||||
if(!s)return NULL;
|
||||
surf_projection *p=&surf_projections[s-surfs];
|
||||
if(s->native_project)return surf_video_present(session,info,layer,s,p);
|
||||
if(s->in_flight) {
|
||||
if(svk.GetFenceStatus(vk.device,s->fence)!=VK_SUCCESS)return p->ready?(const XrCompositionLayerBaseHeader*)&p->layer:NULL;
|
||||
vk.ResetFences(vk.device,1,&s->fence);s->in_flight=0;
|
||||
surf_native_complete(s);
|
||||
}
|
||||
int native_index=-1;
|
||||
if(s->native_mode){
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
for(int i=0;i<SURF_NATIVE_SLOTS;i++)if(s->native_slots[i].state==2){native_index=i;s->native_slots[i].state=3;break;}
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if(native_index<0 && !p->source_ready)return NULL;
|
||||
}
|
||||
surf_native_slot *native=native_index>=0?&s->native_slots[native_index]:NULL;
|
||||
uint32_t source_width=native?native->width:(s->native_mode?p->width:s->width);
|
||||
uint32_t source_height=native?native->height:(s->native_mode?p->height:s->height);
|
||||
if(p->pipeline && (p->width!=source_width || p->height!=source_height)){
|
||||
if(s->native_mode){p->width=source_width;p->height=source_height;}
|
||||
else surf_projection_destroy(s);
|
||||
}
|
||||
if(!surf_projection_setup(session,s,p,source_width,source_height)){
|
||||
if(native){pthread_mutex_lock(&surf_lock);native->state=native->seq==s->seq?2:0;pthread_mutex_unlock(&surf_lock);}return NULL;
|
||||
}
|
||||
XrView views[2]={{XR_TYPE_VIEW,NULL},{XR_TYPE_VIEW,NULL}};
|
||||
XrViewState state={XR_TYPE_VIEW_STATE,NULL,0};uint32_t count=0;
|
||||
XrViewLocateInfo locate={XR_TYPE_VIEW_LOCATE_INFO,NULL,XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO,info->displayTime,common.space};
|
||||
PFN_xrLocateViews locate_views=(PFN_xrLocateViews)lookup(active_instance,"xrLocateViews");
|
||||
int view_source=surf_views_select(session,info,common.space,
|
||||
(PFN_xrLocateSpace)lookup(active_instance,"xrLocateSpace"),views);
|
||||
if(!view_source){
|
||||
if(!locate_views || XR_FAILED(locate_views(session,&locate,&state,2,&count,views)) || count!=2 ||
|
||||
!(state.viewStateFlags&XR_VIEW_STATE_ORIENTATION_VALID_BIT))goto unused;
|
||||
view_source=3;
|
||||
}
|
||||
if(p->view_source!=view_source){
|
||||
LOG("surface_projection: views from %s, space=%p, frame time=%lld",view_source==1?"submitted projection":
|
||||
view_source==2?"application locate":"runtime locate",(void*)(uintptr_t)common.space,(long long)info->displayTime);
|
||||
p->view_source=view_source;
|
||||
}
|
||||
pthread_mutex_lock(&surf_lock);uint64_t seq=s->native_mode?(native?native->seq:p->source_seq):s->seq;
|
||||
if(!s->native_mode && seq!=p->source_seq)memcpy(s->staging_map,s->pixels,(size_t)s->width*s->height*4);
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if(!seq)goto unused;
|
||||
PFN_xrAcquireSwapchainImage acquire=(PFN_xrAcquireSwapchainImage)lookup(active_instance,"xrAcquireSwapchainImage");
|
||||
PFN_xrWaitSwapchainImage wait=(PFN_xrWaitSwapchainImage)lookup(active_instance,"xrWaitSwapchainImage");
|
||||
PFN_xrReleaseSwapchainImage release=(PFN_xrReleaseSwapchainImage)lookup(active_instance,"xrReleaseSwapchainImage");
|
||||
XrSwapchainImageAcquireInfo ai={XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO,NULL};
|
||||
XrSwapchainImageWaitInfo wi={XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO,NULL,100000000};
|
||||
XrSwapchainImageReleaseInfo ri={XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO,NULL};uint32_t index;
|
||||
if(!acquire || !wait || !release || XR_FAILED(acquire(p->output,&ai,&index)))goto unused;
|
||||
if(index>=p->count || XR_FAILED(wait(p->output,&wi))) {release(p->output,&ri);goto unused;}
|
||||
int previous_native=s->native_current;
|
||||
surf_native_slot *sample=native?native:(s->native_mode && previous_native>=0?&s->native_slots[previous_native]:NULL);
|
||||
VkDescriptorImageInfo descriptors[2]={{VK_NULL_HANDLE,p->rendered_view,VK_IMAGE_LAYOUT_GENERAL},
|
||||
{p->sampler,sample?sample->view:p->source_view,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}};
|
||||
VkWriteDescriptorSet writes[2];
|
||||
for(int i=0;i<2;i++)writes[i]=(VkWriteDescriptorSet){VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,NULL,p->set,(uint32_t)i,0,1,
|
||||
i?VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,&descriptors[i],NULL,NULL};
|
||||
spvk.UpdateDescriptorSets(vk.device,2,writes,0,NULL);
|
||||
VkCommandBufferBeginInfo begin={VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,NULL,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,NULL};
|
||||
vk.ResetCommandBuffer(s->cmd,0);vk.BeginCommandBuffer(s->cmd,&begin);
|
||||
if(native){
|
||||
if(previous_native>=0)surf_native_ownership(s->cmd,&s->native_slots[previous_native],0);
|
||||
surf_native_ownership(s->cmd,native,1);
|
||||
}else if(!s->native_mode && seq!=p->source_seq) {
|
||||
surf_barrier(s->cmd,p->source,p->source_ready?VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,p->source_ready?VK_ACCESS_SHADER_READ_BIT:0,VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
VkBufferImageCopy copy={0,0,0,{VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},{0,0,0},{s->width,s->height,1}};
|
||||
svk.CmdCopyBufferToImage(s->cmd,s->staging,p->source,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,1,©);
|
||||
surf_barrier(s->cmd,p->source,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,VK_ACCESS_SHADER_READ_BIT);
|
||||
}
|
||||
surf_barrier(s->cmd,p->rendered,VK_IMAGE_LAYOUT_UNDEFINED,VK_IMAGE_LAYOUT_GENERAL,0,VK_ACCESS_SHADER_WRITE_BIT);
|
||||
spvk.CmdBindPipeline(s->cmd,VK_PIPELINE_BIND_POINT_COMPUTE,p->pipeline);
|
||||
spvk.CmdBindDescriptorSets(s->cmd,VK_PIPELINE_BIND_POINT_COMPUTE,p->layout,0,1,&p->set,0,NULL);
|
||||
for(int eye=0;eye<2;eye++) {
|
||||
const XrCompositionLayerBaseHeader *selected=NULL;
|
||||
for(uint32_t i=0;i<info->layerCount;i++)if(emul_is_equirect(info->layers[i])) {
|
||||
emul_common c=emul_common_of(info->layers[i]);
|
||||
if(c.sub.swapchain==s->handle && c.space==common.space && (c.eye==XR_EYE_VISIBILITY_BOTH ||
|
||||
c.eye==(eye?XR_EYE_VISIBILITY_RIGHT:XR_EYE_VISIBILITY_LEFT))){selected=info->layers[i];break;}
|
||||
}
|
||||
if(!selected)selected=layer;
|
||||
emul_common c=emul_common_of(selected);
|
||||
XrQuaternionf rotation=lm_qmul(lm_qconj(c.pose.orientation),views[eye].pose.orientation);
|
||||
XrVector3f origin=lm_rotate(lm_qconj(c.pose.orientation),(XrVector3f){views[eye].pose.position.x-c.pose.position.x,
|
||||
views[eye].pose.position.y-c.pose.position.y,views[eye].pose.position.z-c.pose.position.z});
|
||||
float params[32]={rotation.x,rotation.y,rotation.z,rotation.w,origin.x,origin.y,origin.z,0,
|
||||
tanf(views[eye].fov.angleLeft),tanf(views[eye].fov.angleRight),tanf(views[eye].fov.angleDown),tanf(views[eye].fov.angleUp),
|
||||
c.sub.imageRect.offset.x/(float)s->width,c.sub.imageRect.offset.y/(float)s->height,
|
||||
c.sub.imageRect.extent.width/(float)s->width,c.sub.imageRect.extent.height/(float)s->height,
|
||||
0,0,0,(float)eye,1,1,0,0,1,1,1,1,0,0,0,0};
|
||||
if(selected->type==XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR) {
|
||||
const XrCompositionLayerEquirect2KHR *e=(const void*)selected;
|
||||
params[7]=e->radius;params[16]=e->centralHorizontalAngle;params[17]=e->upperVerticalAngle;params[18]=e->lowerVerticalAngle;
|
||||
} else {
|
||||
const XrCompositionLayerEquirectKHR *e=(const void*)selected;
|
||||
params[7]=e->radius;params[20]=e->scale.x;params[21]=e->scale.y;params[22]=e->bias.x;params[23]=e->bias.y;
|
||||
}
|
||||
for(const XrBaseInStructure *n=selected->next;n;n=n->next)if(n->type==XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR) {
|
||||
const XrCompositionLayerColorScaleBiasKHR *color=(const void*)n;
|
||||
memcpy(params+24,&color->colorScale,16);memcpy(params+28,&color->colorBias,16);
|
||||
}
|
||||
spvk.CmdPushConstants(s->cmd,p->layout,VK_SHADER_STAGE_COMPUTE_BIT,0,sizeof(params),params);
|
||||
spvk.CmdDispatch(s->cmd,(p->size+15)/16,(p->size+15)/16,1);
|
||||
p->eyes[eye]=(XrCompositionLayerProjectionView){XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW,NULL,
|
||||
views[eye].pose,views[eye].fov,{p->output,{{eye*(int32_t)p->size,0},{(int32_t)p->size,(int32_t)p->size}},0}};
|
||||
}
|
||||
surf_barrier(s->cmd,p->rendered,VK_IMAGE_LAYOUT_GENERAL,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_ACCESS_SHADER_WRITE_BIT,VK_ACCESS_TRANSFER_READ_BIT);
|
||||
surf_barrier(s->cmd,p->images[index],VK_IMAGE_LAYOUT_UNDEFINED,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
0,VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
VkImageCopy rendered_copy={{VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},{0,0,0},
|
||||
{VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},{0,0,0},{2*p->size,p->size,1}};
|
||||
spvk.CmdCopyImage(s->cmd,p->rendered,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
p->images[index],VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,1,&rendered_copy);
|
||||
surf_barrier(s->cmd,p->images[index],VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,VK_ACCESS_COLOR_ATTACHMENT_READ_BIT|VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
|
||||
vk.EndCommandBuffer(s->cmd);
|
||||
VkSubmitInfo submit={VK_STRUCTURE_TYPE_SUBMIT_INFO,NULL,0,NULL,NULL,1,&s->cmd,0,NULL};
|
||||
int ok=vk.QueueSubmit(vk.queue,1,&submit,s->fence)==VK_SUCCESS;
|
||||
release(p->output,&ri);
|
||||
if(!ok)goto unused;
|
||||
if(native){s->native_pending=previous_native;s->native_current=native_index;}
|
||||
s->in_flight=1;p->source_ready=1;p->source_seq=seq;s->uploads++;
|
||||
p->layer=(XrCompositionLayerProjection){XR_TYPE_COMPOSITION_LAYER_PROJECTION,NULL,layer->layerFlags,common.space,2,p->eyes};
|
||||
p->ready=1;
|
||||
return (const XrCompositionLayerBaseHeader*)&p->layer;
|
||||
unused:
|
||||
if(native){pthread_mutex_lock(&surf_lock);native->state=native->seq==s->seq?2:0;pthread_mutex_unlock(&surf_lock);}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "surface_composite.c"
|
||||
@@ -1,38 +0,0 @@
|
||||
#version 450
|
||||
layout(local_size_x=16,local_size_y=16) in;
|
||||
layout(binding=0,rgba8) uniform writeonly image2D outputImage;
|
||||
layout(binding=1) uniform sampler2D panorama;
|
||||
layout(push_constant) uniform Params {
|
||||
vec4 rotation;
|
||||
vec4 originRadius;
|
||||
vec4 tans;
|
||||
vec4 rect;
|
||||
vec4 anglesEye;
|
||||
vec4 scaleBias;
|
||||
vec4 colorScale;
|
||||
vec4 colorBias;
|
||||
} p;
|
||||
vec3 rotate(vec4 q,vec3 v) {return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}
|
||||
void main() {
|
||||
ivec2 size=imageSize(outputImage),pixel=ivec2(gl_GlobalInvocationID.xy);
|
||||
int eye=int(p.anglesEye.w),width=size.x/2;
|
||||
if(pixel.x>=width || pixel.y>=size.y)return;
|
||||
vec2 uv=(vec2(pixel)+0.5)/vec2(width,size.y);
|
||||
vec3 d=normalize(rotate(p.rotation,vec3(mix(p.tans.x,p.tans.y,uv.x),mix(p.tans.w,p.tans.z,uv.y),-1.0)));
|
||||
if(p.originRadius.w>0.0) {
|
||||
vec3 o=p.originRadius.xyz;
|
||||
float b=dot(o,d),disc=b*b+p.originRadius.w*p.originRadius.w-dot(o,o);
|
||||
if(disc<0.0){imageStore(outputImage,pixel+ivec2(eye*width,0),vec4(0));return;}
|
||||
float distance=-b+sqrt(disc);
|
||||
if(distance<=0.0){imageStore(outputImage,pixel+ivec2(eye*width,0),vec4(0));return;}
|
||||
d=normalize(o+distance*d);
|
||||
}
|
||||
float lon=atan(d.x,-d.z),lat=asin(clamp(d.y,-1.0,1.0));
|
||||
vec2 eq;
|
||||
if(p.anglesEye.x>0.0) eq=vec2(lon/p.anglesEye.x+0.5,(lat-p.anglesEye.z)/(p.anglesEye.y-p.anglesEye.z));
|
||||
else eq=vec2(lon/6.28318530718+0.5,lat/3.14159265359+0.5)*p.scaleBias.xy+p.scaleBias.zw;
|
||||
vec4 color=vec4(0);
|
||||
if(all(greaterThanEqual(eq,vec2(0))) && all(lessThanEqual(eq,vec2(1))))
|
||||
color=clamp(textureLod(panorama,p.rect.xy+vec2(eq.x,1.0-eq.y)*p.rect.zw,0.0)*p.colorScale+p.colorBias,0.0,1.0);
|
||||
imageStore(outputImage,pixel+ivec2(eye*width,0),color);
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Generated from surface_projection.comp with glslangValidator -V --target-env vulkan1.0.
|
||||
#pragma once
|
||||
static const uint32_t surface_projection_spv[]={
|
||||
0x7230203,0x10000,0x8000b,0x132,0x0,0x20011,0x1,0x20011,
|
||||
0x32,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,
|
||||
0x0,0x1,0x6000f,0x5,0x4,0x6e69616d,0x0,0x31,
|
||||
0x60010,0x4,0x11,0x10,0x10,0x1,0x30003,0x2,
|
||||
0x1c2,0x40005,0x4,0x6e69616d,0x0,0x60005,0xe,0x61746f72,
|
||||
0x76286574,0x763b3466,0x3b3366,0x30005,0xc,0x71,0x30005,0xd,
|
||||
0x76,0x40005,0x28,0x657a6973,0x0,0x50005,0x2b,0x7074756f,
|
||||
0x6d497475,0x656761,0x40005,0x2e,0x65786970,0x6c,0x80005,0x31,
|
||||
0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30005,0x37,
|
||||
0x657965,0x40005,0x38,0x61726150,0x736d,0x60006,0x38,0x0,
|
||||
0x61746f72,0x6e6f6974,0x0,0x70006,0x38,0x1,0x6769726f,0x61526e69,
|
||||
0x73756964,0x0,0x50006,0x38,0x2,0x736e6174,0x0,0x50006,
|
||||
0x38,0x3,0x74636572,0x0,0x60006,0x38,0x4,0x6c676e61,
|
||||
0x79457365,0x65,0x60006,0x38,0x5,0x6c616373,0x61694265,0x73,
|
||||
0x60006,0x38,0x6,0x6f6c6f63,0x61635372,0x656c,0x60006,0x38,
|
||||
0x7,0x6f6c6f63,0x61694272,0x73,0x30005,0x3a,0x70,0x40005,
|
||||
0x40,0x74646977,0x68,0x30005,0x5a,0x7675,0x30005,0x67,
|
||||
0x64,0x40005,0x7a,0x61726170,0x6d,0x40005,0x7e,0x61726170,
|
||||
0x6d,0x30005,0x88,0x6f,0x30005,0x8c,0x62,0x40005,
|
||||
0x90,0x63736964,0x0,0x50005,0xab,0x74736964,0x65636e61,0x0,
|
||||
0x30005,0xc3,0x6e6f6c,0x30005,0xca,0x74616c,0x30005,0xd5,
|
||||
0x7165,0x40005,0xf9,0x6f6c6f63,0x72,0x50005,0x10b,0x6f6e6170,
|
||||
0x616d6172,0x0,0x40047,0x2b,0x22,0x0,0x40047,0x2b,
|
||||
0x21,0x0,0x30047,0x2b,0x19,0x40047,0x31,0xb,
|
||||
0x1c,0x50048,0x38,0x0,0x23,0x0,0x50048,0x38,
|
||||
0x1,0x23,0x10,0x50048,0x38,0x2,0x23,0x20,
|
||||
0x50048,0x38,0x3,0x23,0x30,0x50048,0x38,0x4,
|
||||
0x23,0x40,0x50048,0x38,0x5,0x23,0x50,0x50048,
|
||||
0x38,0x6,0x23,0x60,0x50048,0x38,0x7,0x23,
|
||||
0x70,0x30047,0x38,0x2,0x40047,0x10b,0x22,0x0,
|
||||
0x40047,0x10b,0x21,0x1,0x40047,0x131,0xb,0x19,
|
||||
0x20013,0x2,0x30021,0x3,0x2,0x30016,0x6,0x20,
|
||||
0x40017,0x7,0x6,0x4,0x40020,0x8,0x7,0x7,
|
||||
0x40017,0x9,0x6,0x3,0x40020,0xa,0x7,0x9,
|
||||
0x50021,0xb,0x9,0x8,0xa,0x4002b,0x6,0x11,
|
||||
0x40000000,0x40015,0x18,0x20,0x0,0x4002b,0x18,0x19,
|
||||
0x3,0x40020,0x1a,0x7,0x6,0x40015,0x25,0x20,
|
||||
0x1,0x40017,0x26,0x25,0x2,0x40020,0x27,0x7,
|
||||
0x26,0x90019,0x29,0x6,0x1,0x0,0x0,0x0,
|
||||
0x2,0x4,0x40020,0x2a,0x0,0x29,0x4003b,0x2a,
|
||||
0x2b,0x0,0x40017,0x2f,0x18,0x3,0x40020,0x30,
|
||||
0x1,0x2f,0x4003b,0x30,0x31,0x1,0x40017,0x32,
|
||||
0x18,0x2,0x40020,0x36,0x7,0x25,0xa001e,0x38,
|
||||
0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
|
||||
0x40020,0x39,0x9,0x38,0x4003b,0x39,0x3a,0x9,
|
||||
0x4002b,0x25,0x3b,0x4,0x40020,0x3c,0x9,0x6,
|
||||
0x4002b,0x18,0x41,0x0,0x4002b,0x25,0x44,0x2,
|
||||
0x20014,0x46,0x4002b,0x18,0x4e,0x1,0x40017,0x58,
|
||||
0x6,0x2,0x40020,0x59,0x7,0x58,0x4002b,0x6,
|
||||
0x5d,0x3f000000,0x4002b,0x25,0x68,0x0,0x4002b,0x18,
|
||||
0x72,0x2,0x4002b,0x6,0x78,0xbf800000,0x40020,0x7b,
|
||||
0x9,0x7,0x4002b,0x25,0x81,0x1,0x4002b,0x6,
|
||||
0x84,0x0,0x7002c,0x7,0xa9,0x84,0x84,0x84,
|
||||
0x84,0x4002b,0x6,0xcd,0x3f800000,0x4002b,0x6,0xe8,
|
||||
0x40c90fdb,0x4002b,0x6,0xec,0x40490fdb,0x4002b,0x25,0xf0,
|
||||
0x5,0x5002c,0x58,0xfb,0x84,0x84,0x40017,0xfc,
|
||||
0x46,0x2,0x5002c,0x58,0x102,0xcd,0xcd,0x90019,
|
||||
0x108,0x6,0x1,0x0,0x0,0x0,0x1,0x0,
|
||||
0x3001b,0x109,0x108,0x40020,0x10a,0x0,0x109,0x4003b,
|
||||
0x10a,0x10b,0x0,0x4002b,0x25,0x10d,0x3,0x4002b,
|
||||
0x25,0x11d,0x6,0x4002b,0x25,0x121,0x7,0x4002b,
|
||||
0x18,0x130,0x10,0x6002c,0x2f,0x131,0x130,0x130,
|
||||
0x4e,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,
|
||||
0x4003b,0x27,0x28,0x7,0x4003b,0x27,0x2e,0x7,
|
||||
0x4003b,0x36,0x37,0x7,0x4003b,0x36,0x40,0x7,
|
||||
0x4003b,0x59,0x5a,0x7,0x4003b,0xa,0x67,0x7,
|
||||
0x4003b,0x8,0x7a,0x7,0x4003b,0xa,0x7e,0x7,
|
||||
0x4003b,0xa,0x88,0x7,0x4003b,0x1a,0x8c,0x7,
|
||||
0x4003b,0x1a,0x90,0x7,0x4003b,0x1a,0xab,0x7,
|
||||
0x4003b,0x1a,0xc3,0x7,0x4003b,0x1a,0xca,0x7,
|
||||
0x4003b,0x59,0xd5,0x7,0x4003b,0x8,0xf9,0x7,
|
||||
0x4003d,0x29,0x2c,0x2b,0x40068,0x26,0x2d,0x2c,
|
||||
0x3003e,0x28,0x2d,0x4003d,0x2f,0x33,0x31,0x7004f,
|
||||
0x32,0x34,0x33,0x33,0x0,0x1,0x4007c,0x26,
|
||||
0x35,0x34,0x3003e,0x2e,0x35,0x60041,0x3c,0x3d,
|
||||
0x3a,0x3b,0x19,0x4003d,0x6,0x3e,0x3d,0x4006e,
|
||||
0x25,0x3f,0x3e,0x3003e,0x37,0x3f,0x50041,0x36,
|
||||
0x42,0x28,0x41,0x4003d,0x25,0x43,0x42,0x50087,
|
||||
0x25,0x45,0x43,0x44,0x3003e,0x40,0x45,0x50041,
|
||||
0x36,0x47,0x2e,0x41,0x4003d,0x25,0x48,0x47,
|
||||
0x4003d,0x25,0x49,0x40,0x500af,0x46,0x4a,0x48,
|
||||
0x49,0x400a8,0x46,0x4b,0x4a,0x300f7,0x4d,0x0,
|
||||
0x400fa,0x4b,0x4c,0x4d,0x200f8,0x4c,0x50041,0x36,
|
||||
0x4f,0x2e,0x4e,0x4003d,0x25,0x50,0x4f,0x50041,
|
||||
0x36,0x51,0x28,0x4e,0x4003d,0x25,0x52,0x51,
|
||||
0x500af,0x46,0x53,0x50,0x52,0x200f9,0x4d,0x200f8,
|
||||
0x4d,0x700f5,0x46,0x54,0x4a,0x5,0x53,0x4c,
|
||||
0x300f7,0x56,0x0,0x400fa,0x54,0x55,0x56,0x200f8,
|
||||
0x55,0x100fd,0x200f8,0x56,0x4003d,0x26,0x5b,0x2e,
|
||||
0x4006f,0x58,0x5c,0x5b,0x50050,0x58,0x5e,0x5d,
|
||||
0x5d,0x50081,0x58,0x5f,0x5c,0x5e,0x4003d,0x25,
|
||||
0x60,0x40,0x4006f,0x6,0x61,0x60,0x50041,0x36,
|
||||
0x62,0x28,0x4e,0x4003d,0x25,0x63,0x62,0x4006f,
|
||||
0x6,0x64,0x63,0x50050,0x58,0x65,0x61,0x64,
|
||||
0x50088,0x58,0x66,0x5f,0x65,0x3003e,0x5a,0x66,
|
||||
0x60041,0x3c,0x69,0x3a,0x44,0x41,0x4003d,0x6,
|
||||
0x6a,0x69,0x60041,0x3c,0x6b,0x3a,0x44,0x4e,
|
||||
0x4003d,0x6,0x6c,0x6b,0x50041,0x1a,0x6d,0x5a,
|
||||
0x41,0x4003d,0x6,0x6e,0x6d,0x8000c,0x6,0x6f,
|
||||
0x1,0x2e,0x6a,0x6c,0x6e,0x60041,0x3c,0x70,
|
||||
0x3a,0x44,0x19,0x4003d,0x6,0x71,0x70,0x60041,
|
||||
0x3c,0x73,0x3a,0x44,0x72,0x4003d,0x6,0x74,
|
||||
0x73,0x50041,0x1a,0x75,0x5a,0x4e,0x4003d,0x6,
|
||||
0x76,0x75,0x8000c,0x6,0x77,0x1,0x2e,0x71,
|
||||
0x74,0x76,0x60050,0x9,0x79,0x6f,0x77,0x78,
|
||||
0x50041,0x7b,0x7c,0x3a,0x68,0x4003d,0x7,0x7d,
|
||||
0x7c,0x3003e,0x7a,0x7d,0x3003e,0x7e,0x79,0x60039,
|
||||
0x9,0x7f,0xe,0x7a,0x7e,0x6000c,0x9,0x80,
|
||||
0x1,0x45,0x7f,0x3003e,0x67,0x80,0x60041,0x3c,
|
||||
0x82,0x3a,0x81,0x19,0x4003d,0x6,0x83,0x82,
|
||||
0x500ba,0x46,0x85,0x83,0x84,0x300f7,0x87,0x0,
|
||||
0x400fa,0x85,0x86,0x87,0x200f8,0x86,0x50041,0x7b,
|
||||
0x89,0x3a,0x81,0x4003d,0x7,0x8a,0x89,0x8004f,
|
||||
0x9,0x8b,0x8a,0x8a,0x0,0x1,0x2,0x3003e,
|
||||
0x88,0x8b,0x4003d,0x9,0x8d,0x88,0x4003d,0x9,
|
||||
0x8e,0x67,0x50094,0x6,0x8f,0x8d,0x8e,0x3003e,
|
||||
0x8c,0x8f,0x4003d,0x6,0x91,0x8c,0x4003d,0x6,
|
||||
0x92,0x8c,0x50085,0x6,0x93,0x91,0x92,0x60041,
|
||||
0x3c,0x94,0x3a,0x81,0x19,0x4003d,0x6,0x95,
|
||||
0x94,0x60041,0x3c,0x96,0x3a,0x81,0x19,0x4003d,
|
||||
0x6,0x97,0x96,0x50085,0x6,0x98,0x95,0x97,
|
||||
0x50081,0x6,0x99,0x93,0x98,0x4003d,0x9,0x9a,
|
||||
0x88,0x4003d,0x9,0x9b,0x88,0x50094,0x6,0x9c,
|
||||
0x9a,0x9b,0x50083,0x6,0x9d,0x99,0x9c,0x3003e,
|
||||
0x90,0x9d,0x4003d,0x6,0x9e,0x90,0x500b8,0x46,
|
||||
0x9f,0x9e,0x84,0x300f7,0xa1,0x0,0x400fa,0x9f,
|
||||
0xa0,0xa1,0x200f8,0xa0,0x4003d,0x29,0xa2,0x2b,
|
||||
0x4003d,0x26,0xa3,0x2e,0x4003d,0x25,0xa4,0x37,
|
||||
0x4003d,0x25,0xa5,0x40,0x50084,0x25,0xa6,0xa4,
|
||||
0xa5,0x50050,0x26,0xa7,0xa6,0x68,0x50080,0x26,
|
||||
0xa8,0xa3,0xa7,0x40063,0xa2,0xa8,0xa9,0x100fd,
|
||||
0x200f8,0xa1,0x4003d,0x6,0xac,0x8c,0x4007f,0x6,
|
||||
0xad,0xac,0x4003d,0x6,0xae,0x90,0x6000c,0x6,
|
||||
0xaf,0x1,0x1f,0xae,0x50081,0x6,0xb0,0xad,
|
||||
0xaf,0x3003e,0xab,0xb0,0x4003d,0x6,0xb1,0xab,
|
||||
0x500bc,0x46,0xb2,0xb1,0x84,0x300f7,0xb4,0x0,
|
||||
0x400fa,0xb2,0xb3,0xb4,0x200f8,0xb3,0x4003d,0x29,
|
||||
0xb5,0x2b,0x4003d,0x26,0xb6,0x2e,0x4003d,0x25,
|
||||
0xb7,0x37,0x4003d,0x25,0xb8,0x40,0x50084,0x25,
|
||||
0xb9,0xb7,0xb8,0x50050,0x26,0xba,0xb9,0x68,
|
||||
0x50080,0x26,0xbb,0xb6,0xba,0x40063,0xb5,0xbb,
|
||||
0xa9,0x100fd,0x200f8,0xb4,0x4003d,0x9,0xbd,0x88,
|
||||
0x4003d,0x6,0xbe,0xab,0x4003d,0x9,0xbf,0x67,
|
||||
0x5008e,0x9,0xc0,0xbf,0xbe,0x50081,0x9,0xc1,
|
||||
0xbd,0xc0,0x6000c,0x9,0xc2,0x1,0x45,0xc1,
|
||||
0x3003e,0x67,0xc2,0x200f9,0x87,0x200f8,0x87,0x50041,
|
||||
0x1a,0xc4,0x67,0x41,0x4003d,0x6,0xc5,0xc4,
|
||||
0x50041,0x1a,0xc6,0x67,0x72,0x4003d,0x6,0xc7,
|
||||
0xc6,0x4007f,0x6,0xc8,0xc7,0x7000c,0x6,0xc9,
|
||||
0x1,0x19,0xc5,0xc8,0x3003e,0xc3,0xc9,0x50041,
|
||||
0x1a,0xcb,0x67,0x4e,0x4003d,0x6,0xcc,0xcb,
|
||||
0x8000c,0x6,0xce,0x1,0x2b,0xcc,0x78,0xcd,
|
||||
0x6000c,0x6,0xcf,0x1,0x10,0xce,0x3003e,0xca,
|
||||
0xcf,0x60041,0x3c,0xd0,0x3a,0x3b,0x41,0x4003d,
|
||||
0x6,0xd1,0xd0,0x500ba,0x46,0xd2,0xd1,0x84,
|
||||
0x300f7,0xd4,0x0,0x400fa,0xd2,0xd3,0xe6,0x200f8,
|
||||
0xd3,0x4003d,0x6,0xd6,0xc3,0x60041,0x3c,0xd7,
|
||||
0x3a,0x3b,0x41,0x4003d,0x6,0xd8,0xd7,0x50088,
|
||||
0x6,0xd9,0xd6,0xd8,0x50081,0x6,0xda,0xd9,
|
||||
0x5d,0x4003d,0x6,0xdb,0xca,0x60041,0x3c,0xdc,
|
||||
0x3a,0x3b,0x72,0x4003d,0x6,0xdd,0xdc,0x50083,
|
||||
0x6,0xde,0xdb,0xdd,0x60041,0x3c,0xdf,0x3a,
|
||||
0x3b,0x4e,0x4003d,0x6,0xe0,0xdf,0x60041,0x3c,
|
||||
0xe1,0x3a,0x3b,0x72,0x4003d,0x6,0xe2,0xe1,
|
||||
0x50083,0x6,0xe3,0xe0,0xe2,0x50088,0x6,0xe4,
|
||||
0xde,0xe3,0x50050,0x58,0xe5,0xda,0xe4,0x3003e,
|
||||
0xd5,0xe5,0x200f9,0xd4,0x200f8,0xe6,0x4003d,0x6,
|
||||
0xe7,0xc3,0x50088,0x6,0xe9,0xe7,0xe8,0x50081,
|
||||
0x6,0xea,0xe9,0x5d,0x4003d,0x6,0xeb,0xca,
|
||||
0x50088,0x6,0xed,0xeb,0xec,0x50081,0x6,0xee,
|
||||
0xed,0x5d,0x50050,0x58,0xef,0xea,0xee,0x50041,
|
||||
0x7b,0xf1,0x3a,0xf0,0x4003d,0x7,0xf2,0xf1,
|
||||
0x7004f,0x58,0xf3,0xf2,0xf2,0x0,0x1,0x50085,
|
||||
0x58,0xf4,0xef,0xf3,0x50041,0x7b,0xf5,0x3a,
|
||||
0xf0,0x4003d,0x7,0xf6,0xf5,0x7004f,0x58,0xf7,
|
||||
0xf6,0xf6,0x2,0x3,0x50081,0x58,0xf8,0xf4,
|
||||
0xf7,0x3003e,0xd5,0xf8,0x200f9,0xd4,0x200f8,0xd4,
|
||||
0x3003e,0xf9,0xa9,0x4003d,0x58,0xfa,0xd5,0x500be,
|
||||
0xfc,0xfd,0xfa,0xfb,0x4009b,0x46,0xfe,0xfd,
|
||||
0x300f7,0x100,0x0,0x400fa,0xfe,0xff,0x100,0x200f8,
|
||||
0xff,0x4003d,0x58,0x101,0xd5,0x500bc,0xfc,0x103,
|
||||
0x101,0x102,0x4009b,0x46,0x104,0x103,0x200f9,0x100,
|
||||
0x200f8,0x100,0x700f5,0x46,0x105,0xfe,0xd4,0x104,
|
||||
0xff,0x300f7,0x107,0x0,0x400fa,0x105,0x106,0x107,
|
||||
0x200f8,0x106,0x4003d,0x109,0x10c,0x10b,0x50041,0x7b,
|
||||
0x10e,0x3a,0x10d,0x4003d,0x7,0x10f,0x10e,0x7004f,
|
||||
0x58,0x110,0x10f,0x10f,0x0,0x1,0x50041,0x1a,
|
||||
0x111,0xd5,0x41,0x4003d,0x6,0x112,0x111,0x50041,
|
||||
0x1a,0x113,0xd5,0x4e,0x4003d,0x6,0x114,0x113,
|
||||
0x50083,0x6,0x115,0xcd,0x114,0x50050,0x58,0x116,
|
||||
0x112,0x115,0x50041,0x7b,0x117,0x3a,0x10d,0x4003d,
|
||||
0x7,0x118,0x117,0x7004f,0x58,0x119,0x118,0x118,
|
||||
0x2,0x3,0x50085,0x58,0x11a,0x116,0x119,0x50081,
|
||||
0x58,0x11b,0x110,0x11a,0x70058,0x7,0x11c,0x10c,
|
||||
0x11b,0x2,0x84,0x50041,0x7b,0x11e,0x3a,0x11d,
|
||||
0x4003d,0x7,0x11f,0x11e,0x50085,0x7,0x120,0x11c,
|
||||
0x11f,0x50041,0x7b,0x122,0x3a,0x121,0x4003d,0x7,
|
||||
0x123,0x122,0x50081,0x7,0x124,0x120,0x123,0x70050,
|
||||
0x7,0x125,0x84,0x84,0x84,0x84,0x70050,0x7,
|
||||
0x126,0xcd,0xcd,0xcd,0xcd,0x8000c,0x7,0x127,
|
||||
0x1,0x2b,0x124,0x125,0x126,0x3003e,0xf9,0x127,
|
||||
0x200f9,0x107,0x200f8,0x107,0x4003d,0x29,0x128,0x2b,
|
||||
0x4003d,0x26,0x129,0x2e,0x4003d,0x25,0x12a,0x37,
|
||||
0x4003d,0x25,0x12b,0x40,0x50084,0x25,0x12c,0x12a,
|
||||
0x12b,0x50050,0x26,0x12d,0x12c,0x68,0x50080,0x26,
|
||||
0x12e,0x129,0x12d,0x4003d,0x7,0x12f,0xf9,0x40063,
|
||||
0x128,0x12e,0x12f,0x100fd,0x10038,0x50036,0x9,0xe,
|
||||
0x0,0xb,0x30037,0x8,0xc,0x30037,0xa,0xd,
|
||||
0x200f8,0xf,0x4003d,0x9,0x10,0xd,0x4003d,0x7,
|
||||
0x12,0xc,0x8004f,0x9,0x13,0x12,0x12,0x0,
|
||||
0x1,0x2,0x4003d,0x7,0x14,0xc,0x8004f,0x9,
|
||||
0x15,0x14,0x14,0x0,0x1,0x2,0x4003d,0x9,
|
||||
0x16,0xd,0x7000c,0x9,0x17,0x1,0x44,0x15,
|
||||
0x16,0x50041,0x1a,0x1b,0xc,0x19,0x4003d,0x6,
|
||||
0x1c,0x1b,0x4003d,0x9,0x1d,0xd,0x5008e,0x9,
|
||||
0x1e,0x1d,0x1c,0x50081,0x9,0x1f,0x17,0x1e,
|
||||
0x7000c,0x9,0x20,0x1,0x44,0x13,0x1f,0x5008e,
|
||||
0x9,0x21,0x20,0x11,0x50081,0x9,0x22,0x10,
|
||||
0x21,0x200fe,0x22,0x10038
|
||||
};
|
||||
@@ -13,29 +13,6 @@
|
||||
// copy on the session's queue; GLES: glTexSubImage2D in the app's context), then is submitted as usual.
|
||||
// * Any failure: the call returns the runtime's own result (as before), so nothing gets worse.
|
||||
#include <jni.h>
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <android/native_window_jni.h>
|
||||
#include <media/NdkImageReader.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#include "surface_video.h"
|
||||
|
||||
#define SURF_NATIVE_SLOTS 4
|
||||
typedef struct {
|
||||
AHardwareBuffer *buffer;
|
||||
VkImage image;
|
||||
VkImageView view;
|
||||
VkDeviceMemory memory;
|
||||
EGLImageKHR egl_image;
|
||||
GLuint texture;
|
||||
uint32_t width,height;
|
||||
int state; // 0 reusable, 1 worker writing, 2 published, 3 current/pending Vulkan sampler
|
||||
uint64_t seq;
|
||||
uint32_t source_width,source_height;
|
||||
int64_t source_time;
|
||||
surf_video_job video;
|
||||
int projected;
|
||||
} surf_native_slot;
|
||||
|
||||
#define SURF_MAX 8
|
||||
|
||||
@@ -72,9 +49,6 @@ typedef struct {
|
||||
VkCommandBuffer cmd;
|
||||
VkFence fence;
|
||||
int in_flight; // a copy was submitted and its fence not yet seen signalled
|
||||
int native_mode, native_pending, native_current, native_project;
|
||||
surf_video_job video_job;
|
||||
surf_native_slot native_slots[SURF_NATIVE_SLOTS];
|
||||
} surf_swapchain;
|
||||
|
||||
static pthread_mutex_t surf_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -94,7 +68,7 @@ static const char *surf_vs = "#version 300 es\nout vec2 uv;\nvoid main() {\n"
|
||||
" uv = p; gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}\n";
|
||||
// window row 0 (glReadPixels' first row) must hold the image's top: sample t = 1 - y (SurfaceTexture t=0 is the bottom)
|
||||
static const char *surf_fs = "#version 300 es\n#extension GL_OES_EGL_image_external_essl3 : require\n"
|
||||
"precision highp float;\nuniform samplerExternalOES tex;\nuniform mat4 st;\nin vec2 uv;\nout vec4 color;\n"
|
||||
"precision mediump float;\nuniform samplerExternalOES tex;\nuniform mat4 st;\nin vec2 uv;\nout vec4 color;\n"
|
||||
"void main() { color = texture(tex, (st * vec4(uv.x, 1.0 - uv.y, 0.0, 1.0)).xy); }\n";
|
||||
|
||||
typedef void (*PFN_glReadPixels_)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *);
|
||||
@@ -155,8 +129,6 @@ static void surf_fail(surf_swapchain *s, const char *why) {
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
}
|
||||
|
||||
#include "surface_native.c"
|
||||
|
||||
static void *surf_worker(void *arg) {
|
||||
surf_swapchain *s = arg;
|
||||
JNIEnv *env = NULL;
|
||||
@@ -177,7 +149,6 @@ static void *surf_worker(void *arg) {
|
||||
surf_fail(s, "EGL context failed");
|
||||
goto out;
|
||||
}
|
||||
if(s->native_mode){surf_native_worker(s,env,dpy);goto out;}
|
||||
// the SurfaceTexture's external texture, and the RGBA target the frames are drawn into
|
||||
p_glGenTextures(1, &ext_tex);
|
||||
p_glBindTexture(0x8D65 /* GL_TEXTURE_EXTERNAL_OES */, ext_tex);
|
||||
@@ -231,15 +202,10 @@ static void *surf_worker(void *arg) {
|
||||
size_t bytes = (size_t)s->width * s->height * 4;
|
||||
uint8_t *buf = malloc(bytes);
|
||||
int64_t last_ts = -1, window_frames = 0, window_start = 0;
|
||||
int64_t latch_ns = 0, read_ns = 0, copy_ns = 0, latch_calls = 0;
|
||||
while (!s->stop && buf) {
|
||||
struct timespec pause = {0, 8000000}; // ~120 checks a second: well above video frame rates
|
||||
nanosleep(&pause, NULL);
|
||||
int64_t tick = monotonic_ns();
|
||||
int latch_result = s_ast_update(ast);
|
||||
latch_ns += monotonic_ns() - tick;
|
||||
latch_calls++;
|
||||
if (latch_result != 0) continue;
|
||||
if (s_ast_update(ast) != 0) continue;
|
||||
int64_t ts = s_ast_timestamp(ast);
|
||||
if (ts == last_ts) continue; // no new frame latched
|
||||
last_ts = ts;
|
||||
@@ -255,15 +221,11 @@ static void *surf_worker(void *arg) {
|
||||
p_glBindVertexArray(vao);
|
||||
p_glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
s_glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
tick = monotonic_ns();
|
||||
s_glReadPixels(0, 0, (GLsizei)s->width, (GLsizei)s->height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
read_ns += monotonic_ns() - tick;
|
||||
GLenum err = p_glGetError();
|
||||
tick = monotonic_ns();
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
if (!err && s->pixels) { memcpy(s->pixels, buf, bytes); s->seq++; s->frames++; }
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
copy_ns += monotonic_ns() - tick;
|
||||
if (err) { static int warned; if (warned++ < 5) LOG("surface_emul: GL error 0x%x drawing a frame", err); }
|
||||
int64_t now = monotonic_ns();
|
||||
if (!window_start) {
|
||||
@@ -273,11 +235,7 @@ static void *surf_worker(void *arg) {
|
||||
if (++window_frames && now - window_start > 5000000000ll) {
|
||||
LOG("surface_emul: %.1f video frames/s, %d uploaded, %d upload failures", window_frames * 1e9 / (now - window_start),
|
||||
s->uploads, s->upload_failures);
|
||||
LOG("surface_emul: timing latch %.2f ms/call (%lld calls), readback %.2f ms/frame, publish %.2f ms/frame, timestamp %lld",
|
||||
latch_calls ? latch_ns / (1e6 * latch_calls) : 0.0, (long long)latch_calls,
|
||||
read_ns / (1e6 * window_frames), copy_ns / (1e6 * window_frames), (long long)ts);
|
||||
window_frames = 0;
|
||||
latch_ns = read_ns = copy_ns = latch_calls = 0;
|
||||
window_start = now;
|
||||
}
|
||||
}
|
||||
@@ -484,10 +442,6 @@ static XRAPI_ATTR XrResult XRAPI_CALL hook_xrCreateSwapchainAndroidSurfaceKHR(Xr
|
||||
s->handle = handle;
|
||||
s->width = info->width;
|
||||
s->height = info->height;
|
||||
s->native_pending=-1;
|
||||
s->native_current=-1;
|
||||
s->native_mode=surface_native && surf_vulkan && surf_native_load();
|
||||
s->native_project=s->native_mode;
|
||||
s->pixels = calloc((size_t)s->width * s->height, 4);
|
||||
uint32_t n = 0;
|
||||
if (surf_vulkan) {
|
||||
@@ -516,7 +470,6 @@ static XRAPI_ATTR XrResult XRAPI_CALL hook_xrCreateSwapchainAndroidSurfaceKHR(Xr
|
||||
if (!setup_ok) {
|
||||
LOG("surface_emul: setup failed (images %u, pixels %d): the panel stays empty", s->image_count, s->pixels != NULL);
|
||||
if (s->thread) { s->stop = 1; pthread_join(s->thread, NULL); }
|
||||
surf_native_destroy(s);
|
||||
if (destroy) destroy(handle);
|
||||
free(s->pixels);
|
||||
pthread_mutex_lock(&surf_lock); s->used = 0; pthread_mutex_unlock(&surf_lock);
|
||||
@@ -532,16 +485,13 @@ static XRAPI_ATTR XrResult XRAPI_CALL hook_xrCreateSwapchainAndroidSurfaceKHR(Xr
|
||||
}
|
||||
|
||||
// xrDestroySwapchain: an emulated swapchain's worker and surface go with it
|
||||
static void surf_projection_destroy(surf_swapchain *s);
|
||||
static void surf_on_destroy(XrSwapchain handle) {
|
||||
pthread_mutex_lock(&surf_lock);
|
||||
surf_swapchain *s = surf_find(handle);
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
if (!s) return;
|
||||
s->stop = 1;
|
||||
surf_projection_destroy(s);
|
||||
if (s->thread) pthread_join(s->thread, NULL);
|
||||
surf_native_destroy(s);
|
||||
if (surf_vm && s->surface) {
|
||||
JNIEnv *env = NULL;
|
||||
int attached = 0;
|
||||
@@ -558,5 +508,3 @@ static void surf_on_destroy(XrSwapchain handle) {
|
||||
pthread_mutex_unlock(&surf_lock);
|
||||
LOG("surface_emul: destroyed %p", (void *)(uintptr_t)handle);
|
||||
}
|
||||
|
||||
#include "surface_projection.c"
|
||||
@@ -1,165 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Immutable geometry/pose snapshot carried with a GPU-produced video view.
|
||||
#ifndef FRAMEBRIDGE_SURFACE_VIDEO_H
|
||||
#define FRAMEBRIDGE_SURFACE_VIDEO_H
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "layer_math.h"
|
||||
#define SURF_VIDEO_GUARD 1.12f
|
||||
// MediaCodec's timed surface releases carry CLOCK_MONOTONIC presentation times.
|
||||
// Untimed releases carry media PTS instead; those must not be treated as a clock.
|
||||
static int64_t surf_video_target(int64_t now,XrTime display_time) {
|
||||
return display_time>now-100000000ll && display_time<now+100000000ll?display_time:now;
|
||||
}
|
||||
static int surf_video_future(int64_t timestamp,int64_t now,int64_t target) {
|
||||
return timestamp>now-60000000000ll && timestamp<now+60000000000ll && timestamp>target;
|
||||
}
|
||||
// A wider frustum gives runtime timewarp real pixels beyond the visible view.
|
||||
// Keep the expanded FOV on the submitted image, not just on the shader rays.
|
||||
static XrFovf surf_video_guard_fov(XrFovf fov) {
|
||||
return (XrFovf){atanf(tanf(fov.angleLeft)*SURF_VIDEO_GUARD),
|
||||
atanf(tanf(fov.angleRight)*SURF_VIDEO_GUARD),
|
||||
atanf(tanf(fov.angleUp)*SURF_VIDEO_GUARD),
|
||||
atanf(tanf(fov.angleDown)*SURF_VIDEO_GUARD)};
|
||||
}
|
||||
typedef struct {
|
||||
uint64_t seq;
|
||||
XrTime time;
|
||||
XrSpace space;
|
||||
XrCompositionLayerFlags flags;
|
||||
uint32_t size;
|
||||
XrView views[2];
|
||||
XrPosef panorama[2];
|
||||
float params[2][32];
|
||||
} surf_video_job;
|
||||
// Reorient a projected infinite panorama with its layer, retaining the actual
|
||||
// camera rotation used to render it. Centre it on today's eye position because
|
||||
// an infinite panorama has no translational parallax. This needs no pixel copy.
|
||||
static XrPosef surf_video_pose(const surf_video_job *rendered,const surf_video_job *current,int eye) {
|
||||
XrPosef pose=rendered->views[eye].pose;
|
||||
if(rendered->space!=current->space || rendered->params[eye][7]!=0 || current->params[eye][7]!=0)return pose;
|
||||
if(memcmp(&rendered->panorama[eye].orientation,¤t->panorama[eye].orientation,sizeof(XrQuaternionf))){
|
||||
XrQuaternionf delta=lm_qmul(current->panorama[eye].orientation,lm_qconj(rendered->panorama[eye].orientation));
|
||||
pose.orientation=lm_qmul(delta,pose.orientation);
|
||||
}
|
||||
pose.position=current->views[eye].pose.position;
|
||||
return pose;
|
||||
}
|
||||
// Reuse a held picture only while the next visible frustum fits inside it.
|
||||
// The compositor still timewarps at headset cadence using the actual old pose.
|
||||
// Changed source frames, layer geometry or colour bypass this reuse policy.
|
||||
static int surf_video_frustum_covers(const surf_video_job *old,const surf_video_job *next,float margin) {
|
||||
if(!old->seq || old->size!=next->size || old->space!=next->space)return 0;
|
||||
for(int eye=0;eye<2;eye++){
|
||||
const float *a=old->params[eye],*b=next->params[eye];
|
||||
XrQuaternionf relative=lm_qmul(lm_qconj((XrQuaternionf){a[0],a[1],a[2],a[3]}),
|
||||
(XrQuaternionf){b[0],b[1],b[2],b[3]});
|
||||
for(int y=0;y<2;y++)for(int x=0;x<2;x++){
|
||||
XrVector3f ray=lm_rotate(relative,(XrVector3f){b[8+x]/SURF_VIDEO_GUARD,b[10+y]/SURF_VIDEO_GUARD,-1});
|
||||
if(ray.z>=-0.00001f)return 0;
|
||||
float u=ray.x/-ray.z,v=ray.y/-ray.z;
|
||||
if(u<a[8]*margin || u>a[9]*margin || v<a[10]*margin || v>a[11]*margin)return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
static int surf_video_covers_margin(const surf_video_job *old,const surf_video_job *next,float margin) {
|
||||
if(old->flags!=next->flags)return 0;
|
||||
for(int eye=0;eye<2;eye++){
|
||||
const float *a=old->params[eye],*b=next->params[eye];
|
||||
if(a[7]>0 && memcmp(&old->panorama[eye],&next->panorama[eye],sizeof(XrPosef)))return 0;
|
||||
if(a[7]!=b[7] || memcmp(a+12,b+12,20*sizeof(float)) ||
|
||||
(a[7]>0 && memcmp(a+4,b+4,3*sizeof(float))))return 0;
|
||||
}
|
||||
return surf_video_frustum_covers(old,next,margin);
|
||||
}
|
||||
static int surf_video_covers(const surf_video_job *old,const surf_video_job *next) {
|
||||
// Request a new sampling camera before the visible view reaches the outer
|
||||
// guard. The worker/copy handoff needs reserve while that update is in flight.
|
||||
return surf_video_covers_margin(old,next,.94f);
|
||||
}
|
||||
// Opaque decoded YUV can occlude earlier layers only when every pixel of the
|
||||
// rendered, guarded stereo frustum lies in its 180-degree hemisphere. Keep
|
||||
// ordinary composition during fades, outside coverage, and for other shapes.
|
||||
static int surf_video_occludes(const surf_video_job *rendered,const surf_video_job *current) {
|
||||
// Occlusion uses actual image coverage, not the worker's earlier redraw
|
||||
// threshold. Otherwise each asynchronous camera update switches primary
|
||||
// layers briefly even though the completed image still covers both eyes.
|
||||
if(rendered->flags!=current->flags || !surf_video_frustum_covers(rendered,current,1.0f))return 0;
|
||||
for(int eye=0;eye<2;eye++){
|
||||
const float *p=rendered->params[eye];
|
||||
const float *q=current->params[eye];
|
||||
// RGB/source changes require fresh pixels, not a different composition
|
||||
// path. Require both the submitted picture and requested fade opaque.
|
||||
if(q[7]!=0 || !isfinite(q[27]+q[31]) || q[27]+q[31]<1.0f)return 0;
|
||||
if(p[7]!=0 || fabsf(p[16]-LM_PI)>.00001f ||
|
||||
fabsf(p[17]-LM_PI*.5f)>.00001f || fabsf(p[18]+LM_PI*.5f)>.00001f ||
|
||||
!isfinite(p[27]+p[31]) || p[27]+p[31]<1.0f ||
|
||||
p[12]<0 || p[13]<0 || p[14]<=0 || p[15]<=0 ||
|
||||
p[12]+p[14]>1.0f || p[13]+p[15]>1.0f)return 0;
|
||||
XrQuaternionf rotation={p[0],p[1],p[2],p[3]};
|
||||
for(int y=0;y<2;y++)for(int x=0;x<2;x++){
|
||||
XrVector3f ray=lm_rotate(rotation,(XrVector3f){p[8+x],p[10+y],-1});
|
||||
if(!isfinite(ray.z) || ray.z>=-.01f)return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
// A primary projection must describe one rigid stereo camera. Retarget the
|
||||
// infinite panorama's centre to the current head position, but rotate the eye
|
||||
// offsets with the actual camera orientation carried by its rendered pixels.
|
||||
static XrPosef surf_video_primary_pose(const surf_video_job *rendered,const surf_video_job *current,int eye) {
|
||||
XrPosef pose=surf_video_pose(rendered,current,eye);
|
||||
XrVector3f centre={
|
||||
(current->views[0].pose.position.x+current->views[1].pose.position.x)*.5f,
|
||||
(current->views[0].pose.position.y+current->views[1].pose.position.y)*.5f,
|
||||
(current->views[0].pose.position.z+current->views[1].pose.position.z)*.5f};
|
||||
XrVector3f offset={current->views[eye].pose.position.x-centre.x,
|
||||
current->views[eye].pose.position.y-centre.y,current->views[eye].pose.position.z-centre.z};
|
||||
offset=lm_rotate(lm_qmul(pose.orientation,lm_qconj(current->views[eye].pose.orientation)),offset);
|
||||
pose.position=(XrVector3f){centre.x+offset.x,centre.y+offset.y,centre.z+offset.z};
|
||||
return pose;
|
||||
}
|
||||
// A fresh movie picture does not require a fresh camera direction. While the
|
||||
// visible view fits, keep its panorama-local sampling grid stable across movie
|
||||
// frames. This avoids encoding tracking motion into the video textures at the
|
||||
// decoder's cadence. Tracking remains the compositor's responsibility. Carry
|
||||
// the real anchored camera/FOV with the pixels; never relabel them as a new view.
|
||||
// Re-anchor at the newest requested view when either eye leaves the guard band
|
||||
// or the reference space changes. Source/colour updates keep this camera but
|
||||
// are still rendered with the current mapping/colour. Finite spheres unchanged.
|
||||
static int surf_video_anchor(const surf_video_job *old,const surf_video_job *current,surf_video_job *draw) {
|
||||
*draw=*current;
|
||||
if(old->params[0][7]!=0 || old->params[1][7]!=0 || current->params[0][7]!=0 || current->params[1][7]!=0 ||
|
||||
!surf_video_frustum_covers(old,current,.94f))return 0;
|
||||
for(int eye=0;eye<2;eye++){
|
||||
draw->views[eye]=old->views[eye];
|
||||
const float *p=old->params[eye];
|
||||
// Reconstruct from the fixed sampling quaternion, not a succession of
|
||||
// layer deltas, so long cutscenes cannot accumulate pose-rounding drift.
|
||||
draw->views[eye].pose.orientation=lm_qmul(current->panorama[eye].orientation,(XrQuaternionf){p[0],p[1],p[2],p[3]});
|
||||
draw->views[eye].pose.position=current->views[eye].pose.position;
|
||||
memcpy(draw->params[eye],old->params[eye],12*sizeof(float));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
// Same ray/sphere mapping as the Vulkan reference shader, sampled directly
|
||||
// from the decoder's external YUV texture. No full-size RGB intermediate.
|
||||
static const char *surf_video_fragment=
|
||||
"#version 300 es\n#extension GL_OES_EGL_image_external_essl3 : require\n"
|
||||
"precision highp float;uniform samplerExternalOES tex;in vec2 uv;out vec4 color;"
|
||||
"uniform vec4 rotation,originRadius,tans,rect,anglesEye,scaleBias,colorScale,colorBias;"
|
||||
"vec3 rotate(vec4 q,vec3 v){return v+2.0*cross(q.xyz,cross(q.xyz,v)+q.w*v);}"
|
||||
"void main(){vec3 d=normalize(rotate(rotation,vec3(mix(tans.x,tans.y,uv.x),mix(tans.w,tans.z,uv.y),-1.0)));"
|
||||
"if(originRadius.w>0.0){vec3 o=originRadius.xyz;float b=dot(o,d),disc=b*b+originRadius.w*originRadius.w-dot(o,o);"
|
||||
"if(disc<0.0){color=vec4(0);return;}float distance=-b+sqrt(disc);"
|
||||
"if(distance<=0.0){color=vec4(0);return;}d=normalize(o+distance*d);}"
|
||||
"float lon=atan(d.x,-d.z),lat=asin(clamp(d.y,-1.0,1.0));vec2 eq;"
|
||||
"if(anglesEye.x>0.0)eq=vec2(lon/anglesEye.x+0.5,(lat-anglesEye.z)/(anglesEye.y-anglesEye.z));"
|
||||
"else eq=vec2(lon/6.28318530718+0.5,lat/3.14159265359+0.5)*scaleBias.xy+scaleBias.zw;"
|
||||
"color=vec4(0);if(all(greaterThanEqual(eq,vec2(0)))&&all(lessThanEqual(eq,vec2(1))))"
|
||||
"color=clamp(texture(tex,rect.xy+vec2(eq.x,1.0-eq.y)*rect.zw)*colorScale+colorBias,0.0,1.0);}"
|
||||
;
|
||||
static const char *surf_video_uniforms[8]={"rotation","originRadius","tans","rect",
|
||||
"anglesEye","scaleBias","colorScale","colorBias"};
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Use the views belonging to the submitted frame before sampling tracking again.
|
||||
// Cached application views are eligible only for the exact session/display time.
|
||||
#ifndef FRAMEBRIDGE_SURFACE_VIEWS_H
|
||||
#define FRAMEBRIDGE_SURFACE_VIEWS_H
|
||||
#include <pthread.h>
|
||||
#include "layer_math.h"
|
||||
static pthread_mutex_t surf_views_lock=PTHREAD_MUTEX_INITIALIZER;
|
||||
static struct {
|
||||
XrSession session;
|
||||
XrSpace space;
|
||||
XrTime time;
|
||||
XrView views[2];
|
||||
} surf_view_cache[4];
|
||||
static void surf_views_record(XrSession session,const XrViewLocateInfo *info,const XrViewState *state,
|
||||
uint32_t count,const XrView *views) {
|
||||
if(!info || !state || !views || count!=2 || !info->displayTime ||
|
||||
!(state->viewStateFlags&XR_VIEW_STATE_ORIENTATION_VALID_BIT))return;
|
||||
pthread_mutex_lock(&surf_views_lock);
|
||||
int slot=0;
|
||||
for(int i=0;i<4;i++){
|
||||
if(surf_view_cache[i].session==session && surf_view_cache[i].space==info->space){slot=i;break;}
|
||||
if(surf_view_cache[i].time<surf_view_cache[slot].time)slot=i;
|
||||
}
|
||||
surf_view_cache[slot].session=session;surf_view_cache[slot].space=info->space;
|
||||
surf_view_cache[slot].time=info->displayTime;
|
||||
surf_view_cache[slot].views[0]=views[0];surf_view_cache[slot].views[1]=views[1];
|
||||
pthread_mutex_unlock(&surf_views_lock);
|
||||
}
|
||||
// 1 = submitted projection views, 2 = exact application locate, 0 = not available.
|
||||
static int surf_views_select(XrSession session,const XrFrameEndInfo *frame,XrSpace space,
|
||||
PFN_xrLocateSpace locate,XrView views[2]) {
|
||||
if(!frame)return 0;
|
||||
for(uint32_t i=0;i<frame->layerCount;i++){
|
||||
const XrCompositionLayerBaseHeader *layer=frame->layers[i];
|
||||
if(!layer || layer->type!=XR_TYPE_COMPOSITION_LAYER_PROJECTION)continue;
|
||||
const XrCompositionLayerProjection *projection=(const void*)layer;
|
||||
if(projection->viewCount!=2 || !projection->views)continue;
|
||||
XrPosef transform={{0,0,0,1},{0,0,0}};
|
||||
if(projection->space!=space){
|
||||
XrSpaceLocation location={XR_TYPE_SPACE_LOCATION,NULL,0,{{0,0,0,1},{0,0,0}}};
|
||||
XrSpaceLocationFlags valid=XR_SPACE_LOCATION_ORIENTATION_VALID_BIT|XR_SPACE_LOCATION_POSITION_VALID_BIT;
|
||||
if(!locate || XR_FAILED(locate(projection->space,space,frame->displayTime,&location)) ||
|
||||
(location.locationFlags&valid)!=valid)continue;
|
||||
transform=location.pose;
|
||||
}
|
||||
for(int eye=0;eye<2;eye++){
|
||||
views[eye].pose=lm_pose_mul(transform,projection->views[eye].pose);
|
||||
views[eye].fov=projection->views[eye].fov;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int found=0;
|
||||
pthread_mutex_lock(&surf_views_lock);
|
||||
for(int i=0;i<4;i++)if(surf_view_cache[i].session==session && surf_view_cache[i].space==space &&
|
||||
surf_view_cache[i].time==frame->displayTime){
|
||||
views[0]=surf_view_cache[i].views[0];views[1]=surf_view_cache[i].views[1];found=2;break;
|
||||
}
|
||||
pthread_mutex_unlock(&surf_views_lock);return found;
|
||||
}
|
||||
#endif
|
||||
@@ -5,12 +5,12 @@ Everything is fetched on demand into native/.cache (git-ignored):
|
||||
- Android NDK r27c (27.2.12479018) from Google's repository (checksummed via repository2-3.xml)
|
||||
- OpenXR headers at the commits each component was written against (KhronosGroup/OpenXR-SDK)
|
||||
- Temurin JDK 21 (javac) and Android build-tools (d8) for the Java stub classes
|
||||
Then builds: FrameBridge adapter (arm64 + arm32), VrApi bridge, platform compat, language packs, GL shim, multiview twin interposer (glmv), oculusos stub dex, the
|
||||
Then builds: FrameBridge adapter (arm64 + arm32), VrApi bridge, platform compat, language packs, GL shim, oculusos stub dex, the
|
||||
timefix OpenXR layer for Proton games (linux-arm64, glibc; the NDK's clang builds it freestanding), the
|
||||
OculusHMDConnected helper for Rift games under Proton (win-x64 PE; the NDK's clang + lld-link, no Windows SDK), the
|
||||
live view's hardware H.264 encoder fp_venc (linux-arm64-bin, static freestanding executable), and rewrites artifacts/SHA256SUMS. Run `frameport parity` afterwards to see which games change.
|
||||
|
||||
python native/build.py [--only adapter,bridge,compat,langpack,glshim,eglfmt,glmv,ovrtrace,dex,xrlayer,oculushmd,xrshim,vkshim,zinkfix,ovrpshim,vrsettings,venc] [--ndk PATH]
|
||||
python native/build.py [--only adapter,bridge,compat,langpack,glshim,eglfmt,ovrtrace,dex,xrlayer,oculushmd,xrshim,vkshim,ovrpshim,vrsettings,venc] [--ndk PATH]
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -275,17 +275,6 @@ def build_eglfmt(tc: Path):
|
||||
"-Wl,--no-as-needed", "-lEGL", "-Wl,--as-needed", "-ldl", "-llog", "-o", ART / "arm64-v8a/libfpg.so"], cwd=src)
|
||||
|
||||
|
||||
def build_glmv(tc: Path):
|
||||
"""Single-view draws of OVR_multiview programs (see glmv/glmv.c, frame.gl_multiview_fbo). Named libfpglmv.so: as
|
||||
long as "libGLESv3.so", whose dlopen string in the engine is rewritten in place. Linked to libGLESv3 so a dlsym on
|
||||
its handle still finds every GL function it doesn't wrap."""
|
||||
src = HERE / "glmv"
|
||||
run([exe(tc, "aarch64-linux-android29-clang"), "-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
"-fvisibility=hidden", f"-ffile-prefix-map={src}=native/glmv", "-Wl,-soname,libfpglmv.so",
|
||||
"-Wl,-z,max-page-size=16384", "glmv.c", "-Wl,--no-as-needed", "-lGLESv3", "-Wl,--as-needed", "-lEGL", "-ldl",
|
||||
"-llog", "-o", ART / "arm64-v8a/libfpglmv.so"], cwd=src)
|
||||
|
||||
|
||||
def build_ovrtrace(tc: Path):
|
||||
"""Meta Platform SDK tracer (see ovrtrace/ovrtrace.c): diagnostics, the game's engine library loads it first."""
|
||||
src = HERE / "ovrtrace"
|
||||
@@ -311,14 +300,6 @@ def build_vkshim(tc: Path):
|
||||
cwd=src)
|
||||
|
||||
|
||||
def build_zinkfix(tc: Path):
|
||||
"""Shader-fix Vulkan layer for OpenGL ES games (see zinkfix/zinkfix.c): between Zink and the driver."""
|
||||
src = HERE / "zinkfix"
|
||||
run([exe(tc, "aarch64-linux-android29-clang"), "-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
"-fvisibility=hidden", "-Wl,-soname,libVkLayer_fp_shaderfix.so", "-Wl,-z,max-page-size=16384", "zinkfix.c",
|
||||
"-ldl", "-llog", "-o", ART / "arm64-v8a/libVkLayer_fp_shaderfix.so"], cwd=src)
|
||||
|
||||
|
||||
def build_ovrpshim(tc: Path):
|
||||
"""OVRPlugin frame-loop shim (see ovrpshim/ovrpshim.c) for Unity 2017-2018 built-in Oculus support."""
|
||||
src = HERE / "ovrpshim"
|
||||
@@ -371,7 +352,7 @@ def write_sums():
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--only", default="adapter,bridge,compat,langpack,glshim,eglfmt,glmv,ovrtrace,dex,xrlayer,oculushmd,xrshim,vkshim,zinkfix,ovrpshim,vrsettings,venc")
|
||||
ap.add_argument("--only", default="adapter,bridge,compat,langpack,glshim,eglfmt,ovrtrace,dex,xrlayer,oculushmd,xrshim,vkshim,ovrpshim,vrsettings,venc")
|
||||
ap.add_argument("--ndk")
|
||||
args = ap.parse_args()
|
||||
parts = set(args.only.split(","))
|
||||
@@ -380,12 +361,11 @@ def main():
|
||||
tc = clang_dir(ndk(args.ndk)) if parts - {"dex"} else None
|
||||
steps = {"adapter": lambda: build_adapter(tc), "bridge": lambda: build_bridge(tc), "compat": lambda: build_compat(tc),
|
||||
"langpack": lambda: build_langpack(tc),
|
||||
"glshim": lambda: build_glshim(tc), "eglfmt": lambda: build_eglfmt(tc), "glmv": lambda: build_glmv(tc), "ovrtrace": lambda: build_ovrtrace(tc), "xrshim": lambda: build_xrshim(tc), "dex": build_dex, "xrlayer": lambda: build_xrlayer(tc),
|
||||
"glshim": lambda: build_glshim(tc), "eglfmt": lambda: build_eglfmt(tc), "ovrtrace": lambda: build_ovrtrace(tc), "xrshim": lambda: build_xrshim(tc), "dex": build_dex, "xrlayer": lambda: build_xrlayer(tc),
|
||||
"oculushmd": lambda: build_oculushmd(tc), "vkshim": lambda: build_vkshim(tc),
|
||||
"zinkfix": lambda: build_zinkfix(tc),
|
||||
"ovrpshim": lambda: build_ovrpshim(tc),
|
||||
"vrsettings": lambda: build_vrsettings(tc), "venc": lambda: build_venc(tc)}
|
||||
for name in ("adapter", "bridge", "compat", "langpack", "glshim", "eglfmt", "glmv", "ovrtrace", "xrshim", "vkshim", "zinkfix", "ovrpshim", "dex", "xrlayer", "oculushmd", "vrsettings", "venc"):
|
||||
for name in ("adapter", "bridge", "compat", "langpack", "glshim", "eglfmt", "ovrtrace", "xrshim", "vkshim", "ovrpshim", "dex", "xrlayer", "oculushmd", "vrsettings", "venc"):
|
||||
if name in parts:
|
||||
log(f"build {name}")
|
||||
steps[name]()
|
||||
|
||||
@@ -1,704 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// libfpglmv.so: single-view draws of OVR_multiview programs (frame.gl_multiview_fbo, GitHub #77).
|
||||
//
|
||||
// OVR_multiview says a draw is INVALID_OPERATION when the number of views of the draw framebuffer differs from the
|
||||
// num_views the program's vertex shader declares. Qualcomm's Quest driver tolerates it; Mesa (the Frame's GL, Zink)
|
||||
// enforces it (src/mesa/main/draw_validate.c) and drops the draw silently. Engines that compile every shader with
|
||||
// `layout(num_views=2) in;` and also draw into ordinary 2D framebuffers (Doom3Quest's HUD/PDA pool: glTexImage2D
|
||||
// textures + renderbuffers) then get black panels.
|
||||
//
|
||||
// This library sits between such an engine and libGLESv3: the patch puts it first in the engine library's DT_NEEDED
|
||||
// (direct gl* imports bind here) and points the engine's dlopen("libGLESv3.so") at it (same-length name, so its
|
||||
// qgl* table from dlsym binds here too); every function it doesn't define resolves to libGLESv3 through its own
|
||||
// dependency (linked --no-as-needed). When a multiview program draws into a framebuffer whose color attachment has no
|
||||
// views (2D texture, texture layer, renderbuffer, FBO 0), the draw uses a lazily built single-view twin of the program
|
||||
// (glmv_rewrite.h: num_views layout removed, gl_ViewID_OVR -> 0u), with the original's attribute locations, uniform
|
||||
// block bindings and default-block uniform values (copied before every such draw), then the original is bound again.
|
||||
//
|
||||
// Logcat tag GLMV. Setting gl_mv_debug=1 (libframe_settings.so / framebridge.conf / FRAMEBRIDGE_CONFIG, as the GL
|
||||
// shim): glGetError after every twin draw, and per-5-s counters.
|
||||
#define _GNU_SOURCE
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES3/gl32.h>
|
||||
#include <android/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "glmv_rewrite.h"
|
||||
|
||||
#define TAG "GLMV"
|
||||
#define LOG(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#ifndef GLMV_GLES_LIB // (the host test points these at a stand-in GL library)
|
||||
#define GLMV_GLES_LIB "libGLESv3.so"
|
||||
#define GLMV_EGL_LIB "libEGL.so"
|
||||
#endif
|
||||
#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------- real functions (only ever from libGLESv3's handle)
|
||||
#define REAL_LIST(X) \
|
||||
X(void, UseProgram, (GLuint)) \
|
||||
X(void, LinkProgram, (GLuint)) \
|
||||
X(void, DeleteProgram, (GLuint)) \
|
||||
X(void, BindFramebuffer, (GLenum, GLuint)) \
|
||||
X(void, DeleteFramebuffers, (GLsizei, const GLuint *)) \
|
||||
X(void, FramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint)) \
|
||||
X(void, FramebufferRenderbuffer, (GLenum, GLenum, GLenum, GLuint)) \
|
||||
X(void, FramebufferTextureLayer, (GLenum, GLenum, GLuint, GLint, GLint)) \
|
||||
X(void, FramebufferTexture, (GLenum, GLenum, GLuint, GLint)) \
|
||||
X(void, DrawBuffers, (GLsizei, const GLenum *)) \
|
||||
X(void, DrawArrays, (GLenum, GLint, GLsizei)) \
|
||||
X(void, DrawElements, (GLenum, GLsizei, GLenum, const void *)) \
|
||||
X(void, DrawArraysInstanced, (GLenum, GLint, GLsizei, GLsizei)) \
|
||||
X(void, DrawElementsInstanced, (GLenum, GLsizei, GLenum, const void *, GLsizei)) \
|
||||
X(void, DrawRangeElements, (GLenum, GLuint, GLuint, GLsizei, GLenum, const void *)) \
|
||||
X(void, DrawArraysIndirect, (GLenum, const void *)) \
|
||||
X(void, DrawElementsIndirect, (GLenum, GLenum, const void *)) \
|
||||
X(void, DrawElementsBaseVertex, (GLenum, GLsizei, GLenum, const void *, GLint)) \
|
||||
X(void, DrawRangeElementsBaseVertex, (GLenum, GLuint, GLuint, GLsizei, GLenum, const void *, GLint)) \
|
||||
X(void, DrawElementsInstancedBaseVertex, (GLenum, GLsizei, GLenum, const void *, GLsizei, GLint)) \
|
||||
X(GLenum, GetError, (void)) \
|
||||
X(void, GetIntegerv, (GLenum, GLint *)) \
|
||||
X(void, GetFramebufferAttachmentParameteriv, (GLenum, GLenum, GLenum, GLint *)) \
|
||||
X(void, GetProgramiv, (GLuint, GLenum, GLint *)) \
|
||||
X(void, GetProgramInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \
|
||||
X(void, GetShaderiv, (GLuint, GLenum, GLint *)) \
|
||||
X(void, GetShaderInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \
|
||||
X(void, GetShaderSource, (GLuint, GLsizei, GLsizei *, GLchar *)) \
|
||||
X(void, GetAttachedShaders, (GLuint, GLsizei, GLsizei *, GLuint *)) \
|
||||
X(GLuint, CreateShader, (GLenum)) \
|
||||
X(void, ShaderSource, (GLuint, GLsizei, const GLchar *const *, const GLint *)) \
|
||||
X(void, CompileShader, (GLuint)) \
|
||||
X(void, DeleteShader, (GLuint)) \
|
||||
X(GLuint, CreateProgram, (void)) \
|
||||
X(void, AttachShader, (GLuint, GLuint)) \
|
||||
X(void, BindAttribLocation, (GLuint, GLuint, const GLchar *)) \
|
||||
X(void, GetActiveAttrib, (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *)) \
|
||||
X(GLint, GetAttribLocation, (GLuint, const GLchar *)) \
|
||||
X(void, GetActiveUniform, (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *)) \
|
||||
X(void, GetActiveUniformsiv, (GLuint, GLsizei, const GLuint *, GLenum, GLint *)) \
|
||||
X(GLint, GetUniformLocation, (GLuint, const GLchar *)) \
|
||||
X(void, GetUniformfv, (GLuint, GLint, GLfloat *)) \
|
||||
X(void, GetUniformiv, (GLuint, GLint, GLint *)) \
|
||||
X(void, GetUniformuiv, (GLuint, GLint, GLuint *)) \
|
||||
X(void, GetActiveUniformBlockName, (GLuint, GLuint, GLsizei, GLsizei *, GLchar *)) \
|
||||
X(void, GetActiveUniformBlockiv, (GLuint, GLuint, GLenum, GLint *)) \
|
||||
X(GLuint, GetUniformBlockIndex, (GLuint, const GLchar *)) \
|
||||
X(void, UniformBlockBinding, (GLuint, GLuint, GLuint)) \
|
||||
X(void, Uniform1fv, (GLint, GLsizei, const GLfloat *)) \
|
||||
X(void, Uniform2fv, (GLint, GLsizei, const GLfloat *)) \
|
||||
X(void, Uniform3fv, (GLint, GLsizei, const GLfloat *)) \
|
||||
X(void, Uniform4fv, (GLint, GLsizei, const GLfloat *)) \
|
||||
X(void, Uniform1iv, (GLint, GLsizei, const GLint *)) \
|
||||
X(void, Uniform2iv, (GLint, GLsizei, const GLint *)) \
|
||||
X(void, Uniform3iv, (GLint, GLsizei, const GLint *)) \
|
||||
X(void, Uniform4iv, (GLint, GLsizei, const GLint *)) \
|
||||
X(void, Uniform1uiv, (GLint, GLsizei, const GLuint *)) \
|
||||
X(void, Uniform2uiv, (GLint, GLsizei, const GLuint *)) \
|
||||
X(void, Uniform3uiv, (GLint, GLsizei, const GLuint *)) \
|
||||
X(void, Uniform4uiv, (GLint, GLsizei, const GLuint *)) \
|
||||
X(void, UniformMatrix2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix2x3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix3x2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix2x4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix4x2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix3x4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \
|
||||
X(void, UniformMatrix4x3fv, (GLint, GLsizei, GLboolean, const GLfloat *))
|
||||
|
||||
#define DECL(ret, name, args) static ret(*r_##name) args;
|
||||
REAL_LIST(DECL)
|
||||
#undef DECL
|
||||
typedef void (*PFN_FTMV)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei);
|
||||
typedef void (*PFN_FTMSMV)(GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei);
|
||||
static PFN_FTMV r_ftmv;
|
||||
static PFN_FTMSMV r_ftmsmv;
|
||||
static __eglMustCastToProperFunctionPointerType (*r_eglGetProcAddress)(const char *);
|
||||
static EGLBoolean (*r_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext);
|
||||
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
static int debug;
|
||||
|
||||
static void read_conf_file(const char *path) {
|
||||
FILE *f = fopen(path, "r");
|
||||
if (!f) return;
|
||||
char line[256];
|
||||
while (fgets(line, sizeof(line), f))
|
||||
if (!strncmp(line, "gl_mv_debug=", 12)) debug = atoi(line + 12);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// The GL shim's settings sources, later ones winning: libframe_settings.so next to this library, the game's
|
||||
// framebridge.conf, then FRAMEBRIDGE_CONFIG (Lepton's per-game settings.conf).
|
||||
static void read_conf(void) {
|
||||
Dl_info info;
|
||||
char path[600];
|
||||
if (dladdr((void *)read_conf, &info) && info.dli_fname) {
|
||||
const char *slash = strrchr(info.dli_fname, '/');
|
||||
if (slash && slash - info.dli_fname < 500) {
|
||||
snprintf(path, sizeof(path), "%.*s/libframe_settings.so", (int)(slash - info.dli_fname), info.dli_fname);
|
||||
read_conf_file(path);
|
||||
}
|
||||
}
|
||||
char pkg[256] = {0};
|
||||
FILE *f = fopen("/proc/self/cmdline", "r");
|
||||
if (f) {
|
||||
size_t n = fread(pkg, 1, sizeof(pkg) - 1, f);
|
||||
fclose(f);
|
||||
pkg[n] = 0;
|
||||
}
|
||||
char *colon = strchr(pkg, ':');
|
||||
if (colon) *colon = 0;
|
||||
if (*pkg && !strchr(pkg, '/')) {
|
||||
snprintf(path, sizeof(path), "/sdcard/Android/data/%s/files/framebridge.conf", pkg);
|
||||
read_conf_file(path);
|
||||
}
|
||||
const char *env = getenv("FRAMEBRIDGE_CONFIG");
|
||||
if (env && *env) read_conf_file(env);
|
||||
}
|
||||
|
||||
static void init(void) {
|
||||
read_conf();
|
||||
void *gles = dlopen(GLMV_GLES_LIB, RTLD_NOW | RTLD_LOCAL);
|
||||
void *egl = dlopen(GLMV_EGL_LIB, RTLD_NOW | RTLD_LOCAL);
|
||||
r_eglGetProcAddress = egl ? dlsym(egl, "eglGetProcAddress") : NULL;
|
||||
r_eglMakeCurrent = egl ? dlsym(egl, "eglMakeCurrent") : NULL;
|
||||
int missing = 0;
|
||||
#define LOAD(ret, name, args) \
|
||||
r_##name = gles ? (ret(*) args)dlsym(gles, "gl" #name) : NULL; \
|
||||
if (!r_##name && r_eglGetProcAddress) r_##name = (ret(*) args)r_eglGetProcAddress("gl" #name); \
|
||||
missing += !r_##name;
|
||||
REAL_LIST(LOAD)
|
||||
#undef LOAD
|
||||
if (r_eglGetProcAddress) {
|
||||
r_ftmv = (PFN_FTMV)r_eglGetProcAddress("glFramebufferTextureMultiviewOVR");
|
||||
r_ftmsmv = (PFN_FTMSMV)r_eglGetProcAddress("glFramebufferTextureMultisampleMultiviewOVR");
|
||||
}
|
||||
LOG("library active: single-view draws of multiview programs (gl_mv_debug=%d, %d GL functions missing)", debug,
|
||||
missing);
|
||||
}
|
||||
#define INIT() pthread_once(&once, init)
|
||||
|
||||
// ---------------------------------------------------------------- programs
|
||||
struct uni {
|
||||
GLenum type;
|
||||
GLint orig, var; // locations in the original and the twin
|
||||
GLuint shadow[16]; // last value given to the twin
|
||||
int valid;
|
||||
};
|
||||
struct block {
|
||||
GLuint orig_index, var_index;
|
||||
GLint binding; // last binding given to the twin
|
||||
};
|
||||
struct prog {
|
||||
GLuint id;
|
||||
int multiview; // the vertex shader declares num_views
|
||||
int nshaders;
|
||||
GLenum types[6];
|
||||
char *sources[6]; // stage sources at link time (only kept for multiview programs)
|
||||
GLuint twin; // single-view twin, 0 = not built yet
|
||||
int twin_failed;
|
||||
struct uni *unis;
|
||||
int nunis;
|
||||
struct block *blocks;
|
||||
int nblocks;
|
||||
};
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static struct prog **progs; // indexed by program name (GL names are small integers)
|
||||
static GLuint nprogs;
|
||||
|
||||
static struct prog *find_prog(GLuint id, int create) {
|
||||
struct prog *p = NULL;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (id < nprogs) p = progs[id];
|
||||
if (!p && create && id < (1u << 24)) {
|
||||
if (id >= nprogs) {
|
||||
GLuint n = nprogs ? nprogs : 256;
|
||||
while (n <= id) n *= 2;
|
||||
struct prog **grown = realloc(progs, n * sizeof(*grown));
|
||||
if (grown) {
|
||||
memset(grown + nprogs, 0, (n - nprogs) * sizeof(*grown));
|
||||
progs = grown;
|
||||
nprogs = n;
|
||||
}
|
||||
}
|
||||
if (id < nprogs && (p = calloc(1, sizeof(*p)))) {
|
||||
p->id = id;
|
||||
progs[id] = p;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void drop_twin(struct prog *p) {
|
||||
if (p->twin && r_DeleteProgram) r_DeleteProgram(p->twin);
|
||||
p->twin = 0;
|
||||
p->twin_failed = 0;
|
||||
free(p->unis);
|
||||
p->unis = NULL;
|
||||
p->nunis = 0;
|
||||
free(p->blocks);
|
||||
p->blocks = NULL;
|
||||
p->nblocks = 0;
|
||||
}
|
||||
|
||||
static void drop_sources(struct prog *p) {
|
||||
for (int i = 0; i < p->nshaders; ++i) free(p->sources[i]);
|
||||
p->nshaders = 0;
|
||||
p->multiview = 0;
|
||||
}
|
||||
|
||||
static char *shader_source(GLuint sh) {
|
||||
GLint len = 0;
|
||||
r_GetShaderiv(sh, GL_SHADER_SOURCE_LENGTH, &len);
|
||||
if (len <= 0) return NULL;
|
||||
char *src = malloc((size_t)len + 1);
|
||||
if (!src) return NULL;
|
||||
GLsizei got = 0;
|
||||
r_GetShaderSource(sh, len, &got, src);
|
||||
src[got > 0 && got <= len ? got : 0] = 0;
|
||||
return src;
|
||||
}
|
||||
|
||||
// Before the real link: note whether the program is multiview and keep its stage sources for a later twin.
|
||||
static void note_program(GLuint id) {
|
||||
struct prog *p = find_prog(id, 1);
|
||||
if (!p) return;
|
||||
drop_twin(p);
|
||||
drop_sources(p);
|
||||
GLuint shaders[6];
|
||||
GLsizei n = 0;
|
||||
r_GetAttachedShaders(id, 6, &n, shaders);
|
||||
for (GLsizei i = 0; i < n && i < 6; ++i) {
|
||||
GLint type = 0;
|
||||
r_GetShaderiv(shaders[i], GL_SHADER_TYPE, &type);
|
||||
char *src = shader_source(shaders[i]);
|
||||
if (!src) continue;
|
||||
if (type == GL_VERTEX_SHADER && glmv_has_num_views(src)) p->multiview = 1;
|
||||
p->types[p->nshaders] = (GLenum)type;
|
||||
p->sources[p->nshaders++] = src;
|
||||
}
|
||||
if (!p->multiview) drop_sources(p);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- the single-view twin
|
||||
static int components(GLenum type, int *kind) { // kind: 0 float, 1 int/bool/sampler, 2 uint, 3 matrix
|
||||
switch (type) {
|
||||
case GL_FLOAT: *kind = 0; return 1;
|
||||
case GL_FLOAT_VEC2: *kind = 0; return 2;
|
||||
case GL_FLOAT_VEC3: *kind = 0; return 3;
|
||||
case GL_FLOAT_VEC4: *kind = 0; return 4;
|
||||
case GL_INT: case GL_BOOL: *kind = 1; return 1;
|
||||
case GL_INT_VEC2: case GL_BOOL_VEC2: *kind = 1; return 2;
|
||||
case GL_INT_VEC3: case GL_BOOL_VEC3: *kind = 1; return 3;
|
||||
case GL_INT_VEC4: case GL_BOOL_VEC4: *kind = 1; return 4;
|
||||
case GL_UNSIGNED_INT: *kind = 2; return 1;
|
||||
case GL_UNSIGNED_INT_VEC2: *kind = 2; return 2;
|
||||
case GL_UNSIGNED_INT_VEC3: *kind = 2; return 3;
|
||||
case GL_UNSIGNED_INT_VEC4: *kind = 2; return 4;
|
||||
case GL_FLOAT_MAT2: *kind = 3; return 4;
|
||||
case GL_FLOAT_MAT3: *kind = 3; return 9;
|
||||
case GL_FLOAT_MAT4: *kind = 3; return 16;
|
||||
case GL_FLOAT_MAT2x3: case GL_FLOAT_MAT3x2: *kind = 3; return 6;
|
||||
case GL_FLOAT_MAT2x4: case GL_FLOAT_MAT4x2: *kind = 3; return 8;
|
||||
case GL_FLOAT_MAT3x4: case GL_FLOAT_MAT4x3: *kind = 3; return 12;
|
||||
default: *kind = 1; return 1; // samplers and images: one int (the unit)
|
||||
}
|
||||
}
|
||||
|
||||
static GLuint compile(GLenum type, const char *src, GLuint prog_id) {
|
||||
GLuint sh = r_CreateShader(type);
|
||||
if (!sh) return 0;
|
||||
r_ShaderSource(sh, 1, &src, NULL);
|
||||
r_CompileShader(sh);
|
||||
GLint ok = 0;
|
||||
r_GetShaderiv(sh, GL_COMPILE_STATUS, &ok);
|
||||
if (!ok) {
|
||||
char log[600] = {0};
|
||||
r_GetShaderInfoLog(sh, sizeof(log) - 1, NULL, log);
|
||||
LOG("twin of program %u: stage 0x%x failed to compile: %s", prog_id, type, log);
|
||||
r_DeleteShader(sh);
|
||||
return 0;
|
||||
}
|
||||
return sh;
|
||||
}
|
||||
|
||||
static void copy_attrib_locations(GLuint orig, GLuint twin) {
|
||||
GLint n = 0;
|
||||
r_GetProgramiv(orig, GL_ACTIVE_ATTRIBUTES, &n);
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
char name[256];
|
||||
GLsizei len = 0;
|
||||
GLint size = 0;
|
||||
GLenum type = 0;
|
||||
r_GetActiveAttrib(orig, (GLuint)i, sizeof(name), &len, &size, &type, name);
|
||||
if (len <= 0 || !strncmp(name, "gl_", 3)) continue;
|
||||
GLint loc = r_GetAttribLocation(orig, name);
|
||||
if (loc >= 0) r_BindAttribLocation(twin, (GLuint)loc, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void map_uniforms(struct prog *p) {
|
||||
GLint n = 0;
|
||||
r_GetProgramiv(p->twin, GL_ACTIVE_UNIFORMS, &n);
|
||||
int cap = 0;
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
char name[256];
|
||||
GLsizei len = 0;
|
||||
GLint size = 0;
|
||||
GLenum type = 0;
|
||||
GLuint index = (GLuint)i;
|
||||
GLint block = -1;
|
||||
r_GetActiveUniform(p->twin, index, sizeof(name) - 16, &len, &size, &type, name);
|
||||
r_GetActiveUniformsiv(p->twin, 1, &index, GL_UNIFORM_BLOCK_INDEX, &block);
|
||||
if (len <= 0 || block != -1 || !strncmp(name, "gl_", 3)) continue; // block members live in buffers
|
||||
char *bracket = len > 3 && !strcmp(name + len - 3, "[0]") ? name + len - 3 : NULL;
|
||||
if (bracket) *bracket = 0;
|
||||
for (GLint e = 0; e < (size > 0 ? size : 1); ++e) {
|
||||
char elem[300];
|
||||
if (bracket) snprintf(elem, sizeof(elem), "%s[%d]", name, e);
|
||||
else snprintf(elem, sizeof(elem), "%s", name);
|
||||
GLint lo = r_GetUniformLocation(p->id, elem), lt = r_GetUniformLocation(p->twin, elem);
|
||||
if (lo < 0 || lt < 0) continue;
|
||||
if (p->nunis == cap) {
|
||||
cap = cap ? cap * 2 : 16;
|
||||
struct uni *grown = realloc(p->unis, (size_t)cap * sizeof(*grown));
|
||||
if (!grown) return;
|
||||
p->unis = grown;
|
||||
}
|
||||
p->unis[p->nunis++] = (struct uni){.type = type, .orig = lo, .var = lt};
|
||||
}
|
||||
}
|
||||
GLint nb = 0;
|
||||
r_GetProgramiv(p->twin, GL_ACTIVE_UNIFORM_BLOCKS, &nb);
|
||||
p->blocks = nb > 0 ? calloc((size_t)nb, sizeof(*p->blocks)) : NULL;
|
||||
for (GLint i = 0; p->blocks && i < nb; ++i) {
|
||||
char name[256];
|
||||
GLsizei len = 0;
|
||||
r_GetActiveUniformBlockName(p->twin, (GLuint)i, sizeof(name), &len, name);
|
||||
GLuint oi = len > 0 ? r_GetUniformBlockIndex(p->id, name) : GL_INVALID_INDEX;
|
||||
if (oi == GL_INVALID_INDEX) continue;
|
||||
p->blocks[p->nblocks++] = (struct block){.orig_index = oi, .var_index = (GLuint)i, .binding = -1};
|
||||
}
|
||||
}
|
||||
|
||||
static int build_twin(struct prog *p) {
|
||||
GLuint twin = r_CreateProgram(), shaders[6];
|
||||
int ns = 0, layouts = 0, ids = 0;
|
||||
for (int i = 0; twin && i < p->nshaders; ++i) {
|
||||
int l = 0, v = 0;
|
||||
char *src = glmv_rewrite(p->sources[i], &l, &v);
|
||||
GLuint sh = src ? compile(p->types[i], src, p->id) : 0;
|
||||
free(src);
|
||||
if (!sh) { ns = -1; break; }
|
||||
layouts += l;
|
||||
ids += v;
|
||||
r_AttachShader(twin, sh);
|
||||
shaders[ns++] = sh;
|
||||
}
|
||||
if (twin && ns > 0) {
|
||||
copy_attrib_locations(p->id, twin);
|
||||
r_LinkProgram(twin);
|
||||
}
|
||||
for (int i = 0; i < ns; ++i) r_DeleteShader(shaders[i]); // flagged only; freed with the program
|
||||
GLint ok = 0;
|
||||
if (twin && ns > 0) r_GetProgramiv(twin, GL_LINK_STATUS, &ok);
|
||||
if (!ok) {
|
||||
char log[600] = {0};
|
||||
if (twin && ns > 0) r_GetProgramInfoLog(twin, sizeof(log) - 1, NULL, log);
|
||||
LOG("twin of program %u failed (%s): drawing it unchanged", p->id, ns > 0 ? log : "compile");
|
||||
if (twin) r_DeleteProgram(twin);
|
||||
p->twin_failed = 1;
|
||||
return 0;
|
||||
}
|
||||
p->twin = twin;
|
||||
map_uniforms(p);
|
||||
LOG("twin built: program %u -> %u (%d uniforms, %d blocks, %d num_views layouts and %d gl_ViewID_OVR replaced)",
|
||||
p->id, twin, p->nunis, p->nblocks, layouts, ids);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static unsigned long uniform_sets; // twin uniforms changed (statistics)
|
||||
|
||||
static void sync_uniforms(struct prog *p) {
|
||||
for (int i = 0; i < p->nunis; ++i) {
|
||||
struct uni *u = &p->unis[i];
|
||||
int kind, n = components(u->type, &kind);
|
||||
GLuint v[16] = {0};
|
||||
if (kind == 0 || kind == 3) r_GetUniformfv(p->id, u->orig, (GLfloat *)v);
|
||||
else if (kind == 2) r_GetUniformuiv(p->id, u->orig, v);
|
||||
else r_GetUniformiv(p->id, u->orig, (GLint *)v);
|
||||
if (u->valid && !memcmp(v, u->shadow, (size_t)n * sizeof(GLuint))) continue;
|
||||
memcpy(u->shadow, v, sizeof(v));
|
||||
u->valid = 1;
|
||||
++uniform_sets;
|
||||
const GLfloat *f = (const GLfloat *)v;
|
||||
const GLint *iv = (const GLint *)v;
|
||||
switch (u->type) {
|
||||
case GL_FLOAT: r_Uniform1fv(u->var, 1, f); break;
|
||||
case GL_FLOAT_VEC2: r_Uniform2fv(u->var, 1, f); break;
|
||||
case GL_FLOAT_VEC3: r_Uniform3fv(u->var, 1, f); break;
|
||||
case GL_FLOAT_VEC4: r_Uniform4fv(u->var, 1, f); break;
|
||||
case GL_UNSIGNED_INT: r_Uniform1uiv(u->var, 1, v); break;
|
||||
case GL_UNSIGNED_INT_VEC2: r_Uniform2uiv(u->var, 1, v); break;
|
||||
case GL_UNSIGNED_INT_VEC3: r_Uniform3uiv(u->var, 1, v); break;
|
||||
case GL_UNSIGNED_INT_VEC4: r_Uniform4uiv(u->var, 1, v); break;
|
||||
case GL_FLOAT_MAT2: r_UniformMatrix2fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT3: r_UniformMatrix3fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT4: r_UniformMatrix4fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT2x3: r_UniformMatrix2x3fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT3x2: r_UniformMatrix3x2fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT2x4: r_UniformMatrix2x4fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT4x2: r_UniformMatrix4x2fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT3x4: r_UniformMatrix3x4fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_FLOAT_MAT4x3: r_UniformMatrix4x3fv(u->var, 1, GL_FALSE, f); break;
|
||||
case GL_INT_VEC2: case GL_BOOL_VEC2: r_Uniform2iv(u->var, 1, iv); break;
|
||||
case GL_INT_VEC3: case GL_BOOL_VEC3: r_Uniform3iv(u->var, 1, iv); break;
|
||||
case GL_INT_VEC4: case GL_BOOL_VEC4: r_Uniform4iv(u->var, 1, iv); break;
|
||||
default: r_Uniform1iv(u->var, 1, iv); break; // int, bool, samplers
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < p->nblocks; ++i) {
|
||||
struct block *b = &p->blocks[i];
|
||||
GLint binding = 0;
|
||||
r_GetActiveUniformBlockiv(p->id, b->orig_index, GL_UNIFORM_BLOCK_BINDING, &binding);
|
||||
if (binding != b->binding) {
|
||||
r_UniformBlockBinding(p->twin, b->var_index, (GLuint)binding);
|
||||
b->binding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- per-thread state (a GL context is per thread)
|
||||
#define FB_UNKNOWN (-1)
|
||||
#define FB_NO_COLOR (-2)
|
||||
static __thread struct prog *cur_prog;
|
||||
static __thread int fb_views = FB_UNKNOWN; // views of the draw framebuffer's first color attachment (cached)
|
||||
|
||||
static int draw_fb_views(void) {
|
||||
if (fb_views != FB_UNKNOWN) return fb_views;
|
||||
GLint fb = 0;
|
||||
r_GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fb);
|
||||
if (!fb) return fb_views = 0; // the window surface
|
||||
GLint type = GL_NONE;
|
||||
r_GetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
|
||||
if (type == GL_NONE) return fb_views = FB_NO_COLOR; // depth-only: Mesa doesn't compare views
|
||||
if (type != GL_TEXTURE) return fb_views = 0; // renderbuffer
|
||||
GLint views = 0;
|
||||
r_GetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR, &views);
|
||||
return fb_views = views;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- statistics (per 5 s)
|
||||
static unsigned long twin_draws, mv_draws;
|
||||
static struct timespec last_stats;
|
||||
static void stats(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
if (!last_stats.tv_sec) last_stats = now;
|
||||
if (now.tv_sec - last_stats.tv_sec < 5) return;
|
||||
last_stats = now;
|
||||
if (twin_draws || debug)
|
||||
LOG("5s: %lu single-view draws of multiview programs, %lu multiview draws, %lu twin uniform updates",
|
||||
twin_draws, mv_draws, uniform_sets);
|
||||
twin_draws = mv_draws = uniform_sets = 0;
|
||||
}
|
||||
|
||||
// Before a draw: bind the twin when the program is multiview and the framebuffer has no views. 1 = twin bound.
|
||||
static int begin_draw(void) {
|
||||
struct prog *p = cur_prog;
|
||||
if (!p || !p->multiview || p->twin_failed) return 0;
|
||||
int views = draw_fb_views();
|
||||
if (views != 0) {
|
||||
++mv_draws;
|
||||
if (debug) stats();
|
||||
return 0;
|
||||
}
|
||||
if (!p->twin && !build_twin(p)) return 0;
|
||||
r_UseProgram(p->twin);
|
||||
sync_uniforms(p);
|
||||
if (debug) r_GetError(); // (debug only: this consumes an earlier error the game hasn't read)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void end_draw(const char *what) {
|
||||
struct prog *p = cur_prog;
|
||||
if (debug) {
|
||||
static int logs;
|
||||
GLenum err = r_GetError();
|
||||
if (err && logs < 20) {
|
||||
++logs;
|
||||
LOG("%s with the twin of program %u: GL error 0x%x", what, p ? p->id : 0, err);
|
||||
}
|
||||
}
|
||||
r_UseProgram(p ? p->id : 0);
|
||||
++twin_draws;
|
||||
stats();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- exported GL functions
|
||||
EXPORT void glUseProgram(GLuint program) {
|
||||
INIT();
|
||||
r_UseProgram(program);
|
||||
cur_prog = program ? find_prog(program, 0) : NULL;
|
||||
}
|
||||
|
||||
EXPORT void glLinkProgram(GLuint program) {
|
||||
INIT();
|
||||
note_program(program);
|
||||
r_LinkProgram(program);
|
||||
}
|
||||
|
||||
EXPORT void glDeleteProgram(GLuint program) {
|
||||
INIT();
|
||||
struct prog *p = program ? find_prog(program, 0) : NULL;
|
||||
if (p) { // the record stays (pointers to it may be cached); a new program with this name relinks it
|
||||
drop_twin(p);
|
||||
drop_sources(p);
|
||||
}
|
||||
r_DeleteProgram(program);
|
||||
}
|
||||
|
||||
EXPORT void glBindFramebuffer(GLenum target, GLuint framebuffer) {
|
||||
INIT();
|
||||
r_BindFramebuffer(target, framebuffer);
|
||||
if (target != GL_READ_FRAMEBUFFER) fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) {
|
||||
INIT();
|
||||
r_DeleteFramebuffers(n, framebuffers);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
||||
INIT();
|
||||
r_FramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum rbtarget, GLuint renderbuffer) {
|
||||
INIT();
|
||||
r_FramebufferRenderbuffer(target, attachment, rbtarget, renderbuffer);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) {
|
||||
INIT();
|
||||
r_FramebufferTextureLayer(target, attachment, texture, level, layer);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level) {
|
||||
INIT();
|
||||
if (r_FramebufferTexture) r_FramebufferTexture(target, attachment, texture, level);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
EXPORT void glDrawBuffers(GLsizei n, const GLenum *bufs) {
|
||||
INIT();
|
||||
r_DrawBuffers(n, bufs);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
static void w_ftmv(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint base, GLsizei views) {
|
||||
r_ftmv(target, attachment, texture, level, base, views);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
static void w_ftmsmv(GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint base,
|
||||
GLsizei views) {
|
||||
r_ftmsmv(target, attachment, texture, level, samples, base, views);
|
||||
fb_views = FB_UNKNOWN;
|
||||
}
|
||||
|
||||
#define DRAW(name, call) \
|
||||
INIT(); \
|
||||
if (!r_##name) return; \
|
||||
if (begin_draw()) { \
|
||||
r_##name call; \
|
||||
end_draw("gl" #name); \
|
||||
} else { \
|
||||
r_##name call; \
|
||||
}
|
||||
|
||||
EXPORT void glDrawArrays(GLenum mode, GLint first, GLsizei count) { DRAW(DrawArrays, (mode, first, count)) }
|
||||
EXPORT void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) {
|
||||
DRAW(DrawElements, (mode, count, type, indices))
|
||||
}
|
||||
EXPORT void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instances) {
|
||||
DRAW(DrawArraysInstanced, (mode, first, count, instances))
|
||||
}
|
||||
EXPORT void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instances) {
|
||||
DRAW(DrawElementsInstanced, (mode, count, type, indices, instances))
|
||||
}
|
||||
EXPORT void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type,
|
||||
const void *indices) {
|
||||
DRAW(DrawRangeElements, (mode, start, end, count, type, indices))
|
||||
}
|
||||
EXPORT void glDrawArraysIndirect(GLenum mode, const void *indirect) { DRAW(DrawArraysIndirect, (mode, indirect)) }
|
||||
EXPORT void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) {
|
||||
DRAW(DrawElementsIndirect, (mode, type, indirect))
|
||||
}
|
||||
EXPORT void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint base) {
|
||||
DRAW(DrawElementsBaseVertex, (mode, count, type, indices, base))
|
||||
}
|
||||
EXPORT void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type,
|
||||
const void *indices, GLint base) {
|
||||
DRAW(DrawRangeElementsBaseVertex, (mode, start, end, count, type, indices, base))
|
||||
}
|
||||
EXPORT void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices,
|
||||
GLsizei instances, GLint base) {
|
||||
DRAW(DrawElementsInstancedBaseVertex, (mode, count, type, indices, instances, base))
|
||||
}
|
||||
|
||||
// A context made current on this thread (engines with a render thread move theirs between threads, e.g. Doom3Quest's
|
||||
// GLimp_ActivateContext): what this thread knew about the bound program and framebuffer may be another context's.
|
||||
EXPORT EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
INIT();
|
||||
if (!r_eglMakeCurrent) return EGL_FALSE;
|
||||
EGLBoolean ok = r_eglMakeCurrent(dpy, draw, read, ctx);
|
||||
fb_views = FB_UNKNOWN;
|
||||
cur_prog = NULL;
|
||||
if (ok && ctx != EGL_NO_CONTEXT && r_GetIntegerv) {
|
||||
GLint program = 0;
|
||||
r_GetIntegerv(GL_CURRENT_PROGRAM, &program);
|
||||
cur_prog = program > 0 ? find_prog((GLuint)program, 0) : NULL;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Engines fetch the OVR multiview functions (and SDL-style loaders every function) through eglGetProcAddress.
|
||||
EXPORT __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *name) {
|
||||
INIT();
|
||||
__eglMustCastToProperFunctionPointerType fn = r_eglGetProcAddress ? r_eglGetProcAddress(name) : NULL;
|
||||
if (!fn || !name) return fn;
|
||||
if (!strcmp(name, "glFramebufferTextureMultiviewOVR")) {
|
||||
if (!r_ftmv) r_ftmv = (PFN_FTMV)fn;
|
||||
return (__eglMustCastToProperFunctionPointerType)w_ftmv;
|
||||
}
|
||||
if (!strcmp(name, "glFramebufferTextureMultisampleMultiviewOVR")) {
|
||||
if (!r_ftmsmv) r_ftmsmv = (PFN_FTMSMV)fn;
|
||||
return (__eglMustCastToProperFunctionPointerType)w_ftmsmv;
|
||||
}
|
||||
#define OWN(sym) if (!strcmp(name, #sym)) return (__eglMustCastToProperFunctionPointerType)sym;
|
||||
OWN(glUseProgram) OWN(glLinkProgram) OWN(glDeleteProgram) OWN(glBindFramebuffer) OWN(glDeleteFramebuffers)
|
||||
OWN(glFramebufferTexture2D) OWN(glFramebufferRenderbuffer) OWN(glFramebufferTextureLayer)
|
||||
OWN(glFramebufferTexture) OWN(glDrawBuffers) OWN(glDrawArrays) OWN(glDrawElements) OWN(glDrawArraysInstanced)
|
||||
OWN(glDrawElementsInstanced) OWN(glDrawRangeElements) OWN(glDrawArraysIndirect) OWN(glDrawElementsIndirect)
|
||||
OWN(glDrawElementsBaseVertex) OWN(glDrawRangeElementsBaseVertex) OWN(glDrawElementsInstancedBaseVertex)
|
||||
OWN(eglMakeCurrent)
|
||||
#undef OWN
|
||||
return fn;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// GLSL source rewrite for libfpglmv.so (see glmv.c): turns an OVR_multiview shader into its single-view twin.
|
||||
// - every `layout(... num_views ...) in;` statement is blanked out (the program then declares no views, which is
|
||||
// what Mesa requires for a draw into a framebuffer whose attachments aren't multiview)
|
||||
// - every gl_ViewID_OVR token becomes (0u): view 0 (the left eye's matrices in Doom3Quest)
|
||||
// #extension lines stay (the driver supports OVR_multiview; enabling it without a num_views layout is harmless).
|
||||
// Columns and line numbers are kept (blanks pad the replacements), so compile logs point at the same places.
|
||||
// Plain C, no GL: the host unit test (tests/fixtures/src/glmv_rewrite_test.c) compiles it too.
|
||||
#pragma once
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int glmv_ident_char(char c) {
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
|
||||
}
|
||||
|
||||
// `word` at p as a whole token (not part of a longer identifier)
|
||||
static int glmv_token_at(const char *start, const char *p, const char *word) {
|
||||
size_t n = strlen(word);
|
||||
if (strncmp(p, word, n) != 0) return 0;
|
||||
if (p > start && glmv_ident_char(p[-1])) return 0;
|
||||
return !glmv_ident_char(p[n]);
|
||||
}
|
||||
|
||||
static const char *glmv_skip_ws(const char *p) {
|
||||
while (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || *p == '\f' || *p == '\v') ++p;
|
||||
return p;
|
||||
}
|
||||
|
||||
// If a `layout(...num_views...) in;` statement starts at p, returns a pointer to its ';', else NULL.
|
||||
static const char *glmv_num_views_stmt(const char *start, const char *p) {
|
||||
if (!glmv_token_at(start, p, "layout")) return NULL;
|
||||
const char *q = glmv_skip_ws(p + 6);
|
||||
if (*q != '(') return NULL;
|
||||
const char *open = q;
|
||||
int depth = 0;
|
||||
for (; *q; ++q) {
|
||||
if (*q == '(') ++depth;
|
||||
else if (*q == ')' && --depth == 0) break;
|
||||
}
|
||||
if (!*q) return NULL;
|
||||
const char *close = q;
|
||||
int has_views = 0;
|
||||
for (const char *r = open + 1; r < close; ++r)
|
||||
if (glmv_token_at(start, r, "num_views")) { has_views = 1; break; }
|
||||
if (!has_views) return NULL;
|
||||
q = glmv_skip_ws(close + 1);
|
||||
if (!glmv_token_at(start, q, "in")) return NULL;
|
||||
q = glmv_skip_ws(q + 2);
|
||||
return *q == ';' ? q : NULL;
|
||||
}
|
||||
|
||||
// 1 if the source declares multiview views (a vertex shader of an OVR_multiview program)
|
||||
static int glmv_has_num_views(const char *src) {
|
||||
for (const char *p = src; (p = strstr(p, "layout")); p += 6)
|
||||
if (glmv_num_views_stmt(src, p)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The single-view twin of `src` (malloc'd, same length), or NULL when out of memory. Counts go to *layouts / *ids.
|
||||
static char *glmv_rewrite(const char *src, int *layouts, int *ids) {
|
||||
static const char id_tok[] = "gl_ViewID_OVR"; // 13 characters
|
||||
static const char zero[] = "(0u)";
|
||||
size_t n = strlen(src);
|
||||
char *out = (char *)malloc(n + 1);
|
||||
if (!out) return NULL;
|
||||
memcpy(out, src, n + 1);
|
||||
int nl = 0, ni = 0;
|
||||
for (char *p = out; (p = strstr(p, "layout"));) {
|
||||
const char *semi = glmv_num_views_stmt(out, p);
|
||||
if (!semi) { p += 6; continue; }
|
||||
for (char *b = p; b <= semi; ++b)
|
||||
if (*b != '\n' && *b != '\r') *b = ' ';
|
||||
++nl;
|
||||
p = (char *)semi + 1;
|
||||
}
|
||||
for (char *p = out; (p = strstr(p, id_tok));) {
|
||||
if (!glmv_token_at(out, p, id_tok)) { p += sizeof(id_tok) - 1; continue; }
|
||||
memcpy(p, zero, sizeof(zero) - 1);
|
||||
memset(p + sizeof(zero) - 1, ' ', sizeof(id_tok) - sizeof(zero));
|
||||
++ni;
|
||||
p += sizeof(id_tok) - 1;
|
||||
}
|
||||
if (layouts) *layouts = nl;
|
||||
if (ids) *ids = ni;
|
||||
return out;
|
||||
}
|
||||