Auto disable shaders on load failure
This commit is contained in:
@@ -7,6 +7,7 @@ import me.cortex.voxy.client.core.util.IrisUtil;
|
||||
import me.cortex.voxy.client.iris.IGetIrisVoxyPipelineData;
|
||||
import me.cortex.voxy.common.Logger;
|
||||
import net.irisshaders.iris.Iris;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@@ -34,7 +35,13 @@ public class RenderPipelineFactory {
|
||||
return null;
|
||||
}
|
||||
Logger.info("Creating voxy iris render pipeline");
|
||||
try {
|
||||
return new IrisVoxyRenderPipeline(pipeData, nodeManager, nodeCleaner, traversal, frexSupplier);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to create iris render pipeline", e);
|
||||
IrisApi.getInstance().getConfig().setShadersEnabledAndApply(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import me.cortex.voxy.common.Logger;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.irisshaders.iris.shaderpack.ShaderPack;
|
||||
import net.irisshaders.iris.shaderpack.include.AbsolutePackPath;
|
||||
|
||||
@@ -314,12 +315,14 @@ public class IrisShaderPatch {
|
||||
} catch (Exception e) {
|
||||
patchData = null;
|
||||
Logger.error("Failed to parse patch data gson",e);
|
||||
IrisApi.getInstance().getConfig().setShadersEnabledAndApply(false);//Disable shaders
|
||||
}
|
||||
if (patchData == null) {
|
||||
return null;
|
||||
}
|
||||
if (patchData.version != VERSION) {
|
||||
Logger.error("Shader has voxy patch data, but patch version is incorrect. expected " + VERSION + " got "+patchData.version);
|
||||
IrisApi.getInstance().getConfig().setShadersEnabledAndApply(false);//Disable shaders
|
||||
return null;
|
||||
}
|
||||
return new IrisShaderPatch(patchData, ipack);
|
||||
|
||||
@@ -15,8 +15,8 @@ public class AllocationArena {
|
||||
private static final int SIZE_BITS = 64 - ADDR_BITS;
|
||||
private static final long SIZE_MSK = (1L<<SIZE_BITS)-1;
|
||||
private static final long ADDR_MSK = (1L<<ADDR_BITS)-1;
|
||||
private final LongRBTreeSet FREE = new LongRBTreeSet();//Size Address
|
||||
private final LongRBTreeSet TAKEN = new LongRBTreeSet();//Address Size
|
||||
private final LongRBTreeSet FREE = new LongRBTreeSet(Long::compareUnsigned);//Size Address
|
||||
private final LongRBTreeSet TAKEN = new LongRBTreeSet(Long::compareUnsigned);//Address Size
|
||||
|
||||
private long sizeLimit = Long.MAX_VALUE;
|
||||
private long totalSize;
|
||||
@@ -41,6 +41,19 @@ public class AllocationArena {
|
||||
public long getSize() {
|
||||
return this.totalSize;
|
||||
}
|
||||
|
||||
|
||||
public int numFreeBlocks() {
|
||||
return this.FREE.size();
|
||||
}
|
||||
|
||||
public int getLargestFreeBlockSize(int index) {
|
||||
var iter = this.FREE.tailSet(-1).iterator();
|
||||
for (;index>0&&iter.hasPrevious();index--){iter.previousLong();}
|
||||
long slot = iter.previousLong();
|
||||
return (int) (slot>>ADDR_BITS);
|
||||
}
|
||||
|
||||
/*
|
||||
public long allocFromLargest(int size) {//Allocates from the largest avalible block, this is useful for expanding later on
|
||||
|
||||
|
||||
Reference in New Issue
Block a user