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 79f2c0493f0de5a4c09bbe2ec0ddc71bf41400db..adf0519ff20625930df637e3a224e00c117f0045 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -472,6 +472,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, |
// Overridden from GLES2Decoder. |
virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
const scoped_refptr<gfx::GLContext>& context, |
+ bool offscreen, |
const gfx::Size& size, |
const DisallowedFeatures& disallowed_features, |
const char* allowed_extensions, |
@@ -1947,6 +1948,7 @@ GLES2DecoderImpl::~GLES2DecoderImpl() { |
bool GLES2DecoderImpl::Initialize( |
const scoped_refptr<gfx::GLSurface>& surface, |
const scoped_refptr<gfx::GLContext>& context, |
+ bool offscreen, |
const gfx::Size& size, |
const DisallowedFeatures& disallowed_features, |
const char* allowed_extensions, |
@@ -2069,7 +2071,7 @@ bool GLES2DecoderImpl::Initialize( |
glGetIntegerv(GL_STENCIL_BITS, &v); |
back_buffer_has_stencil_ = attrib_parser.stencil_size_ != 0 && v > 0; |
- if (surface_->IsOffscreen()) { |
+ if (offscreen) { |
if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && |
(context_->HasExtension("GL_EXT_framebuffer_multisample") || |
context_->HasExtension("GL_ANGLE_framebuffer_multisample"))) { |
@@ -7710,32 +7712,30 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers( |
ScopedResolvedFrameBufferBinder binder(this, true, false); |
return error::kNoError; |
} else { |
- if (surface_->IsOffscreen()) { |
- ScopedFrameBufferBinder binder(this, |
- offscreen_target_frame_buffer_->id()); |
- |
- if (offscreen_target_buffer_preserved_) { |
- // Copy the target frame buffer to the saved offscreen texture. |
- offscreen_saved_color_texture_->Copy( |
- offscreen_saved_color_texture_->size(), |
- offscreen_saved_color_format_); |
- } else { |
- // Flip the textures in the parent context via the texture manager. |
- if (!!offscreen_saved_color_texture_info_.get()) |
- offscreen_saved_color_texture_info_-> |
- SetServiceId(offscreen_target_color_texture_->id()); |
- |
- offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); |
- offscreen_target_frame_buffer_->AttachRenderTexture( |
- offscreen_target_color_texture_.get()); |
- } |
- |
- // Ensure the side effects of the copy are visible to the parent |
- // context. There is no need to do this for ANGLE because it uses a |
- // single D3D device for all contexts. |
- if (!IsAngle()) |
- glFlush(); |
+ ScopedFrameBufferBinder binder(this, |
+ offscreen_target_frame_buffer_->id()); |
+ |
+ if (offscreen_target_buffer_preserved_) { |
+ // Copy the target frame buffer to the saved offscreen texture. |
+ offscreen_saved_color_texture_->Copy( |
+ offscreen_saved_color_texture_->size(), |
+ offscreen_saved_color_format_); |
+ } else { |
+ // Flip the textures in the parent context via the texture manager. |
+ if (!!offscreen_saved_color_texture_info_.get()) |
+ offscreen_saved_color_texture_info_-> |
+ SetServiceId(offscreen_target_color_texture_->id()); |
+ |
+ offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); |
+ offscreen_target_frame_buffer_->AttachRenderTexture( |
+ offscreen_target_color_texture_.get()); |
} |
+ |
+ // Ensure the side effects of the copy are visible to the parent |
+ // context. There is no need to do this for ANGLE because it uses a |
+ // single D3D device for all contexts. |
+ if (!IsAngle()) |
+ glFlush(); |
return error::kNoError; |
} |
} else { |