Fixup MixinUtilBackgroudThread+more render log
This commit is contained in:
@@ -199,4 +199,10 @@ public class LodVertexBuffer implements AutoCloseable
|
||||
GL32.glUnmapBuffer(GL32.GL_ARRAY_BUFFER);
|
||||
isMapped = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (isBufferStorage ? "VertexBufferStorage" : "BufferStorage")+
|
||||
"[vboId:"+id+", size:"+size+", vertCount:"+vertexCount+(isMapped?", MAPPED" : "")+"]";
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import java.nio.ByteBuffer;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.seibel.lod.core.render.LodRenderer;
|
||||
import com.seibel.lod.core.util.SpamReducedLogger;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
|
||||
import com.seibel.lod.core.api.ApiShared;
|
||||
@@ -47,18 +49,21 @@ public class SimpleRenderBuffer extends RenderBuffer
|
||||
|
||||
// public void onSwapToFront() {}
|
||||
// public void onSwapToBack() {}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean render(LodRenderProgram shaderProgram)
|
||||
{
|
||||
boolean hasRendered = false;
|
||||
for (LodVertexBuffer vbo : vbos) {
|
||||
if (vbo == null) continue;
|
||||
if (vbo.vertexCount == 0) continue;
|
||||
hasRendered = true;
|
||||
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, vbo.id);
|
||||
shaderProgram.bindVertexBuffer(vbo.id);
|
||||
GL32.glDrawArrays(GL32.GL_TRIANGLES, 0, vbo.vertexCount);
|
||||
LodRenderer.tickLogger.info("Vertex buffer: {}", vbo);
|
||||
}
|
||||
return true;
|
||||
return hasRendered;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -280,6 +280,7 @@ public class GLProxy
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, GLFW.GLFW_TRUE);
|
||||
|
||||
// create the LodBuilder context
|
||||
lodBuilderGlContext = GLFW.glfwCreateWindow(64, 48, "LOD Builder Window", 0L, minecraftGlContext);
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.time.Duration;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.seibel.lod.core.util.*;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
|
||||
import com.seibel.lod.core.api.ApiShared;
|
||||
@@ -39,10 +41,6 @@ import com.seibel.lod.core.objects.math.Vec3d;
|
||||
import com.seibel.lod.core.objects.math.Vec3f;
|
||||
import com.seibel.lod.core.objects.opengl.RenderRegion;
|
||||
import com.seibel.lod.core.render.objects.LightmapTexture;
|
||||
import com.seibel.lod.core.util.DetailDistanceUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MovableGridRingList;
|
||||
import com.seibel.lod.core.util.MovableGridList;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
@@ -136,7 +134,22 @@ public class LodRenderer
|
||||
{
|
||||
lodBufferBuilderFactory = newLodNodeBufferBuilder;
|
||||
}
|
||||
|
||||
public static SpamReducedLogger tickLogger = new SpamReducedLogger(1);
|
||||
|
||||
public static void dumpGLState(String str) {
|
||||
int currentProgram = GL32.glGetInteger(GL32.GL_CURRENT_PROGRAM);
|
||||
int currentVBO = GL32.glGetInteger(GL32.GL_ARRAY_BUFFER_BINDING);
|
||||
int currentVAO = GL32.glGetInteger(GL32.GL_VERTEX_ARRAY_BINDING);
|
||||
int currentActiveText = GL32.glGetInteger(GL32.GL_ACTIVE_TEXTURE);
|
||||
int currentFrameBuffer = GL32.glGetInteger(GL32.GL_FRAMEBUFFER);
|
||||
boolean currentBlend = GL32.glGetBoolean(GL32.GL_BLEND);
|
||||
int currentDepthFunc = GL32.glGetInteger(GL32.GL_DEPTH_FUNC);
|
||||
tickLogger.info(str + ": [Prog:{}, VAO:{}, VBO:{}, Text:{}, FBO:{}, blend:{}, dpFunc:{}]",
|
||||
currentProgram, currentVAO, currentVBO, currentActiveText, currentFrameBuffer,
|
||||
currentBlend, currentDepthFunc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Besides drawing the LODs this method also starts
|
||||
* the async process of generating the Buffers that hold those LODs.
|
||||
@@ -173,9 +186,13 @@ public class LodRenderer
|
||||
int currentVBO = GL32.glGetInteger(GL32.GL_ARRAY_BUFFER_BINDING);
|
||||
int currentVAO = GL32.glGetInteger(GL32.GL_VERTEX_ARRAY_BINDING);
|
||||
int currentActiveText = GL32.glGetInteger(GL32.GL_ACTIVE_TEXTURE);
|
||||
int currentFrameBuffer = GL32.glGetInteger(GL32.GL_FRAMEBUFFER);
|
||||
boolean currentBlend = GL32.glGetBoolean(GL32.GL_BLEND);
|
||||
int currentDepthFunc = GL32.glGetInteger(GL32.GL_DEPTH_FUNC);
|
||||
dumpGLState("PRE_LOD-DRAW");
|
||||
|
||||
drawSaveGLState.end("drawSaveGLState");
|
||||
|
||||
|
||||
GLProxy glProxy = GLProxy.getInstance();
|
||||
if (canVanillaFogBeDisabled && CONFIG.client().graphics().fogQuality().getDisableVanillaFog())
|
||||
if (!MC_RENDER.tryDisableVanillaFog())
|
||||
@@ -253,13 +270,16 @@ public class LodRenderer
|
||||
drawSetPolygon.end("drawSetPolygon");
|
||||
LagSpikeCatcher drawEnableDepth = new LagSpikeCatcher();
|
||||
GL32.glEnable(GL32.GL_DEPTH_TEST);
|
||||
//GL32.glDisable(GL32.GL_DEPTH_TEST);
|
||||
// GL32.glDisable(GL32.GL_DEPTH_TEST);
|
||||
GL32.glDepthFunc(GL32.GL_LEQUAL);
|
||||
drawEnableDepth.end("drawEnableDepth");
|
||||
drawGLSetup.end("drawGLSetup");
|
||||
// enable transparent rendering
|
||||
// GL32.glBlendFunc(GL32.GL_SRC_ALPHA, GL32.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// GL32.glEnable(GL32.GL_BLEND);
|
||||
|
||||
GL32.glDisable(GL32.GL_BLEND);
|
||||
// GL32.glClear(GL32.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/*---------Bind required objects--------*/
|
||||
// Setup LodRenderProgram and the LightmapTexture if it has not yet been done
|
||||
// also binds LightmapTexture, VAO, and ShaderProgram
|
||||
@@ -315,6 +335,7 @@ public class LodRenderer
|
||||
Vec3d cameraPos = MC_RENDER.getCameraExactPosition();
|
||||
AbstractBlockPosWrapper cameraBlockPos = MC_RENDER.getCameraBlockPosition();
|
||||
Vec3f cameraDir = MC_RENDER.getLookAtVector();
|
||||
int drawCount = 0;
|
||||
|
||||
{
|
||||
int ox,oy,dx,dy;
|
||||
@@ -331,8 +352,8 @@ public class LodRenderer
|
||||
{
|
||||
RenderRegion region = regions.get(regionX, regionZ);
|
||||
if (region == null) continue;
|
||||
region.render(lodDim, cameraPos, cameraBlockPos, cameraDir,
|
||||
baseModelViewMatrix, !cullingDisabled, shaderProgram);
|
||||
if (region.render(lodDim, cameraPos, cameraBlockPos, cameraDir,
|
||||
baseModelViewMatrix, !cullingDisabled, shaderProgram)) drawCount++;
|
||||
}
|
||||
}
|
||||
if( (ox == oy) || ((ox < 0) && (ox == -oy)) || ((ox > 0) && (ox == 1-oy))){
|
||||
@@ -345,7 +366,7 @@ public class LodRenderer
|
||||
}
|
||||
}
|
||||
//if (drawCall==0)
|
||||
// ApiShared.LOGGER.info("DrawCall Count: "+drawCall+"("+vCount0+")");
|
||||
tickLogger.info("DrawCall Count: {}", drawCount);
|
||||
|
||||
//================//
|
||||
// render cleanup //
|
||||
@@ -380,6 +401,7 @@ public class LodRenderer
|
||||
drawCleanup.end("LodDrawCleanup");
|
||||
// end of internal LOD profiling
|
||||
profiler.pop();
|
||||
tickLogger.incLogTries();
|
||||
}
|
||||
|
||||
//=================//
|
||||
|
||||
@@ -62,9 +62,8 @@ void main()
|
||||
returnColor = vertexColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fragColor = returnColor;
|
||||
//fragColor = vec4(0.7,0.6,0.5,1.0);
|
||||
fragColor = vec4(returnColor.rgb,1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,12 @@ void main()
|
||||
vertexColor = color * texture(lightMap, vec2(light,0.5));
|
||||
|
||||
vertexWorldPos = worldSpacePos.xyz;
|
||||
|
||||
|
||||
// vec4 pos = projectionMatrix * worldSpacePos;
|
||||
gl_Position = projectionMatrix * worldSpacePos;
|
||||
/*pos.a = 1.0;
|
||||
if (pos.x>0) pos.x=-1; else pos.x=1;
|
||||
if (pos.y>0) pos.y=-1; else pos.y=1;
|
||||
pos.z = 0.5;
|
||||
gl_Position = pos;*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user