Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: mojo/ui/gl_renderer.cc

Issue 1993073005: Mozart: Avoid blocking in glCheckFramebufferStatus(). (Closed) Base URL: git@github.com:domokit/mojo.git@moz-jank3
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/ui/gl_renderer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/ui/gl_renderer.h" 5 #include "mojo/ui/gl_renderer.h"
6 6
7 #ifndef GL_GLEXT_PROTOTYPES 7 #ifndef GL_GLEXT_PROTOTYPES
8 #define GL_GLEXT_PROTOTYPES 8 #define GL_GLEXT_PROTOTYPES
9 #endif 9 #endif
10 #include <GLES2/gl2.h> 10 #include <GLES2/gl2.h>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 GLuint depth_buffer = 0u; 96 GLuint depth_buffer = 0u;
97 if (with_depth) { 97 if (with_depth) {
98 glGenRenderbuffers(1, &depth_buffer); 98 glGenRenderbuffers(1, &depth_buffer);
99 glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer); 99 glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
100 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size.width, 100 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size.width,
101 size.height); 101 size.height);
102 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 102 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
103 GL_RENDERBUFFER, depth_buffer); 103 GL_RENDERBUFFER, depth_buffer);
104 } 104 }
105 105
106 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 106 #if DCHECK_IS_ON()
107 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 107 // This check causes a flush of the GL pipeline which is too expensive
108 // even in debug mode so only check it the first time as a sanity check.
109 if (!checked_framebuffer_status_) {
110 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
111 glCheckFramebufferStatus(GL_FRAMEBUFFER));
112 checked_framebuffer_status_ = true;
113 }
114 #endif
108 115
109 glViewport(0, 0, size.width, size.height); 116 glViewport(0, 0, size.width, size.height);
110 callback.Run(gl_scope, size); 117 callback.Run(gl_scope, size);
111 118
112 if (with_depth) 119 if (with_depth)
113 glDeleteRenderbuffers(1, &depth_buffer); 120 glDeleteRenderbuffers(1, &depth_buffer);
114 glDeleteFramebuffers(1, &fbo); 121 glDeleteFramebuffers(1, &fbo);
115 122
116 return BindTextureResource(gl_scope, std::move(texture)); 123 return BindTextureResource(gl_scope, std::move(texture));
117 } 124 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 170
164 void GLRenderer::GLTextureReleaser::Release(bool recyclable) { 171 void GLRenderer::GLTextureReleaser::Release(bool recyclable) {
165 if (provider_) { 172 if (provider_) {
166 provider_->ReleaseTexture(std::move(texture_info_), recyclable); 173 provider_->ReleaseTexture(std::move(texture_info_), recyclable);
167 provider_.reset(); 174 provider_.reset();
168 } 175 }
169 } 176 }
170 177
171 } // namespace ui 178 } // namespace ui
172 } // namespace mojo 179 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/ui/gl_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698