Multi-core simulation: grain movement and heat across a worker pool (t88 phase 3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-2
@@ -8,16 +8,18 @@ ensure_playwright()
|
||||
from browser import capabilities, consume_gpu_option, launch
|
||||
|
||||
consume_gpu_option()
|
||||
for case in ['native', 'absent', 'null', 'reject', 'firefox', 'limits']:
|
||||
for case in ['native', 'absent', 'null', 'reject', 'firefox', 'limits', 'threads']:
|
||||
with launch() as (_, page, url):
|
||||
errors = []
|
||||
page.on('pageerror', lambda e: errors.append(str(e)))
|
||||
if case != 'native':
|
||||
if case not in ('native', 'threads'):
|
||||
gpu = 'undefined' if case == 'absent' else "{requestAdapter: async () => null}"
|
||||
if case == 'reject': gpu = "{requestAdapter: async () => {throw new Error('adapter denied')}}"
|
||||
if case == 'limits': gpu="{requestAdapter:async()=>({limits:{maxStorageTexturesPerShaderStage:3}})}"
|
||||
page.add_init_script(f"Object.defineProperty(navigator, 'gpu', {{value: {gpu}}});")
|
||||
page.add_init_script("Object.defineProperty(self, 'crossOriginIsolated', {value: false});")
|
||||
if case == 'threads':
|
||||
page.add_init_script("Object.defineProperty(self, 'crossOriginIsolated', {value: false});")
|
||||
if case == 'firefox':
|
||||
page.add_init_script("Object.defineProperty(navigator, 'userAgent', {value: 'Firefox/157.0'});")
|
||||
page.goto(url)
|
||||
@@ -26,6 +28,13 @@ for case in ['native', 'absent', 'null', 'reject', 'firefox', 'limits']:
|
||||
if case == 'native':
|
||||
assert caps['isolated']
|
||||
assert page.locator('#cap-notice').is_hidden() == caps['webgpu']
|
||||
elif case == 'threads':
|
||||
assert caps['webgpu'] and not caps['isolated']
|
||||
assert not page.evaluate('canStartGame()')
|
||||
page.evaluate('startNewWorld(424242, 512, 384)')
|
||||
assert not page.evaluate('GAME.running || GAME.loading')
|
||||
assert not page.evaluate('startFromSave({})')
|
||||
assert 'python3 tools/serve.py' in page.inner_text('#cap-notice')
|
||||
else:
|
||||
assert not caps['webgpu'] and caps['adapterInfo'] is None
|
||||
notice = page.inner_text('#cap-notice')
|
||||
|
||||
Reference in New Issue
Block a user