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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 7795015: Delay resize of the front buffer until the swap for offscreen buffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 1b96d2befa39865268bfef3127fb2e50cc2d2169..923cfae5f351823f358d3b6832ae914e7614a532 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2534,49 +2534,6 @@ bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
RestoreClearState();
}
-
- // Workaround for NVIDIA driver bug on OS X; crbug.com/89557,
- // crbug.com/94103. TODO(kbr): figure out reproduction so Apple will
- // fix this.
- if (needs_mac_nvidia_driver_workaround_) {
- offscreen_saved_frame_buffer_->Create();
- glFinish();
- }
-
- // Allocate the offscreen saved color texture.
- DCHECK(offscreen_saved_color_format_);
- offscreen_saved_color_texture_->AllocateStorage(
- offscreen_size_, offscreen_saved_color_format_);
-
- offscreen_saved_frame_buffer_->AttachRenderTexture(
- offscreen_saved_color_texture_.get());
- if (offscreen_saved_frame_buffer_->CheckStatus() !=
- GL_FRAMEBUFFER_COMPLETE) {
- LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
- << "because offscreen saved FBO was incomplete.";
- return false;
- }
-
- // Destroy the offscreen resolved framebuffers.
- if (offscreen_resolved_frame_buffer_.get())
- offscreen_resolved_frame_buffer_->Destroy();
- if (offscreen_resolved_color_texture_.get())
- offscreen_resolved_color_texture_->Destroy();
- offscreen_resolved_color_texture_.reset();
- offscreen_resolved_frame_buffer_.reset();
-
- // Clear the offscreen color texture.
- {
- ScopedFrameBufferBinder binder(this, offscreen_saved_frame_buffer_->id());
- glClearColor(0, 0, 0, 0);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glDisable(GL_SCISSOR_TEST);
- glClear(GL_COLOR_BUFFER_BIT);
- RestoreClearState();
- }
-
- UpdateParentTextureInfo();
-
return true;
}
@@ -6582,6 +6539,52 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
// If offscreen then don't actually SwapBuffers to the display. Just copy
// the rendered frame to another frame buffer.
if (is_offscreen) {
+ if (offscreen_size_ != offscreen_saved_color_texture_->size()) {
+ // Workaround for NVIDIA driver bug on OS X; crbug.com/89557,
+ // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will
+ // fix this.
+ if (needs_mac_nvidia_driver_workaround_) {
+ offscreen_saved_frame_buffer_->Create();
+ glFinish();
+ }
+
+ // Allocate the offscreen saved color texture.
+ DCHECK(offscreen_saved_color_format_);
+ offscreen_saved_color_texture_->AllocateStorage(
+ offscreen_size_, offscreen_saved_color_format_);
+
+ offscreen_saved_frame_buffer_->AttachRenderTexture(
+ offscreen_saved_color_texture_.get());
+ if (offscreen_saved_frame_buffer_->CheckStatus() !=
+ GL_FRAMEBUFFER_COMPLETE) {
+ LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
+ << "because offscreen saved FBO was incomplete.";
+ return error::kLostContext;
+ }
+
+ // Destroy the offscreen resolved framebuffers.
+ if (offscreen_resolved_frame_buffer_.get())
+ offscreen_resolved_frame_buffer_->Destroy();
+ if (offscreen_resolved_color_texture_.get())
+ offscreen_resolved_color_texture_->Destroy();
+ offscreen_resolved_color_texture_.reset();
+ offscreen_resolved_frame_buffer_.reset();
+
+ // Clear the offscreen color texture.
+ // TODO(piman): Is this still necessary?
Ken Russell (switch to Gerrit) 2011/08/30 22:47:13 I'm quite sure it is -- if the offscreen color tex
+ {
+ ScopedFrameBufferBinder binder(this,
+ offscreen_saved_frame_buffer_->id());
+ glClearColor(0, 0, 0, 0);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glDisable(GL_SCISSOR_TEST);
+ glClear(GL_COLOR_BUFFER_BIT);
+ RestoreClearState();
+ }
+
+ UpdateParentTextureInfo();
+ }
+
ScopedGLErrorSuppressor suppressor(this);
if (IsOffscreenBufferMultisampled()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698