Merge pull request #7 from ludovic111/graphics-backend-preferences

Preserve graphics backend preferences in fresh Minecraft instances
This commit is contained in:
Ludovic Marie
2026-10-03 22:54:10 +02:00
committed by GitHub
5 changed files with 24 additions and 1 deletions
+13
View File
@@ -22,6 +22,19 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi
## Interpretation limits
Generated pack options now carry data version 5023, verified against `version.json`
inside the checksum-verified Minecraft 26.3 JAR. Without this marker, the game's
legacy-options migration reset the intended backend to Default. The fixed Vulkan
preference starts the actual Vulkan backend with the pinned Sodium/DH/ImmediatelyFast
stack, renders the demo world, and records 256 frame intervals / 2,372 server ticks
over 120 seconds with matching CSV/JSON and 119–121 RSS samples. The frame report
identifies Vulkan and its driver. DH data continues updating and saves/databases
close cleanly. With an unavailable Vulkan driver path confined to a separate test
process, the game reports backend creation failure and reaches the menu using its
OpenGL fallback. These checks do not establish Vulkan speed, distant-LOD visual
correctness, shader compatibility, or behavior on the user's Mac. Balanced remains
the OpenGL first test; Vulkan remains an optional independent comparison.
The 0.7.0 optional debounce queue hook initializes and renders with the combined
adaptive/pacing controls. The exact candidate JAR wrote 643 frame intervals and
2,408 server-tick samples over 120 seconds; CSV counts and means match the reports,
+1
View File
@@ -4,6 +4,7 @@
"java_major": 25,
"fabric_loader": "0.19.5",
"pack_version": "0.7.0",
"options_data_version": 5023,
"projects": {
"sodium": {
"slug": "sodium",
+4
View File
@@ -74,6 +74,10 @@ class PackTests(unittest.TestCase):
[f"overrides/mods/horizon-lab-{build_pack.read_lock()['pack_version']}.jar"])
index = json.loads(archive.read("modrinth.index.json"))
self.assertEqual(index["dependencies"]["minecraft"], "26.3")
options = dict(line.split(":", 1) for line in archive.read("overrides/options.txt").decode().splitlines())
# A missing/currently wrong version invokes the game's graphics API reset migration.
self.assertEqual(options["version"], "5023")
self.assertEqual(json.loads(options["preferredGraphicsBackend"]), "opengl")
for entry in index["files"]:
self.assertEqual(set(entry["hashes"]), {"sha1", "sha512"})
self.assertTrue(entry["downloads"][0].startswith("https://cdn.modrinth.com/"))
+4
View File
@@ -46,6 +46,10 @@ def test_metrics():
def build():
lock = json.loads((ROOT / "packs/mods.lock.json").read_text())
_, jars, _ = runtime.prepare_client(assets=False)
with zipfile.ZipFile(jars[0]) as game_archive:
game_version = json.loads(game_archive.read("version.json"))
if game_version["world_version"] != lock["options_data_version"]:
raise ValueError("Pack options data version does not match the verified game JAR")
dh = lock["projects"]["distanthorizons"]
jars.append(runtime.fetch(dh["url"], ROOT / ".local/pack-cache" / dh["filename"],
dh["hashes"]["sha512"], "sha512"))
+2 -1
View File
@@ -64,7 +64,8 @@ def mod_path(entry):
def options(profile):
# Simulation distance stays at the vanilla default in every profile.
values = {"renderDistance": profile["render"], "simulationDistance": 12, "enableVsync": "false",
values = {"version": read_lock()["options_data_version"],
"renderDistance": profile["render"], "simulationDistance": 12, "enableVsync": "false",
"maxFps": 260, "guiScale": 2, "onboardAccessibility": "false",
"preferredGraphicsBackend": json.dumps(profile.get("backend", "opengl"))}
return "".join(f"{key}:{value}\n" for key, value in values.items())