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

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

Issue 10031036: Revert 131177 - aura: Change shared context to be offscreen for arm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 virtual Error DoCommand(unsigned int command, 464 virtual Error DoCommand(unsigned int command,
465 unsigned int arg_count, 465 unsigned int arg_count,
466 const void* args); 466 const void* args);
467 467
468 // Overridden from AsyncAPIInterface. 468 // Overridden from AsyncAPIInterface.
469 virtual const char* GetCommandName(unsigned int command_id) const; 469 virtual const char* GetCommandName(unsigned int command_id) const;
470 470
471 // Overridden from GLES2Decoder. 471 // Overridden from GLES2Decoder.
472 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, 472 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
473 const scoped_refptr<gfx::GLContext>& context, 473 const scoped_refptr<gfx::GLContext>& context,
474 bool offscreen,
475 const gfx::Size& size, 474 const gfx::Size& size,
476 const DisallowedFeatures& disallowed_features, 475 const DisallowedFeatures& disallowed_features,
477 const char* allowed_extensions, 476 const char* allowed_extensions,
478 const std::vector<int32>& attribs); 477 const std::vector<int32>& attribs);
479 virtual void Destroy(); 478 virtual void Destroy();
480 virtual bool SetParent(GLES2Decoder* parent_decoder, 479 virtual bool SetParent(GLES2Decoder* parent_decoder,
481 uint32 parent_texture_id); 480 uint32 parent_texture_id);
482 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size); 481 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size);
483 void UpdateParentTextureInfo(); 482 void UpdateParentTextureInfo();
484 virtual bool MakeCurrent(); 483 virtual bool MakeCurrent();
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 bufferdata_faster_than_buffersubdata_ = false; 1906 bufferdata_faster_than_buffersubdata_ = false;
1908 } 1907 }
1909 } 1908 }
1910 1909
1911 GLES2DecoderImpl::~GLES2DecoderImpl() { 1910 GLES2DecoderImpl::~GLES2DecoderImpl() {
1912 } 1911 }
1913 1912
1914 bool GLES2DecoderImpl::Initialize( 1913 bool GLES2DecoderImpl::Initialize(
1915 const scoped_refptr<gfx::GLSurface>& surface, 1914 const scoped_refptr<gfx::GLSurface>& surface,
1916 const scoped_refptr<gfx::GLContext>& context, 1915 const scoped_refptr<gfx::GLContext>& context,
1917 bool offscreen,
1918 const gfx::Size& size, 1916 const gfx::Size& size,
1919 const DisallowedFeatures& disallowed_features, 1917 const DisallowedFeatures& disallowed_features,
1920 const char* allowed_extensions, 1918 const char* allowed_extensions,
1921 const std::vector<int32>& attribs) { 1919 const std::vector<int32>& attribs) {
1922 DCHECK(context); 1920 DCHECK(context);
1923 DCHECK(!context_.get()); 1921 DCHECK(!context_.get());
1924 1922
1925 if (CommandLine::ForCurrentProcess()->HasSwitch( 1923 if (CommandLine::ForCurrentProcess()->HasSwitch(
1926 switches::kEnableGPUDebugging)) { 1924 switches::kEnableGPUDebugging)) {
1927 set_debug(true); 1925 set_debug(true);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 // This checks if the user requested RGBA and we have RGBA then RGBA. If the 2024 // This checks if the user requested RGBA and we have RGBA then RGBA. If the
2027 // user requested RGB then RGB. If the user did not specify a preference than 2025 // user requested RGB then RGB. If the user did not specify a preference than
2028 // use whatever we were given. Same for DEPTH and STENCIL. 2026 // use whatever we were given. Same for DEPTH and STENCIL.
2029 back_buffer_color_format_ = 2027 back_buffer_color_format_ =
2030 (attrib_parser.alpha_size_ != 0 && v > 0) ? GL_RGBA : GL_RGB; 2028 (attrib_parser.alpha_size_ != 0 && v > 0) ? GL_RGBA : GL_RGB;
2031 glGetIntegerv(GL_DEPTH_BITS, &v); 2029 glGetIntegerv(GL_DEPTH_BITS, &v);
2032 back_buffer_has_depth_ = attrib_parser.depth_size_ != 0 && v > 0; 2030 back_buffer_has_depth_ = attrib_parser.depth_size_ != 0 && v > 0;
2033 glGetIntegerv(GL_STENCIL_BITS, &v); 2031 glGetIntegerv(GL_STENCIL_BITS, &v);
2034 back_buffer_has_stencil_ = attrib_parser.stencil_size_ != 0 && v > 0; 2032 back_buffer_has_stencil_ = attrib_parser.stencil_size_ != 0 && v > 0;
2035 2033
2036 if (offscreen) { 2034 if (surface_->IsOffscreen()) {
2037 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && 2035 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 &&
2038 (context_->HasExtension("GL_EXT_framebuffer_multisample") || 2036 (context_->HasExtension("GL_EXT_framebuffer_multisample") ||
2039 context_->HasExtension("GL_ANGLE_framebuffer_multisample"))) { 2037 context_->HasExtension("GL_ANGLE_framebuffer_multisample"))) {
2040 // Per ext_framebuffer_multisample spec, need max bound on sample count. 2038 // Per ext_framebuffer_multisample spec, need max bound on sample count.
2041 // max_sample_count must be initialized to a sane value. If 2039 // max_sample_count must be initialized to a sane value. If
2042 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. 2040 // glGetIntegerv() throws a GL error, it leaves its argument unchanged.
2043 GLint max_sample_count = 1; 2041 GLint max_sample_count = 1;
2044 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); 2042 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count);
2045 offscreen_target_samples_ = std::min(attrib_parser.samples_, 2043 offscreen_target_samples_ = std::min(attrib_parser.samples_,
2046 max_sample_count); 2044 max_sample_count);
(...skipping 5558 matching lines...) Expand 10 before | Expand all | Expand 10 after
7605 UpdateParentTextureInfo(); 7603 UpdateParentTextureInfo();
7606 } 7604 }
7607 7605
7608 ScopedGLErrorSuppressor suppressor(this); 7606 ScopedGLErrorSuppressor suppressor(this);
7609 7607
7610 if (IsOffscreenBufferMultisampled()) { 7608 if (IsOffscreenBufferMultisampled()) {
7611 // For multisampled buffers, resolve the frame buffer. 7609 // For multisampled buffers, resolve the frame buffer.
7612 ScopedResolvedFrameBufferBinder binder(this, true, false); 7610 ScopedResolvedFrameBufferBinder binder(this, true, false);
7613 return error::kNoError; 7611 return error::kNoError;
7614 } else { 7612 } else {
7615 ScopedFrameBufferBinder binder(this, 7613 if (surface_->IsOffscreen()) {
7616 offscreen_target_frame_buffer_->id()); 7614 ScopedFrameBufferBinder binder(this,
7615 offscreen_target_frame_buffer_->id());
7617 7616
7618 if (offscreen_target_buffer_preserved_) { 7617 if (offscreen_target_buffer_preserved_) {
7619 // Copy the target frame buffer to the saved offscreen texture. 7618 // Copy the target frame buffer to the saved offscreen texture.
7620 offscreen_saved_color_texture_->Copy( 7619 offscreen_saved_color_texture_->Copy(
7621 offscreen_saved_color_texture_->size(), 7620 offscreen_saved_color_texture_->size(),
7622 offscreen_saved_color_format_); 7621 offscreen_saved_color_format_);
7623 } else { 7622 } else {
7624 // Flip the textures in the parent context via the texture manager. 7623 // Flip the textures in the parent context via the texture manager.
7625 if (!!offscreen_saved_color_texture_info_.get()) 7624 if (!!offscreen_saved_color_texture_info_.get())
7626 offscreen_saved_color_texture_info_-> 7625 offscreen_saved_color_texture_info_->
7627 SetServiceId(offscreen_target_color_texture_->id()); 7626 SetServiceId(offscreen_target_color_texture_->id());
7628 7627
7629 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); 7628 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
7630 offscreen_target_frame_buffer_->AttachRenderTexture( 7629 offscreen_target_frame_buffer_->AttachRenderTexture(
7631 offscreen_target_color_texture_.get()); 7630 offscreen_target_color_texture_.get());
7631 }
7632
7633 // Ensure the side effects of the copy are visible to the parent
7634 // context. There is no need to do this for ANGLE because it uses a
7635 // single D3D device for all contexts.
7636 if (!IsAngle())
7637 glFlush();
7632 } 7638 }
7633
7634 // Ensure the side effects of the copy are visible to the parent
7635 // context. There is no need to do this for ANGLE because it uses a
7636 // single D3D device for all contexts.
7637 if (!IsAngle())
7638 glFlush();
7639 return error::kNoError; 7639 return error::kNoError;
7640 } 7640 }
7641 } else { 7641 } else {
7642 TRACE_EVENT1("gpu", "GLContext::SwapBuffers", "frame", this_frame_number); 7642 TRACE_EVENT1("gpu", "GLContext::SwapBuffers", "frame", this_frame_number);
7643 if (!surface_->SwapBuffers()) { 7643 if (!surface_->SwapBuffers()) {
7644 LOG(ERROR) << "Context lost because SwapBuffers failed."; 7644 LOG(ERROR) << "Context lost because SwapBuffers failed.";
7645 return error::kLostContext; 7645 return error::kLostContext;
7646 } 7646 }
7647 } 7647 }
7648 7648
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
8319 } 8319 }
8320 } 8320 }
8321 8321
8322 // Include the auto-generated part of this file. We split this because it means 8322 // Include the auto-generated part of this file. We split this because it means
8323 // we can easily edit the non-auto generated parts right here in this file 8323 // we can easily edit the non-auto generated parts right here in this file
8324 // instead of having to edit some template or the code generator. 8324 // instead of having to edit some template or the code generator.
8325 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 8325 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
8326 8326
8327 } // namespace gles2 8327 } // namespace gles2
8328 } // namespace gpu 8328 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698