mirror of
https://github.com/spoopyghosty0/frameport.git
synced 2026-10-20 05:01:29 +02:00
BattleSisters' hands lagged behind the controllers (also with ovrp_hold_physics on or off). pose_debug=1 (new, FrameBridge: per 5 s and per located space, the requested time minus the predicted display time) showed on the dev Frame (SteamOS 0.4.5): XrTime runs 2.56 s ahead of CLOCK_MONOTONIC, the hand spaces were located at -2564 ms (the monotonic "now" passed on as an XrTime: OVRPort's dispatcher converts XR_KHR_convert_timespec_time 1:1 and FrameBridge's emulation is never asked) and the head at XrTime 0.1 s (~1450 xrLocateViews/xrLocateSpace per 5 s). pose_time_fix (default off; suggested for Unity built-in OVRPlugin games): in xrLocateSpace(s)/xrLocateViews a time nearer the monotonic clock than XrTime's "now" is moved by the offset measured at xrWaitFrame, one more than 0.5 s before the display time goes to "now". Headless with it on: every far-past request moved, located times -9.8..0 ms from the display time. Host unit test for the time rules; PLAYBOOK row.
46 lines
2.2 KiB
Python
46 lines
2.2 KiB
Python
"""pose_time_fix (FrameBridge): located times from the monotonic clock or far in the past are moved, others kept."""
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from frameport.patches import base
|
|
from frameport.patches.settings import adapter_settings
|
|
|
|
|
|
def test_pose_time_fix_moves_monotonic_and_far_past_times(tmp_path):
|
|
cc = shutil.which("cc") or shutil.which("gcc") or shutil.which("clang")
|
|
if not cc or os.name == "nt":
|
|
pytest.skip("needs a POSIX host C compiler")
|
|
root = Path(__file__).resolve().parents[1]
|
|
binary = tmp_path / "pose-time-test"
|
|
subprocess.run([cc, "-std=c11", "-Wall", "-Wextra", "-Werror", "-pthread", "-I", str(root / "native/adapter"),
|
|
str(root / "tests/fixtures/src/pose_time_test.c"), "-o", str(binary)], check=True)
|
|
subprocess.run([str(binary)], check=True)
|
|
|
|
|
|
def _analysis(**kw):
|
|
from frameport.core.models import Analysis
|
|
|
|
d = dict(package="com.x.game", version="1", label="X", abis=["arm64-v8a"], engine="Unity", xr="VrApi",
|
|
graphics="GLES", direct_vrapi=False, libs=["libunity.so", "libOVRPlugin.so"], launcher_activity=None,
|
|
has_info_category=True, meta_permissions=[], uses_glad_gl=False, unity_msaa_levels=0,
|
|
oculus_os_classes=False, is_overport_output=False, debuggable=True, extra={})
|
|
d.update(kw)
|
|
return Analysis(**d)
|
|
|
|
|
|
def test_pose_time_fix_suggested_for_unity_builtin_oculus_games():
|
|
base.load_all()
|
|
p = base.REGISTRY["adapter.pose_time_fix"]
|
|
s = p.detect(_analysis(extra={"oculus_xr_plugin": False}))
|
|
assert s and s.recommended and s.params == {"value": 1}
|
|
assert p.detect(_analysis(extra={"oculus_xr_plugin": True})) is None # Oculus XR Plugin: not measured
|
|
assert p.detect(_analysis(libs=["libunity.so", "libOVRPlugin.so", "libOculusXRPlugin.so"], extra={})) is None
|
|
assert p.detect(_analysis(engine="Unreal", libs=["libUE4.so", "libOVRPlugin.so"], extra={})) is None
|
|
assert not p.applies(_analysis(libs=["libunity.so"], extra={}))
|
|
assert adapter_settings({"adapter.pose_time_fix": {"value": 1}})["pose_time_fix"] == 1
|
|
assert base.REGISTRY["adapter.pose_debug"].default == 0
|