mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
* feat: add Cardboard mode with side-by-side lens-distorted eyes and 3DoF head tracking * fix: derive the Cardboard field of view from the panel and recentre fully when far from upright * feat: share the Cardboard head pose with the guest and add a SteamVR driver for it * feat: run SteamVR's compositor on Turnip/KGSL with a display-extension layer and a driver-direct HMD * feat: show SteamVR frames in Cardboard mode through a driver-side presenter and a fake direct-mode display * feat: install and start SteamVR for Cardboard mode from the session drawer * docs: describe Cardboard mode and the SteamVR path * feat: drive SteamVR hands from the game pad and keep the Cardboard headset out of standby * docs: record where the SteamVR dashboard stops * fix: map Cardboard head tracking to the screen's axes and keep turns about the real vertical as yaw * fix: give Cardboard its previous picture back when SteamVR stops * fix: report sem_otime from emulated SysV semaphores so SteamVR's web helper can start * fix: bridge SteamVR's shared semaphores across processes and keep Steam alive while SteamVR runs * feat: present SteamVR straight to DroidDeck's compositor at panel resolution * docs: update Cardboard VR notes for the dashboard, semaphore bridge and direct presenter * fix: keep Wine and FEX signal handlers in the VR layer; add semaphore tracing * fix: clear a stale SteamVR active marker on status * fix: clear only an old SteamVR active marker * fix: unblock SteamVR clients on Turnip and keep Steam's web helper alive across SteamVR runs * fix: judge shared waits before a submit's own signals and on Vulkan 1.0 devices * docs: record VR games, SteamVR Home and OpenXR results on the Thor * docs: add Cardboard VR learnings from the Thor bring-up * docs: add Cardboard VR screenshots from the Thor * fix: keep the VR layer's display stand-in to SteamVR runs and clear a leftover marker at session start * fix: report SteamVR start and stop failures from the helper's exit code
61 lines
2.8 KiB
Python
61 lines
2.8 KiB
Python
from pathlib import Path
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SRC = ROOT / 'app' / 'src' / 'main' / 'cpp' / 'waylandcomp' / 'src'
|
|
TOOLS = ROOT / 'tools' / 'cardboard'
|
|
|
|
|
|
def spirv_words(header: str) -> list[str]:
|
|
return re.findall(r'0x[0-9a-fA-F]{8}', header)
|
|
|
|
|
|
@unittest.skipUnless(shutil.which('cc'), 'needs a C compiler')
|
|
class CardboardParamsTest(unittest.TestCase):
|
|
def test_clamp_and_push_constant_layout(self):
|
|
with tempfile.TemporaryDirectory() as folder:
|
|
binary = str(Path(folder) / 'test-cardboard')
|
|
subprocess.run(['cc', '-std=c11', '-Wall', '-Wextra', '-Werror', '-O2', '-DCARDBOARD_HOST_TEST',
|
|
'-D_DEFAULT_SOURCE', f'-I{SRC}', f'-I{Path(folder)}', '-o', binary,
|
|
str(TOOLS / 'test_cardboard_params.c'), str(SRC / 'cardboard.c'), '-lm'],
|
|
check=True, cwd=folder, env=self._env(folder))
|
|
result = subprocess.run([binary], capture_output=True, text=True, check=True, timeout=10)
|
|
self.assertIn('PASS: cardboard params', result.stdout)
|
|
|
|
@staticmethod
|
|
def _env(folder):
|
|
# cardboard.h includes <vulkan/vulkan.h>; the host test only needs the types, so a stub
|
|
# header stands in when the Vulkan SDK is not installed.
|
|
import os
|
|
stub = Path(folder) / 'vulkan'
|
|
stub.mkdir(exist_ok=True)
|
|
(stub / 'vulkan.h').write_text('typedef struct VkDevice_T *VkDevice; typedef struct VkImage_T *VkImage;\n'
|
|
'typedef struct VkCommandBuffer_T *VkCommandBuffer;\n'
|
|
'typedef struct { int unused; } VkPhysicalDeviceMemoryProperties;\n')
|
|
return dict(os.environ)
|
|
|
|
|
|
@unittest.skipUnless(shutil.which('glslangValidator'), 'needs glslangValidator')
|
|
class CardboardShaderTest(unittest.TestCase):
|
|
def test_committed_spirv_matches_the_glsl(self):
|
|
with tempfile.TemporaryDirectory() as folder:
|
|
out = Path(folder) / 'cardboard_frag.h'
|
|
subprocess.run(['glslangValidator', '-V', '--vn', 'cardboard_frag_code', '-o', str(out),
|
|
str(SRC / 'cardboard.frag')], check=True, capture_output=True)
|
|
self.assertEqual(spirv_words(out.read_text()), spirv_words((SRC / 'cardboard_frag.h').read_text()),
|
|
'cardboard_frag.h is stale: regenerate it from cardboard.frag (see cardboard.c)')
|
|
|
|
def test_push_constants_fit_the_guaranteed_range(self):
|
|
# 7 vec4 = 112 bytes in the shader; Vulkan guarantees 128.
|
|
glsl = (SRC / 'cardboard.frag').read_text()
|
|
block = glsl[glsl.index('uniform PC {'):glsl.index('} pc;')]
|
|
self.assertLessEqual(16 * len(re.findall(r'\bvec4\b', block)), 128)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|