From cc0af441f2fe3a731a5338d6fc2c585f4bc017f4 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 15 Sep 2009 22:15:03 +0100 Subject: [PATCH] [cogl-fbo] Remove poorly documented workaround for unknown driver/hardware The comment just said: "Some implementation require a clear before drawing to an fbo. Luckily it is affected by scissor test." and did a scissored clear, which is clearly a driver bug workaround, but for what driver? The fact that it was copied into the gles backend (or vica versa is also suspicious since it seems unlikely that the workaround is necessary for both backends.) We can easily restore the workaround with a better comment if this problem really still exists on current drivers, but for now I'd rather minimize hand-wavey workaround code that can't be tested. --- cogl/driver/gl/cogl-fbo.c | 10 ---------- cogl/driver/gles/cogl-fbo.c | 19 ------------------- 2 files changed, 29 deletions(-) diff --git a/cogl/driver/gl/cogl-fbo.c b/cogl/driver/gl/cogl-fbo.c index 1bd88aeea..99315e6b0 100644 --- a/cogl/driver/gl/cogl-fbo.c +++ b/cogl/driver/gl/cogl-fbo.c @@ -225,16 +225,6 @@ cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) /* Bind offscreen framebuffer object */ GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, fbo->gl_handle) ); GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); - - /* Some implementation require a clear before drawing - to an fbo. Luckily it is affected by scissor test. */ - /* FIXME: test where exactly this is needed end whether - a glClear with 0 argument is enough */ - GE( glPushAttrib (GL_SCISSOR_BIT) ); - GE( glScissor (0,0,0,0) ); - GE( glEnable (GL_SCISSOR_TEST) ); - GE( glClear (GL_COLOR_BUFFER_BIT) ); - GE( glPopAttrib () ); } else if (target & COGL_WINDOW_BUFFER) { diff --git a/cogl/driver/gles/cogl-fbo.c b/cogl/driver/gles/cogl-fbo.c index 0b1006970..34f6a5946 100644 --- a/cogl/driver/gles/cogl-fbo.c +++ b/cogl/driver/gles/cogl-fbo.c @@ -157,9 +157,6 @@ cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) if (target == COGL_OFFSCREEN_BUFFER) { - GLboolean scissor_enabled; - GLint scissor_box[4]; - /* Make sure it is a valid fbo handle */ if (!cogl_is_offscreen (offscreen)) return; @@ -197,22 +194,6 @@ cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen) /* Bind offscreen framebuffer object */ GE( glBindFramebuffer (GL_FRAMEBUFFER, fbo->gl_handle) ); GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) ); - - /* Some implementation require a clear before drawing - to an fbo. Luckily it is affected by scissor test. */ - /* FIXME: test where exactly this is needed end whether - a glClear with 0 argument is enough */ - - scissor_enabled = glIsEnabled (GL_SCISSOR_TEST); - GE( glGetIntegerv (GL_SCISSOR_BOX, scissor_box) ); - GE( glScissor (0, 0, 0, 0) ); - GE( glEnable (GL_SCISSOR_TEST) ); - GE( glClear (GL_COLOR_BUFFER_BIT) ); - if (!scissor_enabled) - glDisable (GL_SCISSOR_TEST); - glScissor (scissor_box[0], scissor_box[1], - scissor_box[2], scissor_box[3]); - } else if (target & COGL_WINDOW_BUFFER) {