From 1076b489abbe3ecb5b3db97fd4783d7e78e18358 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Thu, 26 Mar 2015 17:03:04 -0400 Subject: [PATCH] GLRenderer: remove check FB error calls as it causes GPU stall --- .../com/jme3/renderer/opengl/GLRenderer.java | 77 +++++-------------- 1 file changed, 21 insertions(+), 56 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index 9d080384a..9ae1c8cc7 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -1321,13 +1321,6 @@ public class GLRenderer implements Renderer { glfbo.glBindFramebufferEXT(GLExt.GL_FRAMEBUFFER_EXT, prevFBO); - try { - checkFrameBufferError(); - } catch (IllegalStateException ex) { - logger.log(Level.SEVERE, "Source FBO:\n{0}", src); - logger.log(Level.SEVERE, "Dest FBO:\n{0}", dst); - throw ex; - } } else { throw new RendererException("Framebuffer blitting not supported by the video hardware"); } @@ -1488,6 +1481,8 @@ public class GLRenderer implements Renderer { updateFrameBufferAttachment(fb, colorBuf); } + checkFrameBufferError(); + fb.clearUpdateNeeded(); } @@ -1645,8 +1640,6 @@ public class GLRenderer implements Renderer { assert context.boundFBO == fb.getId(); context.boundFB = fb; - - checkFrameBufferError(); } } @@ -2221,53 +2214,25 @@ public class GLRenderer implements Renderer { int usage = convertUsage(vb.getUsage()); vb.getData().rewind(); -// if (created || vb.hasDataSizeChanged()) { - // upload data based on format - switch (vb.getFormat()) { - case Byte: - case UnsignedByte: - gl.glBufferData(target, (ByteBuffer) vb.getData(), usage); - break; - // case Half: - case Short: - case UnsignedShort: - gl.glBufferData(target, (ShortBuffer) vb.getData(), usage); - break; - case Int: - case UnsignedInt: - glext.glBufferData(target, (IntBuffer) vb.getData(), usage); - break; - case Float: - gl.glBufferData(target, (FloatBuffer) vb.getData(), usage); - break; - default: - throw new UnsupportedOperationException("Unknown buffer format."); - } -// } else { -// // Invalidate buffer data (orphan) before uploading new data. -// switch (vb.getFormat()) { -// case Byte: -// case UnsignedByte: -// gl.glBufferSubData(target, 0, (ByteBuffer) vb.getData()); -// break; -// case Short: -// case UnsignedShort: -// gl.glBufferSubData(target, 0, (ShortBuffer) vb.getData()); -// break; -// case Int: -// case UnsignedInt: -// gl.glBufferSubData(target, 0, (IntBuffer) vb.getData()); -// break; -// case Float: -// gl.glBufferSubData(target, 0, (FloatBuffer) vb.getData()); -// break; -// case Double: -// gl.glBufferSubData(target, 0, (DoubleBuffer) vb.getData()); -// break; -// default: -// throw new UnsupportedOperationException("Unknown buffer format."); -// } -// } + switch (vb.getFormat()) { + case Byte: + case UnsignedByte: + gl.glBufferData(target, (ByteBuffer) vb.getData(), usage); + break; + case Short: + case UnsignedShort: + gl.glBufferData(target, (ShortBuffer) vb.getData(), usage); + break; + case Int: + case UnsignedInt: + glext.glBufferData(target, (IntBuffer) vb.getData(), usage); + break; + case Float: + gl.glBufferData(target, (FloatBuffer) vb.getData(), usage); + break; + default: + throw new UnsupportedOperationException("Unknown buffer format."); + } vb.clearUpdateNeeded(); }