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

Unified Diff: content/common/gpu/image_transport_surface_fbo_mac.mm

Issue 797533002: Add a glBegin/End pair to make glBindFramebuffer work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/image_transport_surface_fbo_mac.mm
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.mm b/content/common/gpu/image_transport_surface_fbo_mac.mm
index 6af794d552ee1360c5dfaee96b8bf2f473ab0555..e081633de6879a808f53295024a1328cac7a184c 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.mm
+++ b/content/common/gpu/image_transport_surface_fbo_mac.mm
@@ -81,6 +81,42 @@ bool ImageTransportSurfaceFBO::OnMakeCurrent(gfx::GLContext* context) {
return true;
}
+void ImageTransportSurfaceFBO::NotifyWasBound() {
+ // Sometimes calling glBindFramebuffer doesn't seem to be enough to get
+ // rendered contents to show up in the color attachment. It appears that doing
+ // a glBegin/End pair with program 0 is enough to tickle the driver into
+ // actually effecting the binding.
+ // http://crbug.com/435786
+ DCHECK(has_complete_framebuffer_);
+
+ // We will restore the current program after the dummy glBegin/End pair.
+ // Ensure that we will be able to restore this state before attempting to
+ // change it.
+ GLint old_program_signed = 0;
+ glGetIntegerv(GL_CURRENT_PROGRAM, &old_program_signed);
+ GLuint old_program = static_cast<GLuint>(old_program_signed);
+ if (old_program && glIsProgram(old_program)) {
+ // A deleted program cannot be re-bound.
+ GLint delete_status = GL_FALSE;
+ glGetProgramiv(old_program, GL_DELETE_STATUS, &delete_status);
+ if (delete_status == GL_TRUE)
+ return;
+ // A program which has had the most recent link fail cannot be re-bound.
+ GLint link_status = GL_FALSE;
+ glGetProgramiv(old_program, GL_LINK_STATUS, &link_status);
+ if (link_status != GL_TRUE)
+ return;
+ }
+
+ // Issue the dummy call and then restore the state.
+ glUseProgram(0);
+ GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ DCHECK(status == GL_FRAMEBUFFER_COMPLETE);
+ glBegin(GL_TRIANGLES);
+ glEnd();
+ glUseProgram(old_program);
+}
+
unsigned int ImageTransportSurfaceFBO::GetBackingFrameBufferObject() {
return fbo_id_;
}
« no previous file with comments | « content/common/gpu/image_transport_surface_fbo_mac.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698