Check actual backend context independently of renderer preference

This commit is contained in:
Ludovic Marie
2026-10-04 14:14:56 +02:00
parent 357cc90326
commit f485ee53cc
2 changed files with 14 additions and 11 deletions
+3 -1
View File
@@ -28,5 +28,7 @@ python3 tools/test_server_graphics.py --native-display --backend vulkan
The private fixture starts a normal 10-second frame/tick recording through the
client recorder, checks both reports against the actual device, saves the demo
world and exits. It does not change simulation rate or gameplay rules. Windows
compiles the fixture; Linux and hosted macOS run the OpenGL check. Full logs,
compiles the fixture; Linux and hosted macOS check the actual game-selected backend. An explicit
`--backend` experiment still rejects fallback; the default metadata check does
not require a particular renderer. Full logs,
worlds and fixture JARs remain private and outside playable downloads.
+11 -10
View File
@@ -19,7 +19,7 @@ except ImportError:
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--native-display', action='store_true')
parser.add_argument('--backend', choices=['opengl', 'vulkan'], default='opengl')
parser.add_argument('--backend', choices=['opengl', 'vulkan'], help='Require this observed backend; default accepts the game-selected backend')
args = parser.parse_args()
root = build_pack.ROOT
fixture = build_mod.build_integration_fixture('server-graphics',
@@ -27,16 +27,17 @@ def main():
version = build_pack.read_lock()['pack_version']
mod = root / 'dist' / f'horizon-lab-{version}.jar'
digest = hashlib.sha256(mod.read_bytes()).hexdigest()
instance = root / '.local/runtime' / ('server-graphics-' + args.backend)
instance = root / '.local/runtime' / ('server-graphics-' + (args.backend or 'default'))
if instance.exists():
raise RuntimeError('Use a fresh private fixture directory; existing worlds and reports are not overwritten')
build_pack.prepare_instance('core-performance', instance, mod)
options = instance / 'options.txt'
import re
text, count = re.subn(r'^preferredGraphicsBackend:.*$', 'preferredGraphicsBackend:' + json.dumps(args.backend), options.read_text(), flags=re.MULTILINE)
if count != 1:
raise AssertionError('Expected one backend preference')
options.write_text(text)
if args.backend:
options = instance / 'options.txt'
import re
text, count = re.subn(r'^preferredGraphicsBackend:.*$', 'preferredGraphicsBackend:' + json.dumps(args.backend), options.read_text(), flags=re.MULTILINE)
if count != 1:
raise AssertionError('Expected one backend preference')
options.write_text(text)
if hashlib.sha256((instance / 'mods' / mod.name).read_bytes()).hexdigest() != digest:
raise AssertionError('Runtime mod differs from intended build')
shutil.copy2(fixture, instance / 'mods/server-graphics-fixture.jar')
@@ -51,13 +52,13 @@ def main():
result = results[0]
if result.get('server_runtime_kind') != 'integrated' or result.get('client_graphics_capture_status') != 'captured_at_recording_start':
raise AssertionError('Integrated graphics were not captured')
if result.get('graphics_backend', '').lower() != args.backend:
if args.backend and result.get('graphics_backend', '').lower() != args.backend:
raise AssertionError('Observed graphics backend differs from the requested experiment')
if not (instance / 'saves/Demo_World/level.dat').is_file():
raise AssertionError('Disposable world was not saved')
report = {'schema': 1, 'platform': platform.platform(), 'architecture': platform.machine(),
'minecraft': '26.3', 'original_mod_sha256': digest, 'launcher_exit_code': run.returncode,
'result': result, 'limits': ['Short report-context check, not FPS or physical M2 performance.',
'requested_backend': args.backend or 'pack_default', 'result': result, 'limits': ['Short report-context check, not FPS or physical M2 performance.',
'Graphics context is captured at recording start, not continuously monitored.',
'World files and full logs remain private.']}
output = root / 'dist/server-graphics-smoke.json'