gpu: fix debug mode on macos
debug mode aggressively checks and throws whenever a gl error occurs. The glBlitFramebuffer call is bizzare because with the alpha channel enabled on the renderbuffer it appears to work correctly despite causing an INVALID_OPERATION error. We have no use for the alpha channel since the dst alpha value is always 1, so it can just be disabled on macos.
This commit is contained in:
@@ -432,7 +432,14 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
log.debug("Disabling DebugGL due to jogl-gldesktop-dbg not being present on the classpath");
|
||||
}
|
||||
|
||||
gl.glEnable(gl.GL_DEBUG_OUTPUT);
|
||||
try
|
||||
{
|
||||
gl.glEnable(gl.GL_DEBUG_OUTPUT);
|
||||
}
|
||||
catch (GLException ex)
|
||||
{
|
||||
// macos doesn't support GL_DEBUG_OUTPUT
|
||||
}
|
||||
|
||||
// GLDebugEvent[ id 0x20071
|
||||
// type Warning: generic
|
||||
@@ -689,9 +696,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
uniTextures = gl.glGetUniformLocation(glProgram, "textures");
|
||||
uniTextureAnimations = gl.glGetUniformLocation(glProgram, "textureAnimations");
|
||||
|
||||
uniBlockSmall = gl.glGetUniformBlockIndex(glSmallComputeProgram, "uniforms");
|
||||
uniBlockLarge = gl.glGetUniformBlockIndex(glComputeProgram, "uniforms");
|
||||
uniBlockMain = gl.glGetUniformBlockIndex(glProgram, "uniforms");
|
||||
if (computeMode == ComputeMode.OPENGL)
|
||||
{
|
||||
uniBlockSmall = gl.glGetUniformBlockIndex(glSmallComputeProgram, "uniforms");
|
||||
uniBlockLarge = gl.glGetUniformBlockIndex(glComputeProgram, "uniforms");
|
||||
uniBlockMain = gl.glGetUniformBlockIndex(glProgram, "uniforms");
|
||||
}
|
||||
}
|
||||
|
||||
private void shutdownProgram()
|
||||
@@ -855,7 +865,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
// Create color render buffer
|
||||
rboSceneHandle = glGenRenderbuffer(gl);
|
||||
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, rboSceneHandle);
|
||||
gl.glRenderbufferStorageMultisample(gl.GL_RENDERBUFFER, aaSamples, gl.GL_RGBA, width, height);
|
||||
gl.glRenderbufferStorageMultisample(gl.GL_RENDERBUFFER, aaSamples,
|
||||
// on macos glBlitFramebuffer errors with GL_INVALID_OPERATION if the alpha channel
|
||||
// is enabled on the rbo
|
||||
OSType.getOSType() == OSType.MacOS ? gl.GL_RGB : gl.GL_RGBA,
|
||||
width, height);
|
||||
gl.glFramebufferRenderbuffer(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_RENDERBUFFER, rboSceneHandle);
|
||||
|
||||
// Reset
|
||||
|
||||
Reference in New Issue
Block a user