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

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

Issue 2872010: Clear the copy of the offscreen texture used by shared contexts after the DEP... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder.cc (revision 50392)
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy)
@@ -1759,34 +1759,6 @@
if (offscreen_target_color_texture_->size() == pending_offscreen_size_)
return true;
- if (parent_) {
- // Create the saved offscreen color texture (only accessible to parent).
- offscreen_saved_color_texture_->AllocateStorage(pending_offscreen_size_);
-
- // Attach the saved offscreen color texture to a frame buffer so we can
- // clear it with glClear.
- offscreen_target_frame_buffer_->AttachRenderTexture(
- offscreen_saved_color_texture_.get());
- if (offscreen_target_frame_buffer_->CheckStatus() !=
- GL_FRAMEBUFFER_COMPLETE) {
- return false;
- }
-
- // TODO(apatrick): Fix this once ANGLE supports shared contexts.
- // Clear the saved offscreen color texture. Use default GL context
- // to ensure clear is not affected by client set state.
- if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
- ScopedDefaultGLContext scoped_context(this);
- glBindFramebufferEXT(GL_FRAMEBUFFER,
- offscreen_target_frame_buffer_->id());
- glClear(GL_COLOR_BUFFER_BIT);
- glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
-
- if (glGetError() != GL_NO_ERROR)
- return false;
- }
- }
-
// Reallocate the offscreen target buffers.
if (!offscreen_target_color_texture_->AllocateStorage(
pending_offscreen_size_)) {
@@ -1849,7 +1821,7 @@
}
if (parent_) {
- // Create the saved offscreen color texture (only accessible to parent).
+ // Adjust the saved offscreen color texture (only accessible to parent).
offscreen_saved_color_texture_->AllocateStorage(pending_offscreen_size_);
// Update the info about the offscreen saved color texture in the parent.
@@ -1874,6 +1846,33 @@
GL_UNSIGNED_BYTE);
}
+ // Attach the saved offscreen color texture to a frame buffer so we can
+ // clear it with glClear.
+ offscreen_target_frame_buffer_->AttachRenderTexture(
+ offscreen_saved_color_texture_.get());
+ if (offscreen_target_frame_buffer_->CheckStatus() !=
+ GL_FRAMEBUFFER_COMPLETE) {
+ return false;
+ }
+
+ // TODO(apatrick): Fix this once ANGLE supports shared contexts.
+ // Clear the saved offscreen color texture. Use default GL context
+ // to ensure clear is not affected by client set state.
+ if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
+ ScopedDefaultGLContext scoped_context(this);
+ glBindFramebufferEXT(GL_FRAMEBUFFER,
+ offscreen_target_frame_buffer_->id());
+ glClear(GL_COLOR_BUFFER_BIT);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+
+ if (glGetError() != GL_NO_ERROR)
+ return false;
+ }
+
+ // Re-attach the offscreen render texture to the target frame buffer.
+ offscreen_target_frame_buffer_->AttachRenderTexture(
+ offscreen_target_color_texture_.get());
+
return true;
}
« 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