change fence query
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package me.cortex.voxy.client.core.gl;
|
package me.cortex.voxy.client.core.gl;
|
||||||
|
|
||||||
import me.cortex.voxy.common.util.TrackedObject;
|
import me.cortex.voxy.common.util.TrackedObject;
|
||||||
|
import org.lwjgl.system.MemoryUtil;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL32.*;
|
import static org.lwjgl.opengl.GL32.*;
|
||||||
|
|
||||||
@@ -12,13 +13,24 @@ public class GlFence extends TrackedObject {
|
|||||||
this.fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
this.fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final long SCRATCH = MemoryUtil.nmemCalloc(1,4);
|
||||||
|
|
||||||
public boolean signaled() {
|
public boolean signaled() {
|
||||||
if (!this.signaled) {
|
if (!this.signaled) {
|
||||||
|
/*
|
||||||
int ret = glClientWaitSync(this.fence, 0, 0);
|
int ret = glClientWaitSync(this.fence, 0, 0);
|
||||||
if (ret == GL_ALREADY_SIGNALED || ret == GL_CONDITION_SATISFIED) {
|
if (ret == GL_ALREADY_SIGNALED || ret == GL_CONDITION_SATISFIED) {
|
||||||
this.signaled = true;
|
this.signaled = true;
|
||||||
} else if (ret != GL_TIMEOUT_EXPIRED) {
|
} else if (ret != GL_TIMEOUT_EXPIRED) {
|
||||||
throw new IllegalStateException("Poll for fence failed, glError: " + glGetError());
|
throw new IllegalStateException("Poll for fence failed, glError: " + glGetError());
|
||||||
|
}*/
|
||||||
|
MemoryUtil.memPutInt(SCRATCH, -1);
|
||||||
|
nglGetSynciv(this.fence, GL_SYNC_STATUS, 1, 0, SCRATCH);
|
||||||
|
int val = MemoryUtil.memGetInt(SCRATCH);
|
||||||
|
if (val == GL_SIGNALED) {
|
||||||
|
this.signaled = true;
|
||||||
|
} else if (val != GL_UNSIGNALED) {
|
||||||
|
throw new IllegalStateException("Unknown data from glGetSync: "+val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.signaled;
|
return this.signaled;
|
||||||
|
|||||||
Reference in New Issue
Block a user