Compare commits

...
Author SHA1 Message Date
Jason Mitchell 8898a6f252 Switcharoo on detecting ThreadSafeISBRHFactory... (#318)
other method apparently wasn't working
2024-02-20 22:17:00 -08:00
Jason Mitchell 37f638ac34 scheduleRebuildOffThread (#316)
* scheduleRebuildOffThread
2024-02-20 08:58:03 -08:00
Jason Mitchell f73c698a5a Don't crash wit invalid lightquality/particalmode options 2024-02-17 22:46:31 -08:00
5 changed files with 13 additions and 7 deletions

No files matched your search

@@ -847,7 +847,9 @@ public class GLStateManager {
public static void glDrawArrays(int mode, int first, int count) {
// Iris -- TODO: This doesn't seem to work and is related to matchPass()
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
if(AngelicaConfig.enableIris) {
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
}
GL11.glDrawArrays(mode, first, count);
}
@@ -45,7 +45,7 @@ public class MixinRenderingRegistry implements IRenderingRegistryExt {
throw new RuntimeException(e.getCause());
}
});
} else if (mainThreadHandler.getClass().isInstance(ThreadSafeISBRHFactory.class)) {
} else if (ThreadSafeISBRHFactory.class.isAssignableFrom(mainThreadHandler.getClass())) {
return THREAD_LOCAL_MAP.get().computeIfAbsent(mainThreadHandler.getClass(), k -> ((ThreadSafeISBRHFactory) mainThreadHandler).newInstance());
}
}
@@ -1,5 +1,7 @@
package me.jellysquid.mods.sodium.client.gui.options.named;
import net.minecraft.util.MathHelper;
public enum LightingQuality implements NamedState {
OFF("options.ao.off"),
LOW("options.ao.min"),
@@ -26,6 +28,6 @@ public enum LightingQuality implements NamedState {
}
public static LightingQuality fromOrdinal(int ordinal) {
return VALUES[ordinal];
return VALUES[MathHelper.clamp_int(ordinal, 0, VALUES.length - 1)];
}
}
@@ -1,5 +1,7 @@
package me.jellysquid.mods.sodium.client.gui.options.named;
import net.minecraft.util.MathHelper;
public enum ParticleMode implements NamedState {
ALL("options.particles.all"),
DECREASED("options.particles.decreased"),
@@ -19,6 +21,6 @@ public enum ParticleMode implements NamedState {
}
public static ParticleMode fromOrdinal(int ordinal) {
return VALUES[ordinal];
return VALUES[MathHelper.clamp_int(ordinal, 0, VALUES.length - 1)];
}
}
@@ -4,6 +4,7 @@ import com.gtnewhorizons.angelica.compat.mojang.Camera;
import com.gtnewhorizons.angelica.compat.mojang.ChunkPos;
import com.gtnewhorizons.angelica.compat.toremove.MatrixStack;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@@ -45,6 +46,7 @@ import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkStatusListener {
/**
@@ -639,9 +641,7 @@ public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkSt
}
private void scheduleRebuildOffThread(int x, int y, int z, boolean important) {
// TODO: Sodium Threads
throw new RuntimeException("scheduleRebuildOffThread");
// Minecraft.getMinecraft().submit(() -> this.scheduleRebuild(x, y, z, important));
AngelicaRenderQueue.executor().execute(() -> this.scheduleRebuild(x, y, z, important));
}
public void scheduleRebuild(int x, int y, int z, boolean important) {