mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 05:12:16 +00:00
Fix Iris issues with instancing and batching (#2158)
This commit is contained in:
1 parent
7bb5bfd45c
commit
af599f292e
103 files changed
+4691
-535
No files matched your search
@@ -10,6 +10,12 @@ import org.lwjgl.opengl.GL43;
|
||||
|
||||
public final class Program extends GlResource {
|
||||
|
||||
private static int managedBindProgram;
|
||||
|
||||
public static boolean isManagedBind(int program) {
|
||||
return program != 0 && managedBindProgram == program;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final ProgramUniforms uniforms;
|
||||
|
||||
@@ -31,13 +37,23 @@ public final class Program extends GlResource {
|
||||
|
||||
public void use() {
|
||||
RenderSystem.memoryBarrier(GL42.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL42.GL_TEXTURE_FETCH_BARRIER_BIT | GL43.GL_SHADER_STORAGE_BARRIER_BIT);
|
||||
GLStateManager.glUseProgram(getGlId());
|
||||
bindManaged(getGlId());
|
||||
|
||||
uniforms.update();
|
||||
samplers.update();
|
||||
images.update();
|
||||
}
|
||||
|
||||
static void bindManaged(int program) {
|
||||
final int previousManagedBind = managedBindProgram;
|
||||
managedBindProgram = program;
|
||||
try {
|
||||
GLStateManager.glUseProgram(program);
|
||||
} finally {
|
||||
managedBindProgram = previousManagedBind;
|
||||
}
|
||||
}
|
||||
|
||||
public static void unbind() {
|
||||
ProgramUniforms.clearActiveUniforms();
|
||||
ProgramSamplers.clearActiveSamplers();
|
||||
|
||||
Reference in new issue
Block a user