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

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

Issue 2015693002: gpu: Fix a bug in the new ReturnFrontBuffer() path for pepper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_manager.h » ('j') | 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 81a6c97c39cdbafb0131ff997c4559199d587a66..f0c79bd1534246f3e798ce2991acb761f68661f8 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2048,9 +2048,12 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
GLsizei offscreen_target_samples_;
GLboolean offscreen_target_buffer_preserved_;
- // The copy that is saved when SwapBuffers is called.
- std::unique_ptr<BackFramebuffer> offscreen_saved_frame_buffer_;
+ // The saved copy of the backbuffer after a call to SwapBuffers.
std::unique_ptr<BackTexture> offscreen_saved_color_texture_;
+
+ // For simplicity, |offscreen_saved_color_texture_| is always bound to
+ // |offscreen_saved_frame_buffer_|.
+ std::unique_ptr<BackFramebuffer> offscreen_saved_frame_buffer_;
scoped_refptr<TextureRef>
offscreen_saved_color_texture_info_;
@@ -4222,7 +4225,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) {
state_.indexed_uniform_buffer_bindings = nullptr;
if (offscreen_saved_color_texture_info_.get()) {
- DCHECK(offscreen_target_color_texture_);
+ DCHECK(offscreen_saved_color_texture_);
DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(),
offscreen_saved_color_texture_->id());
offscreen_saved_color_texture_->Invalidate();
@@ -4404,7 +4407,9 @@ void GLES2DecoderImpl::TakeFrontBuffer(const Mailbox& mailbox) {
mailbox_manager()->ProduceTexture(
mailbox, offscreen_saved_color_texture_info_->texture());
- // Save the BackTexture and TextureRef.
+ // Save the BackTexture and TextureRef. There's no need to update
+ // |offscreen_saved_frame_buffer_| since CreateBackTexture() will take care of
+ // that.
SavedBackTexture save;
save.back_texture.swap(offscreen_saved_color_texture_);
save.texture_ref = offscreen_saved_color_texture_info_;
@@ -4445,6 +4450,8 @@ void GLES2DecoderImpl::CreateBackTexture() {
continue;
offscreen_saved_color_texture_ = std::move(it->back_texture);
offscreen_saved_color_texture_info_ = it->texture_ref;
+ offscreen_saved_frame_buffer_->AttachRenderTexture(
+ offscreen_saved_color_texture_.get());
saved_back_textures_.erase(it);
return;
}
@@ -13238,6 +13245,8 @@ void GLES2DecoderImpl::DoSwapBuffers() {
offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
offscreen_target_frame_buffer_->AttachRenderTexture(
offscreen_target_color_texture_.get());
+ offscreen_saved_frame_buffer_->AttachRenderTexture(
+ offscreen_saved_color_texture_.get());
}
// Ensure the side effects of the copy are visible to the parent
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698