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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 7841047: Destroy resolved framebuffers on resize, not swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 2518 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
2519 glClearStencil(0); 2519 glClearStencil(0);
2520 glStencilMaskSeparate(GL_FRONT, -1); 2520 glStencilMaskSeparate(GL_FRONT, -1);
2521 glStencilMaskSeparate(GL_BACK, -1); 2521 glStencilMaskSeparate(GL_BACK, -1);
2522 glClearDepth(0); 2522 glClearDepth(0);
2523 glDepthMask(GL_TRUE); 2523 glDepthMask(GL_TRUE);
2524 glDisable(GL_SCISSOR_TEST); 2524 glDisable(GL_SCISSOR_TEST);
2525 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 2525 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
2526 RestoreClearState(); 2526 RestoreClearState();
2527 } 2527 }
2528
2529 // Destroy the offscreen resolved framebuffers.
2530 if (offscreen_resolved_frame_buffer_.get())
2531 offscreen_resolved_frame_buffer_->Destroy();
2532 if (offscreen_resolved_color_texture_.get())
2533 offscreen_resolved_color_texture_->Destroy();
2534 offscreen_resolved_color_texture_.reset();
2535 offscreen_resolved_frame_buffer_.reset();
2536
2528 return true; 2537 return true;
2529 } 2538 }
2530 2539
2531 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( 2540 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(
2532 uint32 immediate_data_size, const gles2::ResizeCHROMIUM& c) { 2541 uint32 immediate_data_size, const gles2::ResizeCHROMIUM& c) {
2533 GLuint width = static_cast<GLuint>(c.width); 2542 GLuint width = static_cast<GLuint>(c.width);
2534 GLuint height = static_cast<GLuint>(c.height); 2543 GLuint height = static_cast<GLuint>(c.height);
2535 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); 2544 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height);
2536 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(TOUCH_UI) 2545 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(TOUCH_UI)
2537 // Make sure that we are done drawing to the back buffer before resizing. 2546 // Make sure that we are done drawing to the back buffer before resizing.
(...skipping 4000 matching lines...) Expand 10 before | Expand all | Expand 10 after
6538 6547
6539 offscreen_saved_frame_buffer_->AttachRenderTexture( 6548 offscreen_saved_frame_buffer_->AttachRenderTexture(
6540 offscreen_saved_color_texture_.get()); 6549 offscreen_saved_color_texture_.get());
6541 if (offscreen_saved_frame_buffer_->CheckStatus() != 6550 if (offscreen_saved_frame_buffer_->CheckStatus() !=
6542 GL_FRAMEBUFFER_COMPLETE) { 6551 GL_FRAMEBUFFER_COMPLETE) {
6543 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " 6552 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
6544 << "because offscreen saved FBO was incomplete."; 6553 << "because offscreen saved FBO was incomplete.";
6545 return error::kLostContext; 6554 return error::kLostContext;
6546 } 6555 }
6547 6556
6548 // Destroy the offscreen resolved framebuffers.
6549 if (offscreen_resolved_frame_buffer_.get())
6550 offscreen_resolved_frame_buffer_->Destroy();
6551 if (offscreen_resolved_color_texture_.get())
6552 offscreen_resolved_color_texture_->Destroy();
6553 offscreen_resolved_color_texture_.reset();
6554 offscreen_resolved_frame_buffer_.reset();
6555
6556 // Clear the offscreen color texture. 6557 // Clear the offscreen color texture.
6557 // TODO(piman): Is this still necessary? 6558 // TODO(piman): Is this still necessary?
6558 { 6559 {
6559 ScopedFrameBufferBinder binder(this, 6560 ScopedFrameBufferBinder binder(this,
6560 offscreen_saved_frame_buffer_->id()); 6561 offscreen_saved_frame_buffer_->id());
6561 glClearColor(0, 0, 0, 0); 6562 glClearColor(0, 0, 0, 0);
6562 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 6563 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
6563 glDisable(GL_SCISSOR_TEST); 6564 glDisable(GL_SCISSOR_TEST);
6564 glClear(GL_COLOR_BUFFER_BIT); 6565 glClear(GL_COLOR_BUFFER_BIT);
6565 RestoreClearState(); 6566 RestoreClearState();
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
6828 return false; 6829 return false;
6829 } 6830 }
6830 6831
6831 // Include the auto-generated part of this file. We split this because it means 6832 // Include the auto-generated part of this file. We split this because it means
6832 // we can easily edit the non-auto generated parts right here in this file 6833 // we can easily edit the non-auto generated parts right here in this file
6833 // instead of having to edit some template or the code generator. 6834 // instead of having to edit some template or the code generator.
6834 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 6835 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
6835 6836
6836 } // namespace gles2 6837 } // namespace gles2
6837 } // namespace gpu 6838 } // namespace gpu
OLDNEW
« 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