Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void probeAtStartup() {
if (!Boolean.TRUE.equals(EarlyVulkan.vulkanEligible()))
return;
List<Path> markers = markers();
if (markers.stream().anyMatch(Files::exists) || EarlyVulkan.switched())
if (EarlyVulkan.decisionDeferred || markers.stream().anyMatch(Files::exists) || EarlyVulkan.switched())
return;
// Java can't catch a native crash in the probe; the marker left behind keeps it from repeating every launch
Path guard = writeMarker(markers);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/polyfrost/polydium/early/EarlyVulkan.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public final class EarlyVulkan implements LanguageAdapter {

private static Boolean vulkanAtStartup;

public static boolean decisionDeferred;

//? if >= 26.2 {
private static List<String> createdOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.polyfrost.polydium.early;

import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
//? if >= 1.21.11 {
import oshi.SystemInfo;
Expand All @@ -22,7 +23,7 @@ public final class EarlyVulkanPreLaunch implements PreLaunchEntrypoint {
public void onPreLaunch() {
//? if >= 1.21.11
showSwitchableGpus();
detect(/*? if >= 26.2 {*/true/*?} else {*//*false*//*?}*/);
detect(/*? if >= 26.2 {*/!FabricLoader.getInstance().isModLoaded("iris")/*?} else {*//*false*//*?}*/);
}

public void beforeMixinSelection() {
Expand All @@ -41,6 +42,8 @@ private void detect(boolean decide) {
// Older versions must not change the backend after their Vulkan mixins were selected.
if (decide)
new EarlyVulkan();
else
EarlyVulkan.decisionDeferred = true;
} catch (Throwable ignored) {
}
//?}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class EarlyVulkanTest {
Files.deleteIfExists(irisConfig)
Files.deleteIfExists(gameDir.resolve("logs/debug-2026-11-12-1.log.gz"))
EarlyVulkan::class.java.getDeclaredField("vulkanAtStartup").apply { isAccessible = true }.set(null, null)
EarlyVulkan.decisionDeferred = false
//? if >= 26.2 {
EarlyVulkan::class.java.getDeclaredField("irisLoaded").apply { isAccessible = true }.set(null, false)
Files.deleteIfExists(irisConfig)
Expand Down Expand Up @@ -140,6 +141,7 @@ class EarlyVulkanTest {
EarlyVulkanPreLaunch().beforeMixinSelection()

assertTrue(Files.exists(marker))
assertFalse(EarlyVulkan.decisionDeferred)
}

//? if < 26.2 {
Expand All @@ -159,6 +161,7 @@ class EarlyVulkanTest {
assertTrue(EarlyVulkan.discreteGpuKnown())
assertEquals("default", EarlyVulkan.graphicsApi())
assertFalse(Files.exists(marker))
assertTrue(EarlyVulkan.decisionDeferred)
}
*///?}

Expand Down