mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 12:52:19 +00:00
Add some more guards around GL capabilities
This commit is contained in:
1 parent
bfd6c25a03
commit
7ae4e14a3e
2 files changed
+26
-14
No files matched your search
@@ -3,6 +3,7 @@ package me.jellysquid.mods.sodium.client.gl.state;
|
||||
import me.jellysquid.mods.sodium.client.gl.array.GlVertexArray;
|
||||
import me.jellysquid.mods.sodium.client.gl.buffer.GlBuffer;
|
||||
import me.jellysquid.mods.sodium.client.gl.buffer.GlBufferTarget;
|
||||
import me.jellysquid.mods.sodium.client.gl.func.GlFunctions;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
@@ -49,8 +50,9 @@ public class GlStateTracker {
|
||||
for (int i = 0; i < GlBufferTarget.COUNT; i++) {
|
||||
GL15.glBindBuffer(GlBufferTarget.VALUES[i].getTargetParameter(), 0);
|
||||
}
|
||||
|
||||
GL30.glBindVertexArray(0);
|
||||
if(GlFunctions.isVertexArraySupported()) {
|
||||
GL30.glBindVertexArray(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearRestoreState() {
|
||||
|
||||
@@ -32,18 +32,24 @@ public class IrisRenderSystem {
|
||||
private static boolean supportsCompute;
|
||||
|
||||
public static void initRenderer() {
|
||||
if (Iris.capabilities.OpenGL45) {
|
||||
dsaState = new DSACore();
|
||||
Iris.logger.info("OpenGL 4.5 detected, enabling DSA.");
|
||||
} else if (Iris.capabilities.GL_ARB_direct_state_access) {
|
||||
dsaState = new DSAARB();
|
||||
Iris.logger.info("ARB_direct_state_access detected, enabling DSA.");
|
||||
} else {
|
||||
dsaState = new DSAUnsupported();
|
||||
Iris.logger.info("DSA support not detected.");
|
||||
}
|
||||
try {
|
||||
if (Iris.capabilities.OpenGL45) {
|
||||
dsaState = new DSACore();
|
||||
Iris.logger.info("OpenGL 4.5 detected, enabling DSA.");
|
||||
}
|
||||
hasMultibind = Iris.capabilities.OpenGL45;
|
||||
|
||||
hasMultibind = Iris.capabilities.OpenGL45 || Iris.capabilities.GL_ARB_multi_bind;
|
||||
} catch (Exception ignored) {}
|
||||
try {
|
||||
if (dsaState == null && Iris.capabilities.GL_ARB_direct_state_access) {
|
||||
dsaState = new DSAARB();
|
||||
Iris.logger.info("ARB_direct_state_access detected, enabling DSA.");
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
try {
|
||||
hasMultibind |= Iris.capabilities.GL_ARB_multi_bind;
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
supportsCompute = supportsCompute();
|
||||
}
|
||||
@@ -487,6 +493,10 @@ public class IrisRenderSystem {
|
||||
|
||||
// TODO: Proper notification of compute support
|
||||
public static boolean supportsCompute() {
|
||||
return Iris.capabilities.GL_ARB_compute_shader;
|
||||
try {
|
||||
return Iris.capabilities.GL_ARB_compute_shader;
|
||||
} catch(Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user