Isolate vanilla and core Vulkan startup failures on macOS

This commit is contained in:
Ludovic Marie
2026-10-04 11:08:07 +02:00
parent ad00f1c30c
commit 3858ab38b5
4 changed files with 57 additions and 3 deletions
+27 -1
View File
@@ -61,7 +61,32 @@ jobs:
run: python -m unittest discover -s tests -v
- name: Start native macOS clients and verify framebuffer readback
if: runner.os == 'macOS'
run: python tools/test_client_graphics.py --native-display
run: |
python - <<'PY'
import json, subprocess, sys
from pathlib import Path
cases = [
['--profile', 'baseline', '--backend', 'vulkan'],
['--profile', 'core-performance', '--backend', 'vulkan'],
['--profile', 'core-performance'],
['--profile', 'm2-balanced'],
['--profile', 'vulkan'],
]
failed = []
observations = []
for case in cases:
result = subprocess.run([sys.executable, 'tools/test_client_graphics.py', '--native-display', *case])
observation = {'case': case, 'exit_code': result.returncode}
if result.returncode:
failed.append(case)
else:
observation['report'] = json.loads(Path('dist/client-graphics-smoke.json').read_text())
observations.append(observation)
Path('dist/client-graphics-macos-cases.json').write_text(json.dumps(observations, indent=2) + '\n')
if failed:
print('HORIZON_MAC_GRAPHICS_FAILED_CASES', failed, flush=True)
sys.exit(1)
PY
- name: Compile the private dispatch fixture
run: python -c "from tools.build_mod import build_dispatch_fixture; build_dispatch_fixture()"
- name: Compile the private tick-manager state fixture
@@ -127,3 +152,4 @@ jobs:
dist/quad-reuse-integration.json
dist/quad-size-integration.json
dist/client-graphics-smoke.json
dist/client-graphics-macos-cases.json
@@ -43,6 +43,12 @@ public abstract class GraphicsBackendTraceMixin {
try {
GpuDevice device = backend.createDevice(options);
trace(backend, "create_device", null);
var info = device.getDeviceInfo();
var metadata = new JsonObject();
metadata.addProperty("gpu", info.name());
metadata.addProperty("graphics_backend", info.backendName());
metadata.addProperty("graphics_driver", info.driverInfo());
System.out.println("HORIZON_GRAPHICS_DEVICE_CREATED " + metadata);
return device;
} catch (BackendCreationException | RuntimeException | LinkageError | AssertionError failure) {
trace(backend, "create_device", failure);
@@ -18,6 +18,7 @@ public final class ClientGraphicsIntegration implements ClientModInitializer {
private boolean requested;
@Override public void onInitializeClient() {
System.out.println("HORIZON_CLIENT_GRAPHICS_INITIALIZER_READY");
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (requested || !(client.gui.screen() instanceof TitleScreen)) return;
if (titleStarted == 0) titleStarted = System.nanoTime();
+23 -2
View File
@@ -6,6 +6,7 @@ import hashlib
import json
import os
import platform
import re
import shutil
import sys
@@ -24,6 +25,7 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--native-display', action='store_true')
parser.add_argument('--profile', action='append', choices=sorted(build_pack.PROFILES))
parser.add_argument('--backend', choices=['opengl', 'vulkan'], help='Override backend in these private instances only')
args = parser.parse_args()
root = build_pack.ROOT
fixture = build_mod.build_integration_fixture('client-graphics',
@@ -34,8 +36,16 @@ def main():
original_hash = hashlib.sha256(mod.read_bytes()).hexdigest()
results = []
for profile in args.profile or ['core-performance', 'm2-balanced', 'vulkan']:
instance = root / '.local/runtime' / ('client-graphics-' + profile)
instance = root / '.local/runtime' / ('client-graphics-' + profile
+ ('-override-' + args.backend if args.backend else ''))
build_pack.prepare_instance(profile, instance, mod)
if args.backend:
options = instance / 'options.txt'
text, count = re.subn(r'^preferredGraphicsBackend:.*$',
'preferredGraphicsBackend:' + json.dumps(args.backend), options.read_text(), flags=re.MULTILINE)
if count != 1:
raise AssertionError('Private backend preference is missing or ambiguous')
options.write_text(text)
shutil.copy2(fixture, instance / 'mods/client-graphics-fixture.jar')
command = [sys.executable, str(root / 'tools/runtime.py'), 'demo',
'--instance', str(instance), '--heap', '3G']
@@ -53,7 +63,17 @@ def main():
attempts = [json.loads(line.split(trace_marker, 1)[1]) for line in run.stdout.splitlines() if trace_marker in line]
if run.returncode or len(reports) != 1:
diagnostics = failure_summary(run, len(reports))
diagnostics['profile'] = profile
diagnostics['preferred_backend'] = args.backend or build_pack.PROFILES[profile].get('backend', 'opengl')
diagnostics['backend_attempts'] = attempts
device_marker = 'HORIZON_GRAPHICS_DEVICE_CREATED '
diagnostics['created_devices'] = [json.loads(line.split(device_marker, 1)[1])
for line in run.stdout.splitlines() if device_marker in line]
diagnostics['client_initializer_reached'] = 'HORIZON_CLIENT_GRAPHICS_INITIALIZER_READY' in run.stdout
diagnostics['vulkan_error_codes'] = sorted(set(re.findall(r'\bVK_ERROR_[A-Z_0-9]{1,100}\b', run.stdout)))[:16]
diagnostics['java_exception_types'] = sorted(set(diagnostics['java_exception_types']) | set(
re.findall(r'\b((?:java|org\.lwjgl|com\.mojang|net\.minecraft|net\.fabricmc|org\.spongepowered|dev\.horizonlab)\.[A-Za-z_$][\w.$]{0,160}(?:Exception|Error))\b', run.stdout, re.ASCII)))[:8]
diagnostics['fatal_jvm_error'] = 'A fatal error has been detected by the Java Runtime Environment' in run.stdout
print('HORIZON_FIXTURE_FAILURE ' + json.dumps(diagnostics), flush=True)
raise RuntimeError('Graphics probe failed; diagnostics remain private')
report = reports[0]
@@ -66,7 +86,8 @@ def main():
screenshot = instance / 'client-graphics-private.png'
if not screenshot.is_file() or hashlib.sha256(screenshot.read_bytes()).hexdigest() != report['private_png_sha256']:
raise AssertionError('Private screenshot evidence is missing or changed')
report.update(profile=profile, launcher_exit_code=run.returncode, backend_attempts=attempts)
report.update(profile=profile, preferred_backend=args.backend or build_pack.PROFILES[profile].get('backend', 'opengl'),
launcher_exit_code=run.returncode, backend_attempts=attempts)
results.append(report)
print(json.dumps(report), flush=True)
output = root / 'dist/client-graphics-smoke.json'