Remove shader packs
A developer of Iris showed that Horizon's shader pack code was written from Iris's source. This removes it: the horizon-shaderpack crate, Java pack loading and its render stages, Horizon's own WGSL packs and the example packs, the Shader Packs screen and its option, the launcher's shader pack browsing and installing, and the docs about them. Shader packs may come back later as a clean-room rewrite. The vanilla renderer and its post-processing (resolution scale, FXAA) are unchanged. Options files that name a pack load and drop the key; the launcher reads manifests that list a shader pack, and files in `shaderpacks/` are never deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,7 +141,6 @@ public final class HorizonClient implements ClientModInitializer {
|
||||
try { context.putAll(DistantTerrainSettings.read()); }
|
||||
catch (RuntimeException | LinkageError unavailable) { context.put("dh_capture_status", "unavailable"); }
|
||||
} else context.put("dh_capture_status", "not_installed");
|
||||
context.putAll(ShaderSettings.read(loader.isModLoaded("iris")));
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -191,7 +190,7 @@ public final class HorizonClient implements ClientModInitializer {
|
||||
changed.add(setting.getKey());
|
||||
}
|
||||
for (String setting : recording.context.keySet()) {
|
||||
if ((setting.startsWith("dh_") || setting.startsWith("iris_")) && !end.containsKey(setting))
|
||||
if (setting.startsWith("dh_") && !end.containsKey(setting))
|
||||
changed.add(setting);
|
||||
}
|
||||
recording.context.put("visual_settings_end", end);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package dev.horizonlab.client;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/** Optional Iris reflection keeps baseline clients independent of shader-mod classes. */
|
||||
final class ShaderSettings {
|
||||
private ShaderSettings() {}
|
||||
|
||||
static Map<String, Object> read(boolean irisPresent) {
|
||||
if (!irisPresent) return Map.of("iris_capture_status", "not_installed", "iris_shaders_enabled", false);
|
||||
try {
|
||||
Class<?> api = Class.forName("net.irisshaders.iris.api.v0.IrisApi");
|
||||
Object instance = api.getMethod("getInstance").invoke(null);
|
||||
boolean enabled = (Boolean) api.getMethod("isShaderPackInUse").invoke(instance);
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("iris_capture_status", "available");
|
||||
result.put("iris_shaders_enabled", enabled);
|
||||
if (enabled) {
|
||||
Class<?> iris = Class.forName("net.irisshaders.iris.Iris");
|
||||
result.put("iris_shader_pack", iris.getMethod("getCurrentPackName").invoke(null));
|
||||
}
|
||||
return result;
|
||||
} catch (ReflectiveOperationException | RuntimeException | LinkageError unavailable) {
|
||||
return Map.of("iris_capture_status", "unavailable");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,9 +51,6 @@ public final class DistantTerrainSettingsTest {
|
||||
check(DistantTerrainSettings.read(missing).equals(Map.of("dh_capture_status", "unavailable")));
|
||||
var changedApi = proxy(IDhApiConfig.class, (p, method, values) -> { throw new NoSuchMethodError(); });
|
||||
check(DistantTerrainSettings.read(changedApi).equals(Map.of("dh_capture_status", "unavailable")));
|
||||
check(ShaderSettings.read(false).equals(Map.of("iris_capture_status", "not_installed", "iris_shaders_enabled", false)));
|
||||
// Test classpath deliberately omits Iris; it must report unavailable rather than assume disabled.
|
||||
check(ShaderSettings.read(true).equals(Map.of("iris_capture_status", "unavailable")));
|
||||
System.out.println("Effective terrain settings and absent/unsupported shader APIs checked.");
|
||||
System.out.println("Effective terrain settings and absent/unsupported terrain APIs checked.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.nio.file.Files;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.HashSet;
|
||||
import java.util.HexFormat;
|
||||
import java.util.Map;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
@@ -27,30 +26,6 @@ public final class ClientGraphicsIntegration implements ClientModInitializer {
|
||||
private long lastWaitingState;
|
||||
private final boolean worldMode = Files.exists(FabricLoader.getInstance().getConfigDir().resolve("client-graphics-world.flag"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void captureShaders(JsonObject result) throws ReflectiveOperationException, java.io.IOException {
|
||||
// Reuse the production recorder's read-only Iris API inspection. The
|
||||
// bridge and enabling flag exist solely in this private test fixture.
|
||||
var method = Class.forName("dev.horizonlab.client.ShaderSettings").getDeclaredMethod("read", boolean.class);
|
||||
method.setAccessible(true);
|
||||
var settings = (Map<String, Object>) method.invoke(null, FabricLoader.getInstance().isModLoaded("iris"));
|
||||
String status = String.valueOf(settings.get("iris_capture_status"));
|
||||
boolean enabled = Boolean.TRUE.equals(settings.get("iris_shaders_enabled"));
|
||||
result.addProperty("iris_capture_status", status);
|
||||
result.addProperty("iris_shaders_enabled", enabled);
|
||||
var flag = FabricLoader.getInstance().getConfigDir().resolve("client-graphics-shaders.flag");
|
||||
boolean required = Files.isRegularFile(flag);
|
||||
result.addProperty("shader_required", required);
|
||||
if (required) {
|
||||
String expected = Files.readString(flag).strip();
|
||||
boolean match = expected.equals(settings.get("iris_shader_pack"));
|
||||
result.addProperty("iris_expected_pack_matches", match);
|
||||
// Do not export arbitrary pack names or paths from runtime APIs.
|
||||
if (!status.equals("available") || !enabled) throw new AssertionError("Required shader pack is inactive");
|
||||
if (!match) throw new AssertionError("Unexpected active shader pack");
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onInitializeClient() {
|
||||
System.out.println("HORIZON_CLIENT_GRAPHICS_INITIALIZER_READY");
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
@@ -134,7 +109,6 @@ public final class ClientGraphicsIntegration implements ClientModInitializer {
|
||||
result.addProperty("overlay_present", client.gui.overlay() != null);
|
||||
result.addProperty("overlay_wait_ticks", overlayWaitTicks);
|
||||
result.addProperty("heap_max_bytes", Runtime.getRuntime().maxMemory());
|
||||
captureShaders(result);
|
||||
result.addProperty("framebuffer_width", width);
|
||||
result.addProperty("framebuffer_height", height);
|
||||
result.addProperty("sampled_pixels", samples);
|
||||
|
||||
Reference in New Issue
Block a user