22w16f improved occlusion query stability under lag

This commit is contained in:
LAX1DUDE 2022-04-22 13:20:22 -07:00
parent 7659bc095d
commit df09eb33b5
9 changed files with 63451 additions and 63429 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w16e";
public static final String version = "22w16f";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -156,6 +156,7 @@ public class RenderGlobal implements IWorldAccess {
this.glOcclusionQuery[i] = -1;
}
this.occlusionQueryAvailable = new boolean[glOcclusionQuery.length];
this.occlusionQueryStalled = new boolean[occlusionQueryAvailable.length];
this.starGLCallList = GLAllocation.generateDisplayLists(3);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glNewList(this.starGLCallList, EaglerAdapter.GL_COMPILE);
@ -503,6 +504,7 @@ public class RenderGlobal implements IWorldAccess {
private long lastOcclusionQuery = 0l;
private boolean[] occlusionQueryAvailable;
private boolean[] occlusionQueryStalled;
/**
* Sorts all renderers based on the passed in entity. Args: entityLiving,
@ -569,9 +571,14 @@ public class RenderGlobal implements IWorldAccess {
int ccz = c.chunkZ - fz;
if((ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2) || glOcclusionQuery[c.chunkIndex] == -1) {
c.isVisible = true;
}else if(!c.skipAllRenderPasses() && c.isInFrustum && occlusionQueryAvailable[c.chunkIndex] && EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
}else if(!c.skipAllRenderPasses() && c.isInFrustum && occlusionQueryAvailable[c.chunkIndex]) {
if(EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
c.isVisible = EaglerAdapter.glGetQueryResult(glOcclusionQuery[c.chunkIndex]);
occlusionQueryAvailable[c.chunkIndex] = false;
}else if(occlusionQueryStalled[c.chunkIndex]) {
c.isVisible = true;
}
occlusionQueryStalled[c.chunkIndex] = false;
}
}
}
@ -596,7 +603,11 @@ public class RenderGlobal implements IWorldAccess {
int ccy = c.chunkY - fy;
int ccz = c.chunkZ - fz;
if(!c.skipAllRenderPasses() && c.isInFrustum && !(ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2)) {
if(occlusionQueryAvailable[c.chunkIndex]) {
occlusionQueryStalled[c.chunkIndex] = true;
}else {
occlusionQueryAvailable[c.chunkIndex] = true;
}
int q = glOcclusionQuery[c.chunkIndex];
if(q == -1) {
q = glOcclusionQuery[c.chunkIndex] = EaglerAdapter.glCreateQuery();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long