Served with isolation headers; start-screen capability notices; tests on the real GPU (t88 phase 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+5
-10
@@ -40,13 +40,9 @@ import argparse, pathlib, sys
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
||||
from where import translate
|
||||
from use_venv import ensure_playwright; ensure_playwright()
|
||||
from playwright.sync_api import sync_playwright
|
||||
from browser import launch, gpu_option
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
# Headless Chromium has no GPU. These flags give it WebGL2 through SwiftShader (software), and
|
||||
# window.__allowSoftwareGL tells the game to use the smooth look anyway (players on software
|
||||
# rendering get the pixel look instead).
|
||||
GL_ARGS = ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader']
|
||||
FREEZE = """(() => { const real = performance.now.bind(performance); window.__frozenNow = null;
|
||||
performance.now = () => window.__frozenNow === null ? real() : window.__frozenNow; })();"""
|
||||
|
||||
@@ -68,17 +64,16 @@ def main():
|
||||
ap.add_argument('--freeze', action='store_true')
|
||||
ap.add_argument('--no-light', action='store_true')
|
||||
ap.add_argument('--page', default=str(ROOT / 'dist' / 'index.html'))
|
||||
gpu_option(ap)
|
||||
a = ap.parse_args()
|
||||
ww, wh = (int(v) for v in a.size.split('x'))
|
||||
vw, vh = (int(v) for v in a.viewport.split('x'))
|
||||
errors = []
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(args=GL_ARGS)
|
||||
pg = b.new_page(viewport={'width': vw, 'height': vh})
|
||||
with launch(gpu=a.gpu, viewport={'width': vw, 'height': vh}, page_path=a.page) as (b, pg, url):
|
||||
pg.on('pageerror', lambda e: errors.append(translate(e.stack or str(e))))
|
||||
pg.on('console', lambda m: errors.append('console: ' + m.text) if m.type == 'error' else None)
|
||||
pg.add_init_script('window.__allowSoftwareGL = true;' + (FREEZE if a.freeze else ''))
|
||||
pg.goto(pathlib.Path(a.page).resolve().as_uri())
|
||||
pg.add_init_script(FREEZE if a.freeze else '')
|
||||
pg.goto(url)
|
||||
pg.evaluate("SET.fog = false")
|
||||
pg.wait_for_timeout(300)
|
||||
# pause the moment the world exists, so the shot depends only on the seed, the setup
|
||||
|
||||
Reference in New Issue
Block a user