// This requires the isFBO parameter because GL ES 3.0's glInvalidateFramebuffer() uses // different attachment values for FBO vs default framebuffer, unlike glDiscardFramebufferEXT() void GL_InvalidateFramebuffer( const invalidateTarget_t isFBO, const bool colorBuffer, const bool depthBuffer ) { const int offset = (int)!colorBuffer; const int count = (int)colorBuffer + ((int)depthBuffer)*2; const GLenum fboAttachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT }; const GLenum attachments[3] = { GL_COLOR_EXT, GL_DEPTH_EXT, GL_STENCIL_EXT }; glInvalidateFramebuffer_( GL_FRAMEBUFFER, count, ( isFBO == INV_FBO ? fboAttachments : attachments ) + offset ); }
void DirectRender::EndDirectRendering() const { switch( tilerControl ) { case FB_TILED_RENDERING: { // This has an implicit flush if ( QCOM_tiled_rendering ) { glEndTilingQCOM_( GL_COLOR_BUFFER_BIT0_QCOM ); } break; } case FB_BINNING_CONTROL: { glHint( GL_BINNING_CONTROL_HINT_QCOM, GL_DONT_CARE ); // Flush explicitly glFlush(); // GL_Flush() with KHR_sync seems to be synchronous break; } case FB_WRITEONLY_RENDERING: { glDisable( GL_WRITEONLY_RENDERING_QCOM ); // Flush explicitly glFlush(); // GL_Flush() with KHR_sync seems to be synchronous break; } case FB_MALI: { const GLenum attachments[2] = { GL_DEPTH, GL_STENCIL }; glInvalidateFramebuffer_( GL_FRAMEBUFFER, 2, attachments ); // Flush explicitly glFlush(); // GL_Flush() with KHR_sync seems to be synchronous break; } default: { glFlush(); // GL_Flush() with KHR_sync seems to be synchronous break; } } }
void DirectRender::BeginDirectRendering( int x, int y, int width, int height ) { switch( tilerControl ) { case FB_TILED_RENDERING: { if ( QCOM_tiled_rendering ) { glStartTilingQCOM_( x, y, width, height, 0 ); } glScissor( x, y, width, height ); break; } case FB_BINNING_CONTROL: { glHint( GL_BINNING_CONTROL_HINT_QCOM, GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM ); glScissor( x, y, width, height ); break; } case FB_WRITEONLY_RENDERING: { glEnable( GL_WRITEONLY_RENDERING_QCOM ); glScissor( x, y, width, height ); break; } case FB_MALI: { const GLenum attachments[3] = { GL_COLOR, GL_DEPTH, GL_STENCIL }; glInvalidateFramebuffer_( GL_FRAMEBUFFER, 3, attachments ); glScissor( x, y, width, height ); // This clear is not absolutely necessarily but ARM prefers an explicit glClear call to avoid ambiguity. //glClearColor( 0, 0, 0, 1 ); //glClear( GL_COLOR_BUFFER_BIT ); break; } default: { glScissor( x, y, width, height ); break; } } }