From 7b612b0f2f7abd8e51e3ee6bf7d19e0d2d84ea77 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 15 Jun 2016 11:02:17 -0700 Subject: [PATCH] iOS: Discard the depth and stencil attachments of the framebuffer before presenting the color renderbuffer. (#2737) --- flow/instrumentation.cc | 2 +- ui/gl/gl_surface_ios.mm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/flow/instrumentation.cc b/flow/instrumentation.cc index 9cfacdd6d1..bdabde74de 100644 --- a/flow/instrumentation.cc +++ b/flow/instrumentation.cc @@ -71,7 +71,7 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { const SkScalar bottom = y + height; const SkScalar right = x + width; - // Scale the graph to show frame times up to those that are 4 times the frame time. + // Scale the graph to show frame times up to those that are 3 times the frame time. const double max_interval = kOneFrameMS * 3.0; const double max_unit_interval = UnitFrameInterval(max_interval); diff --git a/ui/gl/gl_surface_ios.mm b/ui/gl/gl_surface_ios.mm index a4354f8fcc..c4ca982c9c 100644 --- a/ui/gl/gl_surface_ios.mm +++ b/ui/gl/gl_surface_ios.mm @@ -216,6 +216,14 @@ void GLSurfaceIOS::SetupFramebufferIfNecessary() { } bool GLSurfaceIOS::SwapBuffers() { + const GLenum discards[] = { + GL_DEPTH_ATTACHMENT, + GL_STENCIL_ATTACHMENT, + }; + + glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof(discards) / sizeof(GLenum), + discards); + glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); return [[EAGLContext currentContext] presentRenderbuffer:GL_RENDERBUFFER]; } -- GitLab