Compare commits

..
Author SHA1 Message Date
Jason Mitchell 52776530d8 Handle GL_COMPILE separately from GL_COMPILE_AND_EXECUTE
* Should fix OpenComputer issues
2023-12-26 17:19:35 -08:00
Jason Mitchell 9cebb352ad Opt in debug
* Less stutter with buggy stuff
2023-12-26 15:12:44 -08:00
embeddedt d810eaf876 Use client world for main thread renders 2023-12-26 12:45:45 -08:00
Jason Mitchell 1a1ca32721 Update 000-report-bug.yml 2023-12-26 09:10:00 -08:00
Jason Mitchell a3d689e806 Because of course someone uses DoubleBuffer 2023-12-26 08:45:26 -08:00
embeddedt d4e22b6c0c Avoid restoring GL buffers we didn't modify 2023-12-26 07:35:29 -08:00
6 changed files with 43 additions and 18 deletions

No files matched your search

+3 -3
View File
@@ -45,9 +45,9 @@ body:
- type: textarea
id: modlist
attributes:
label: Mod List
description: "List of mods, ideally a minimal reproducible set (can be retrieved from latest.log)"
placeholder: "List of mods go here"
label: Mod List or GTNH Pack Version
description: "List of mods, ideally a minimal reproducible set (can be retrieved from latest.log). If using GTNH please indicate pack version and any changed mods, not the entire modlist."
placeholder: "List of mods or GTNH Pack version goes here"
validations:
required: true
- type: checkboxes
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.glsm;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.glsm.states.AlphaState;
import com.gtnewhorizons.angelica.glsm.states.BlendState;
@@ -26,6 +27,7 @@ import net.coderbot.iris.texture.TextureInfoCache;
import net.coderbot.iris.texture.TextureTracker;
import net.coderbot.iris.texture.pbr.PBRTextureManager;
import net.minecraft.client.renderer.OpenGlHelper;
import org.joml.Matrix4d;
import org.joml.Matrix4f;
import org.joml.Vector3d;
import org.lwjgl.BufferUtils;
@@ -37,6 +39,7 @@ import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.stream.IntStream;
@@ -83,7 +86,7 @@ public class GLStateManager {
private static Thread CurrentThread = MainThread;
private static boolean runningSplash = false;
private static boolean inGLNewList = false;
private static int glListMode = 0;
private static boolean hudCaching$blendEnabled;
@@ -397,10 +400,12 @@ public class GLStateManager {
}
public static void glBindTexture(int target, int texture) {
if(inGLNewList) {
// Binding a texture, while building a list, is not allowed and is a silent noop
Throwable throwable = new Throwable();
LOGGER.info("Naughty naughty, someone's making a texture binding in a display list!", throwable);
if(glListMode == GL11.GL_COMPILE ) {
if(AngelicaMod.lwjglDebug) {
// Binding a texture, while building a list, is not allowed and is a silent noop
final Throwable throwable = new Throwable();
LOGGER.info("Naughty naughty, someone's making a texture binding in a display list!", throwable);
}
return;
}
@@ -664,18 +669,19 @@ public class GLStateManager {
}
public static void glNewList(int list, int mode) {
if(inGLNewList) {
if(glListMode > 0) {
throw new RuntimeException("glNewList called inside of a display list!");
}
inGLNewList = true;
glListMode = mode;
GL11.glNewList(list, mode);
}
public static void glEndList() {
if(!inGLNewList) {
if(glListMode == 0) {
throw new RuntimeException("glEndList called outside of a display list!");
}
inGLNewList = false;
glListMode = 0;
GL11.glEndList();
}
@@ -739,6 +745,15 @@ public class GLStateManager {
matrixState.multiply(matrix);
}
public static final Matrix4d conersionMatrix4d = new Matrix4d();
public static final Matrix4f conersionMatrix4f = new Matrix4f();
public static void glMultMatrix(DoubleBuffer matrix) {
GL11.glMultMatrix(matrix);
conersionMatrix4d.set(matrix);
conersionMatrix4f.set(conersionMatrix4d);
matrixState.multiply(conersionMatrix4f);
}
public static void glRotatef(float angle, float x, float y, float z) {
GL11.glRotatef(angle, x, y, z);
matrixState.rotate((float)Math.toRadians(angle), x, y, z);
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.sodium.startup;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import net.coderbot.iris.Iris;
@@ -19,7 +20,7 @@ public class MixinInitDebug {
}
// Temp -- move this into common debug code
Iris.identifyCapabilities();
Iris.setDebug(true);
Iris.setDebug(AngelicaMod.lwjglDebug);
}
}
@@ -8,12 +8,14 @@ import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL30;
import java.util.Arrays;
import java.util.EnumSet;
public class GlStateTracker {
private static final int UNASSIGNED_HANDLE = -1;
private final int[] bufferState = new int[GlBufferTarget.COUNT];
//private final int[] bufferRestoreState = new int[GlBufferTarget.COUNT];
private final EnumSet<GlBufferTarget> mutatedBuffers = EnumSet.noneOf(GlBufferTarget.class);
private int vertexArrayState;
//private int vertexArrayRestoreState;
@@ -31,6 +33,8 @@ public class GlStateTracker {
this.bufferState[target.ordinal()] = buffer;
mutatedBuffers.add(target);
return prevBuffer != buffer;
}
@@ -47,9 +51,10 @@ public class GlStateTracker {
}
public void applyRestoreState() {
for (int i = 0; i < GlBufferTarget.COUNT; i++) {
GL15.glBindBuffer(GlBufferTarget.VALUES[i].getTargetParameter(), 0);
}
mutatedBuffers.forEach(target -> {
GL15.glBindBuffer(target.getTargetParameter(), 0);
});
mutatedBuffers.clear();
if(GlFunctions.isVertexArraySupported()) {
GL30.glBindVertexArray(0);
}
@@ -229,7 +229,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
int baseY = this.render.getOriginY();
int baseZ = this.render.getOriginZ();
BlockPos renderOffset = this.offset;
RenderBlocks rb = new RenderBlocks(slice);
RenderBlocks rb = new RenderBlocks(slice.getWorld());
for (int relY = 0; relY < 16; relY++) {
if (cancellationSource.isCancelled()) {
return;
@@ -258,7 +258,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
long seed = MathUtil.hashPos(pos.x, pos.y, pos.z);
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(block, ExtendedDataHelper.BLOCK_RENDER_TYPE);
if (cache.getBlockRenderer().renderModel(cache.getWorldSlice(), Tessellator.instance, rb, block, meta, pos, buffers.get(pass), true, seed)) {
if (cache.getBlockRenderer().renderModel(slice.getWorld(), Tessellator.instance, rb, block, meta, pos, buffers.get(pass), true, seed)) {
bounds.addBlock(relX, relY, relZ);
}
}
@@ -355,4 +355,8 @@ public class WorldSlice implements IBlockAccess {
case UNKNOWN -> 1.0f;
};
}
public World getWorld() {
return this.world;
}
}