changes and attempted fixes
This commit is contained in:
@@ -98,6 +98,8 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
glBlitNamedFramebuffer(sourceFrameBuffer, targetFb, 0,0, width, height, 0,0, width, height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
glBlitNamedFramebuffer(sourceFrameBuffer, targetFb, 0,0, width, height, 0,0, width, height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||||
|
|
||||||
glBindFramebuffer(GL30.GL_FRAMEBUFFER, targetFb);
|
glBindFramebuffer(GL30.GL_FRAMEBUFFER, targetFb);
|
||||||
|
//GL11C.glClearStencil(1);
|
||||||
|
//GL11C.glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
//This whole thing is hell, we basicly want to create a mask stenicel/depth mask specificiclly
|
//This whole thing is hell, we basicly want to create a mask stenicel/depth mask specificiclly
|
||||||
// in theory we could do this in a single pass by passing in the depth buffer from the sourceFrambuffer
|
// in theory we could do this in a single pass by passing in the depth buffer from the sourceFrambuffer
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ public class Capabilities {
|
|||||||
public final boolean indirectParameters;
|
public final boolean indirectParameters;
|
||||||
public final boolean isIntel;
|
public final boolean isIntel;
|
||||||
public final boolean subgroup;
|
public final boolean subgroup;
|
||||||
|
public final boolean sparseBuffer;
|
||||||
|
|
||||||
public Capabilities() {
|
public Capabilities() {
|
||||||
var cap = GL.getCapabilities();
|
var cap = GL.getCapabilities();
|
||||||
|
this.sparseBuffer = cap.GL_ARB_sparse_buffer;
|
||||||
this.compute = cap.glDispatchComputeIndirect != 0;
|
this.compute = cap.glDispatchComputeIndirect != 0;
|
||||||
this.indirectParameters = cap.glMultiDrawElementsIndirectCountARB != 0;
|
this.indirectParameters = cap.glMultiDrawElementsIndirectCountARB != 0;
|
||||||
this.repFragTest = cap.GL_NV_representative_fragment_test;
|
this.repFragTest = cap.GL_NV_representative_fragment_test;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import me.cortex.voxy.common.util.TrackedObject;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
import org.lwjgl.system.MemoryUtil;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.ARBSparseBuffer.GL_SPARSE_STORAGE_BIT_ARB;
|
||||||
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE;
|
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE;
|
||||||
import static org.lwjgl.opengl.GL15.glDeleteBuffers;
|
import static org.lwjgl.opengl.GL15.glDeleteBuffers;
|
||||||
import static org.lwjgl.opengl.GL45C.*;
|
import static org.lwjgl.opengl.GL45C.*;
|
||||||
@@ -23,7 +24,9 @@ public class GlBuffer extends TrackedObject {
|
|||||||
this.id = glCreateBuffers();
|
this.id = glCreateBuffers();
|
||||||
this.size = size;
|
this.size = size;
|
||||||
glNamedBufferStorage(this.id, size, flags);
|
glNamedBufferStorage(this.id, size, flags);
|
||||||
|
if ((flags&GL_SPARSE_STORAGE_BIT_ARB)==0) {
|
||||||
this.zero();
|
this.zero();
|
||||||
|
}
|
||||||
|
|
||||||
COUNT++;
|
COUNT++;
|
||||||
TOTAL_SIZE += size;
|
TOTAL_SIZE += size;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.cortex.voxy.client.core.model;
|
package me.cortex.voxy.client.core.model;
|
||||||
|
|
||||||
import net.caffeinemc.mods.sodium.client.util.color.ColorSRGB;
|
import net.caffeinemc.mods.sodium.client.util.color.ColorSRGB;
|
||||||
|
import net.minecraft.client.texture.MipmapHelper;
|
||||||
|
|
||||||
//Texturing utils to manipulate data from the model bakery
|
//Texturing utils to manipulate data from the model bakery
|
||||||
public class TextureUtils {
|
public class TextureUtils {
|
||||||
@@ -177,8 +178,12 @@ public class TextureUtils {
|
|||||||
|
|
||||||
|
|
||||||
public static int mipColours(int one, int two, int three, int four) {
|
public static int mipColours(int one, int two, int three, int four) {
|
||||||
|
if (true) {
|
||||||
|
return MipmapHelper.blend(one, two, three, four, false);
|
||||||
|
} else {
|
||||||
return weightedAverageColor(weightedAverageColor(one, two), weightedAverageColor(three, four));
|
return weightedAverageColor(weightedAverageColor(one, two), weightedAverageColor(three, four));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: FIXME!!! ITS READING IT AS ABGR??? isnt the format RGBA??
|
//TODO: FIXME!!! ITS READING IT AS ABGR??? isnt the format RGBA??
|
||||||
private static int weightedAverageColor(int a, int b) {
|
private static int weightedAverageColor(int a, int b) {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import me.cortex.voxy.client.core.gl.Capabilities;
|
|||||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||||
import me.cortex.voxy.common.Logger;
|
import me.cortex.voxy.common.Logger;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11C.glFinish;
|
import static org.lwjgl.opengl.ARBSparseBuffer.GL_SPARSE_STORAGE_BIT_ARB;
|
||||||
|
import static org.lwjgl.opengl.ARBSparseBuffer.glNamedBufferPageCommitmentARB;
|
||||||
|
import static org.lwjgl.opengl.GL11C.*;
|
||||||
|
|
||||||
public class BasicSectionGeometryData implements IGeometryData {
|
public class BasicSectionGeometryData implements IGeometryData {
|
||||||
public static final int SECTION_METADATA_SIZE = 32;
|
public static final int SECTION_METADATA_SIZE = 32;
|
||||||
@@ -28,7 +30,26 @@ public class BasicSectionGeometryData implements IGeometryData {
|
|||||||
}
|
}
|
||||||
Logger.info(msg);
|
Logger.info(msg);
|
||||||
Logger.info("if your game crashes/exits here without any other log message, try manually decreasing the geometry capacity");
|
Logger.info("if your game crashes/exits here without any other log message, try manually decreasing the geometry capacity");
|
||||||
this.geometryBuffer = new GlBuffer(geometryCapacity);
|
glGetError();//Clear any errors
|
||||||
|
var buffer = new GlBuffer(geometryCapacity);
|
||||||
|
int error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR) {
|
||||||
|
if (error == GL_OUT_OF_MEMORY && Capabilities.INSTANCE.sparseBuffer) {
|
||||||
|
Logger.error("Failed to allocate geometry buffer, attempting workaround with sparse buffers");
|
||||||
|
buffer.free();
|
||||||
|
buffer = new GlBuffer(geometryCapacity, GL_SPARSE_STORAGE_BIT_ARB);
|
||||||
|
glNamedBufferPageCommitmentARB(buffer.id, 0, geometryCapacity, true);
|
||||||
|
buffer.zero();
|
||||||
|
error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR) {
|
||||||
|
buffer.free();
|
||||||
|
throw new IllegalStateException("Unable to allocate geometry buffer using workaround, got gl error " + error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Unable to allocate geometry buffer, got gl error " + error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.geometryBuffer = buffer;
|
||||||
long delta = System.currentTimeMillis() - start;
|
long delta = System.currentTimeMillis() - start;
|
||||||
Logger.info("Successfully allocated and zeroed the geometry buffer in " + delta + "ms");
|
Logger.info("Successfully allocated and zeroed the geometry buffer in " + delta + "ms");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,3 +34,5 @@ accessible method net/minecraft/client/world/ClientChunkManager$ClientChunkMap g
|
|||||||
accessible method net/minecraft/client/world/ClientChunkManager$ClientChunkMap getIndex (II)I
|
accessible method net/minecraft/client/world/ClientChunkManager$ClientChunkMap getIndex (II)I
|
||||||
|
|
||||||
accessible field net/minecraft/client/texture/SpriteAtlasTexture mipLevel I
|
accessible field net/minecraft/client/texture/SpriteAtlasTexture mipLevel I
|
||||||
|
|
||||||
|
accessible method net/minecraft/client/texture/MipmapHelper blend (IIIIZ)I
|
||||||
Reference in New Issue
Block a user