5

Running Xcode's OpenGL ES diagnostic on a very simple app that switches to a second framebuffer and back (with appropriate use of glClear and glInvalidateFramebuffer) shows warnings about a logical buffer store on switching to the second framebuffer:

- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
    // At this point, GLKView's framebuffer is bound

    // Clear (to avoid logical buffer load)
    glClear(GL_COLOR_BUFFER_BIT);

    // Invalidate (to avoid logical buffer store)
    glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 });

    // Switch to our own framebuffer, and attach a texture as the color attachment
    // At this point, Xcode's OpenGL ES tool warns:
    //  "For best performance keep logical buffer store operations to a minimum."
    glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture, 0);

    // Clear (to avoid logical buffer load)
    glClear(GL_COLOR_BUFFER_BIT);

    // Invalidate (to avoid logical buffer store)
    glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 });

    // Might want to switch back to GLKView's drawable here, and do more rendering
}

Anyone have any ideas about why the invalidate's not taking hold? Note that in this example, the GLKView only has a color buffer attachment:

    view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;  
    view.drawableStencilFormat = GLKViewDrawableStencilFormatNone;  
    view.drawableDepthFormat = GLKViewDrawableDepthFormatNone;  
    view.drawableMultisample = GLKViewDrawableMultisampleNone; 

Test app demonstrating this at https://dl.dropboxusercontent.com/u/6956432/test.zip

Cheers!

Steve
  • 31,144
  • 19
  • 99
  • 122
Michael Tyson
  • 1,498
  • 1
  • 14
  • 23

0 Answers0