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:
+7
-10
@@ -11,12 +11,10 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from server import isolated_server
|
||||
from browser import launch, gpu_option, GPU_ARGS, SOFT_ARGS
|
||||
from use_venv import ensure_playwright
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
GPU_ARGS = ['--use-angle=vulkan', '--enable-features=Vulkan', '--enable-gpu',
|
||||
'--ignore-gpu-blocklist', '--enable-gpu-rasterization']
|
||||
|
||||
|
||||
def size(value):
|
||||
@@ -107,6 +105,7 @@ def main():
|
||||
ap.add_argument('--seconds', type=float, default=10)
|
||||
ap.add_argument('--json', type=Path)
|
||||
ap.add_argument('--compare', type=Path)
|
||||
gpu_option(ap)
|
||||
args = ap.parse_args()
|
||||
try:
|
||||
zooms = list(dict.fromkeys(float(z) for z in args.zooms.split(',')))
|
||||
@@ -129,7 +128,6 @@ def main():
|
||||
if baseline and (baseline.get('schema') != 1 or baseline['options'] != options):
|
||||
ap.error('baseline schema/options differ; use the same matrix, dimensions and seconds')
|
||||
ensure_playwright()
|
||||
from playwright.sync_api import sync_playwright
|
||||
started = time.monotonic()
|
||||
subprocess.run([sys.executable, str(ROOT / 'build.py')], cwd=ROOT, check=True, stdout=sys.stderr)
|
||||
# Derive coverage from the source so a newly added sim step cannot silently disappear.
|
||||
@@ -141,13 +139,12 @@ def main():
|
||||
# boot's title draw is outside frame().
|
||||
overlays.remove('drawTitle')
|
||||
result = dict(schema=1, created_utc=datetime.now(timezone.utc).isoformat(), options=options,
|
||||
gpu_args=GPU_ARGS, scenes={}, sim_targets=steps, overlay_targets=overlays)
|
||||
files = sorted((ROOT / 'src').rglob('*')) + [Path(__file__), ROOT / 'tools/perf-scenes.js', ROOT / 'tools/perf-measure.js']
|
||||
gpu_args=GPU_ARGS if args.gpu == 'real' else SOFT_ARGS, scenes={}, sim_targets=steps, overlay_targets=overlays)
|
||||
files = sorted((ROOT / 'src').rglob('*')) + [Path(__file__), ROOT / 'tools/browser.py', ROOT / 'tools/server.py',
|
||||
ROOT / 'tools/perf-scenes.js', ROOT / 'tools/perf-measure.js']
|
||||
result['source_sha256'] = hashlib.sha256(b''.join(p.read_bytes() for p in files if p.is_file())).hexdigest()
|
||||
errors = []
|
||||
with isolated_server() as url, sync_playwright() as p:
|
||||
browser = p.chromium.launch(args=GPU_ARGS)
|
||||
pg = browser.new_page(viewport=dict(width=args.viewport[0], height=args.viewport[1]))
|
||||
with launch(gpu=args.gpu, viewport=dict(width=args.viewport[0], height=args.viewport[1])) as (browser, pg, url):
|
||||
pg.on('pageerror', lambda e: errors.append(str(e)))
|
||||
pg.add_init_script('''window.__perfStop = true;
|
||||
const raf = window.requestAnimationFrame.bind(window), pending = new Set();
|
||||
@@ -169,7 +166,7 @@ def main():
|
||||
}''')
|
||||
if not result['machine']['crossOriginIsolated']:
|
||||
raise RuntimeError('Local server did not provide cross-origin isolation')
|
||||
if re.search('swiftshader|llvmpipe|softpipe|software', result['machine']['renderer'], re.I):
|
||||
if args.gpu == 'real' and re.search('swiftshader|llvmpipe|softpipe|software', result['machine']['renderer'], re.I):
|
||||
raise RuntimeError('Refusing a software-rendered baseline')
|
||||
result['machine']['browser_version'] = browser.version
|
||||
def setup(scene):
|
||||
|
||||
Reference in New Issue
Block a user