| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 #include "base/mac/scoped_cftyperef.h" | 22 #include "base/mac/scoped_cftyperef.h" |
| 23 #endif | 23 #endif |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/string_number_conversions.h" | 25 #include "base/string_number_conversions.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #define GLES2_GPU_SERVICE 1 | 27 #define GLES2_GPU_SERVICE 1 |
| 28 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 28 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 29 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 29 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 30 #include "gpu/command_buffer/common/debug_marker_manager.h" | 30 #include "gpu/command_buffer/common/debug_marker_manager.h" |
| 31 #include "gpu/command_buffer/common/id_allocator.h" | 31 #include "gpu/command_buffer/common/id_allocator.h" |
| 32 #include "gpu/command_buffer/common/mailbox.h" |
| 32 #include "gpu/command_buffer/service/buffer_manager.h" | 33 #include "gpu/command_buffer/service/buffer_manager.h" |
| 33 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 34 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 34 #include "gpu/command_buffer/service/context_group.h" | 35 #include "gpu/command_buffer/service/context_group.h" |
| 35 #include "gpu/command_buffer/service/context_state.h" | 36 #include "gpu/command_buffer/service/context_state.h" |
| 36 #include "gpu/command_buffer/service/error_state.h" | 37 #include "gpu/command_buffer/service/error_state.h" |
| 37 #include "gpu/command_buffer/service/feature_info.h" | 38 #include "gpu/command_buffer/service/feature_info.h" |
| 38 #include "gpu/command_buffer/service/framebuffer_manager.h" | 39 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 39 #include "gpu/command_buffer/service/gl_utils.h" | 40 #include "gpu/command_buffer/service/gl_utils.h" |
| 40 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 41 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 41 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 42 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 507 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
| 507 const scoped_refptr<gfx::GLContext>& context, | 508 const scoped_refptr<gfx::GLContext>& context, |
| 508 bool offscreen, | 509 bool offscreen, |
| 509 const gfx::Size& size, | 510 const gfx::Size& size, |
| 510 const DisallowedFeatures& disallowed_features, | 511 const DisallowedFeatures& disallowed_features, |
| 511 const char* allowed_extensions, | 512 const char* allowed_extensions, |
| 512 const std::vector<int32>& attribs) OVERRIDE; | 513 const std::vector<int32>& attribs) OVERRIDE; |
| 513 virtual void Destroy(bool have_context) OVERRIDE; | 514 virtual void Destroy(bool have_context) OVERRIDE; |
| 514 virtual void SetSurface( | 515 virtual void SetSurface( |
| 515 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; | 516 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; |
| 516 virtual bool SetParent(GLES2Decoder* parent_decoder, | 517 virtual bool ProduceFrontBuffer(const Mailbox& mailbox) OVERRIDE; |
| 517 uint32 parent_texture_id) OVERRIDE; | |
| 518 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; | 518 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; |
| 519 void UpdateParentTextureInfo(); | 519 void UpdateParentTextureInfo(); |
| 520 virtual bool MakeCurrent() OVERRIDE; | 520 virtual bool MakeCurrent() OVERRIDE; |
| 521 virtual void ReleaseCurrent() OVERRIDE; | 521 virtual void ReleaseCurrent() OVERRIDE; |
| 522 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } | 522 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } |
| 523 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } | 523 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } |
| 524 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } | 524 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } |
| 525 virtual void RestoreState() const OVERRIDE; | 525 virtual void RestoreState() const OVERRIDE; |
| 526 | 526 |
| 527 virtual void RestoreActiveTexture() const OVERRIDE { | 527 virtual void RestoreActiveTexture() const OVERRIDE { |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 | 1550 |
| 1551 // The ContextGroup for this decoder uses to track resources. | 1551 // The ContextGroup for this decoder uses to track resources. |
| 1552 scoped_refptr<ContextGroup> group_; | 1552 scoped_refptr<ContextGroup> group_; |
| 1553 | 1553 |
| 1554 DebugMarkerManager debug_marker_manager_; | 1554 DebugMarkerManager debug_marker_manager_; |
| 1555 Logger logger_; | 1555 Logger logger_; |
| 1556 | 1556 |
| 1557 // All the state for this context. | 1557 // All the state for this context. |
| 1558 ContextState state_; | 1558 ContextState state_; |
| 1559 | 1559 |
| 1560 // A parent decoder can access this decoders saved offscreen frame buffer. | |
| 1561 // The parent pointer is reset if the parent is destroyed. | |
| 1562 base::WeakPtr<GLES2DecoderImpl> parent_; | |
| 1563 | |
| 1564 // Current width and height of the offscreen frame buffer. | 1560 // Current width and height of the offscreen frame buffer. |
| 1565 gfx::Size offscreen_size_; | 1561 gfx::Size offscreen_size_; |
| 1566 | 1562 |
| 1567 // Util to help with GL. | 1563 // Util to help with GL. |
| 1568 GLES2Util util_; | 1564 GLES2Util util_; |
| 1569 | 1565 |
| 1570 // unpack flip y as last set by glPixelStorei | 1566 // unpack flip y as last set by glPixelStorei |
| 1571 bool unpack_flip_y_; | 1567 bool unpack_flip_y_; |
| 1572 | 1568 |
| 1573 // unpack (un)premultiply alpha as last set by glPixelStorei | 1569 // unpack (un)premultiply alpha as last set by glPixelStorei |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 bool compile_shader_always_succeeds_; | 1678 bool compile_shader_always_succeeds_; |
| 1683 | 1679 |
| 1684 // Log extra info. | 1680 // Log extra info. |
| 1685 bool service_logging_; | 1681 bool service_logging_; |
| 1686 | 1682 |
| 1687 #if defined(OS_MACOSX) | 1683 #if defined(OS_MACOSX) |
| 1688 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; | 1684 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; |
| 1689 TextureToIOSurfaceMap texture_to_io_surface_map_; | 1685 TextureToIOSurfaceMap texture_to_io_surface_map_; |
| 1690 #endif | 1686 #endif |
| 1691 | 1687 |
| 1692 typedef std::vector<GLES2DecoderImpl*> ChildList; | |
| 1693 ChildList children_; | |
| 1694 | |
| 1695 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 1688 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
| 1696 | 1689 |
| 1697 // Cached values of the currently assigned viewport dimensions. | 1690 // Cached values of the currently assigned viewport dimensions. |
| 1698 GLsizei viewport_max_width_; | 1691 GLsizei viewport_max_width_; |
| 1699 GLsizei viewport_max_height_; | 1692 GLsizei viewport_max_height_; |
| 1700 | 1693 |
| 1701 // Command buffer stats. | 1694 // Command buffer stats. |
| 1702 int texture_upload_count_; | 1695 int texture_upload_count_; |
| 1703 base::TimeDelta total_texture_upload_time_; | 1696 base::TimeDelta total_texture_upload_time_; |
| 1704 base::TimeDelta total_processing_commands_time_; | 1697 base::TimeDelta total_processing_commands_time_; |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 if (framebuffer != NULL) { | 2966 if (framebuffer != NULL) { |
| 2974 return framebuffer->GetColorAttachmentFormat(); | 2967 return framebuffer->GetColorAttachmentFormat(); |
| 2975 } else if (offscreen_target_frame_buffer_.get()) { | 2968 } else if (offscreen_target_frame_buffer_.get()) { |
| 2976 return offscreen_target_color_format_; | 2969 return offscreen_target_color_format_; |
| 2977 } else { | 2970 } else { |
| 2978 return back_buffer_color_format_; | 2971 return back_buffer_color_format_; |
| 2979 } | 2972 } |
| 2980 } | 2973 } |
| 2981 | 2974 |
| 2982 void GLES2DecoderImpl::UpdateParentTextureInfo() { | 2975 void GLES2DecoderImpl::UpdateParentTextureInfo() { |
| 2983 if (parent_.get()) { | 2976 if (!offscreen_saved_color_texture_info_.get()) |
| 2984 // Update the info about the offscreen saved color texture in the parent. | 2977 return; |
| 2985 // The reference to the parent is a weak pointer and will become null if the | 2978 GLenum target = offscreen_saved_color_texture_info_->texture()->target(); |
| 2986 // parent is later destroyed. | 2979 glBindTexture(target, offscreen_saved_color_texture_info_->service_id()); |
| 2987 GLenum target = offscreen_saved_color_texture_info_->texture()->target(); | 2980 texture_manager()->SetLevelInfo( |
| 2988 TextureManager* parent_texture_manager = parent_->texture_manager(); | 2981 offscreen_saved_color_texture_info_.get(), |
| 2989 glBindTexture(target, offscreen_saved_color_texture_info_->service_id()); | 2982 GL_TEXTURE_2D, |
| 2990 parent_texture_manager->SetLevelInfo( | 2983 0, // level |
| 2991 offscreen_saved_color_texture_info_.get(), | 2984 GL_RGBA, |
| 2992 GL_TEXTURE_2D, | 2985 offscreen_size_.width(), |
| 2993 0, // level | 2986 offscreen_size_.height(), |
| 2994 GL_RGBA, | 2987 1, // depth |
| 2995 offscreen_size_.width(), | 2988 0, // border |
| 2996 offscreen_size_.height(), | 2989 GL_RGBA, |
| 2997 1, // depth | 2990 GL_UNSIGNED_BYTE, |
| 2998 0, // border | 2991 true); |
| 2999 GL_RGBA, | 2992 texture_manager()->SetParameter( |
| 3000 GL_UNSIGNED_BYTE, | 2993 "UpdateParentTextureInfo", |
| 3001 true); | 2994 GetErrorState(), |
| 3002 parent_texture_manager->SetParameter( | 2995 offscreen_saved_color_texture_info_.get(), |
| 3003 "UpdateParentTextureInfo", | 2996 GL_TEXTURE_MAG_FILTER, |
| 3004 GetErrorState(), | 2997 GL_NEAREST); |
| 3005 offscreen_saved_color_texture_info_.get(), | 2998 texture_manager()->SetParameter( |
| 3006 GL_TEXTURE_MAG_FILTER, | 2999 "UpdateParentTextureInfo", |
| 3007 GL_NEAREST); | 3000 GetErrorState(), |
| 3008 parent_texture_manager->SetParameter( | 3001 offscreen_saved_color_texture_info_.get(), |
| 3009 "UpdateParentTextureInfo", | 3002 GL_TEXTURE_MIN_FILTER, |
| 3010 GetErrorState(), | 3003 GL_NEAREST); |
| 3011 offscreen_saved_color_texture_info_.get(), | 3004 texture_manager()->SetParameter( |
| 3012 GL_TEXTURE_MIN_FILTER, | 3005 "UpdateParentTextureInfo", |
| 3013 GL_NEAREST); | 3006 GetErrorState(), |
| 3014 parent_texture_manager->SetParameter( | 3007 offscreen_saved_color_texture_info_.get(), |
| 3015 "UpdateParentTextureInfo", | 3008 GL_TEXTURE_WRAP_S, |
| 3016 GetErrorState(), | 3009 GL_CLAMP_TO_EDGE); |
| 3017 offscreen_saved_color_texture_info_.get(), | 3010 texture_manager()->SetParameter( |
| 3018 GL_TEXTURE_WRAP_S, | 3011 "UpdateParentTextureInfo", |
| 3019 GL_CLAMP_TO_EDGE); | 3012 GetErrorState(), |
| 3020 parent_texture_manager->SetParameter( | 3013 offscreen_saved_color_texture_info_.get(), |
| 3021 "UpdateParentTextureInfo", | 3014 GL_TEXTURE_WRAP_T, |
| 3022 GetErrorState(), | 3015 GL_CLAMP_TO_EDGE); |
| 3023 offscreen_saved_color_texture_info_.get(), | 3016 TextureRef* texture_ref = GetTextureInfoForTarget(target); |
| 3024 GL_TEXTURE_WRAP_T, | 3017 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); |
| 3025 GL_CLAMP_TO_EDGE); | |
| 3026 TextureRef* texture_ref = GetTextureInfoForTarget(target); | |
| 3027 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); | |
| 3028 } else { | |
| 3029 offscreen_saved_color_texture_info_ = NULL; | |
| 3030 } | |
| 3031 } | 3018 } |
| 3032 | 3019 |
| 3033 void GLES2DecoderImpl::SetResizeCallback( | 3020 void GLES2DecoderImpl::SetResizeCallback( |
| 3034 const base::Callback<void(gfx::Size, float)>& callback) { | 3021 const base::Callback<void(gfx::Size, float)>& callback) { |
| 3035 resize_callback_ = callback; | 3022 resize_callback_ = callback; |
| 3036 } | 3023 } |
| 3037 | 3024 |
| 3038 Logger* GLES2DecoderImpl::GetLogger() { | 3025 Logger* GLES2DecoderImpl::GetLogger() { |
| 3039 return &logger_; | 3026 return &logger_; |
| 3040 } | 3027 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3103 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { | 3090 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { |
| 3104 total_processing_commands_time_ += time; | 3091 total_processing_commands_time_ += time; |
| 3105 } | 3092 } |
| 3106 | 3093 |
| 3107 void GLES2DecoderImpl::Destroy(bool have_context) { | 3094 void GLES2DecoderImpl::Destroy(bool have_context) { |
| 3108 if (!initialized()) | 3095 if (!initialized()) |
| 3109 return; | 3096 return; |
| 3110 | 3097 |
| 3111 DCHECK(!have_context || context_->IsCurrent(NULL)); | 3098 DCHECK(!have_context || context_->IsCurrent(NULL)); |
| 3112 | 3099 |
| 3113 ChildList children = children_; | |
| 3114 for (ChildList::iterator it = children.begin(); it != children.end(); ++it) | |
| 3115 (*it)->SetParent(NULL, 0); | |
| 3116 DCHECK(children_.empty()); | |
| 3117 SetParent(NULL, 0); | |
| 3118 | |
| 3119 // Unbind everything. | 3100 // Unbind everything. |
| 3120 state_.vertex_attrib_manager = NULL; | 3101 state_.vertex_attrib_manager = NULL; |
| 3121 default_vertex_attrib_manager_ = NULL; | 3102 default_vertex_attrib_manager_ = NULL; |
| 3122 state_.texture_units.clear(); | 3103 state_.texture_units.clear(); |
| 3123 state_.bound_array_buffer = NULL; | 3104 state_.bound_array_buffer = NULL; |
| 3124 state_.current_query = NULL; | 3105 state_.current_query = NULL; |
| 3125 state_.current_program = NULL; | 3106 state_.current_program = NULL; |
| 3126 state_.bound_read_framebuffer = NULL; | 3107 state_.bound_read_framebuffer = NULL; |
| 3127 state_.bound_draw_framebuffer = NULL; | 3108 state_.bound_draw_framebuffer = NULL; |
| 3128 state_.bound_renderbuffer = NULL; | 3109 state_.bound_renderbuffer = NULL; |
| 3129 | 3110 |
| 3111 if (offscreen_saved_color_texture_info_) { |
| 3112 DCHECK(offscreen_target_color_texture_); |
| 3113 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
| 3114 offscreen_saved_color_texture_->id()); |
| 3115 offscreen_saved_color_texture_->Invalidate(); |
| 3116 offscreen_saved_color_texture_info_ = NULL; |
| 3117 } |
| 3130 if (have_context) { | 3118 if (have_context) { |
| 3131 if (copy_texture_CHROMIUM_.get()) { | 3119 if (copy_texture_CHROMIUM_.get()) { |
| 3132 copy_texture_CHROMIUM_->Destroy(); | 3120 copy_texture_CHROMIUM_->Destroy(); |
| 3133 copy_texture_CHROMIUM_.reset(); | 3121 copy_texture_CHROMIUM_.reset(); |
| 3134 } | 3122 } |
| 3135 | 3123 |
| 3136 if (state_.current_program.get()) { | 3124 if (state_.current_program.get()) { |
| 3137 program_manager()->UnuseProgram(shader_manager(), | 3125 program_manager()->UnuseProgram(shader_manager(), |
| 3138 state_.current_program.get()); | 3126 state_.current_program.get()); |
| 3139 state_.current_program = NULL; | 3127 state_.current_program = NULL; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3230 } | 3218 } |
| 3231 | 3219 |
| 3232 void GLES2DecoderImpl::SetSurface( | 3220 void GLES2DecoderImpl::SetSurface( |
| 3233 const scoped_refptr<gfx::GLSurface>& surface) { | 3221 const scoped_refptr<gfx::GLSurface>& surface) { |
| 3234 DCHECK(context_->IsCurrent(NULL)); | 3222 DCHECK(context_->IsCurrent(NULL)); |
| 3235 DCHECK(surface_.get()); | 3223 DCHECK(surface_.get()); |
| 3236 surface_ = surface; | 3224 surface_ = surface; |
| 3237 RestoreCurrentFramebufferBindings(); | 3225 RestoreCurrentFramebufferBindings(); |
| 3238 } | 3226 } |
| 3239 | 3227 |
| 3240 bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent, | 3228 bool GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { |
| 3241 uint32 new_parent_texture_id) { | |
| 3242 if (!offscreen_saved_color_texture_.get()) | 3229 if (!offscreen_saved_color_texture_.get()) |
| 3243 return false; | 3230 return false; |
| 3244 | 3231 if (!offscreen_saved_color_texture_info_.get()) { |
| 3245 // Remove the saved frame buffer mapping from the parent decoder. The | 3232 GLuint service_id = offscreen_saved_color_texture_->id(); |
| 3246 // parent pointer is a weak pointer so it will be null if the parent has | 3233 offscreen_saved_color_texture_info_ = CreateTexture(0, service_id); |
| 3247 // already been destroyed. | 3234 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), |
| 3248 if (parent_.get()) { | 3235 GL_TEXTURE_2D); |
| 3249 ChildList::iterator it = | 3236 UpdateParentTextureInfo(); |
| 3250 std::find(parent_->children_.begin(), parent_->children_.end(), this); | |
| 3251 DCHECK(it != parent_->children_.end()); | |
| 3252 parent_->children_.erase(it); | |
| 3253 // First check the texture has been mapped into the parent. This might not | |
| 3254 // be the case if initialization failed midway through. | |
| 3255 if (offscreen_saved_color_texture_info_.get() && | |
| 3256 offscreen_saved_color_texture_info_->client_id()) { | |
| 3257 parent_->texture_manager()->RemoveTexture( | |
| 3258 offscreen_saved_color_texture_info_->client_id()); | |
| 3259 } | |
| 3260 } | 3237 } |
| 3261 | 3238 gpu::gles2::MailboxName name; |
| 3262 GLES2DecoderImpl* new_parent_impl = static_cast<GLES2DecoderImpl*>( | 3239 memcpy(name.key, mailbox.name, sizeof(mailbox.name)); |
| 3263 new_parent); | 3240 return mailbox_manager()->ProduceTexture( |
| 3264 if (new_parent_impl) { | 3241 GL_TEXTURE_2D, name, offscreen_saved_color_texture_info_->texture()); |
| 3265 #ifndef NDEBUG | |
| 3266 ChildList::iterator it = std::find( | |
| 3267 new_parent_impl->children_.begin(), | |
| 3268 new_parent_impl->children_.end(), | |
| 3269 this); | |
| 3270 DCHECK(it == new_parent_impl->children_.end()); | |
| 3271 #endif | |
| 3272 new_parent_impl->children_.push_back(this); | |
| 3273 // Map the ID of the saved offscreen texture into the parent so that | |
| 3274 // it can reference it. | |
| 3275 GLuint service_id = offscreen_saved_color_texture_->id(); | |
| 3276 | |
| 3277 // Replace texture info when ID is already in use by parent. | |
| 3278 if (new_parent_impl->texture_manager()->GetTexture( | |
| 3279 new_parent_texture_id)) | |
| 3280 new_parent_impl->texture_manager()->RemoveTexture( | |
| 3281 new_parent_texture_id); | |
| 3282 | |
| 3283 offscreen_saved_color_texture_info_ = | |
| 3284 new_parent_impl->CreateTexture(new_parent_texture_id, service_id); | |
| 3285 offscreen_saved_color_texture_info_->texture()->SetNotOwned(); | |
| 3286 new_parent_impl->texture_manager() | |
| 3287 ->SetTarget(offscreen_saved_color_texture_info_.get(), GL_TEXTURE_2D); | |
| 3288 | |
| 3289 parent_ = base::AsWeakPtr<GLES2DecoderImpl>(new_parent_impl); | |
| 3290 | |
| 3291 UpdateParentTextureInfo(); | |
| 3292 } else { | |
| 3293 parent_.reset(); | |
| 3294 offscreen_saved_color_texture_info_ = NULL; | |
| 3295 } | |
| 3296 | |
| 3297 return true; | |
| 3298 } | 3242 } |
| 3299 | 3243 |
| 3300 size_t GLES2DecoderImpl::GetBackbufferMemoryTotal() { | 3244 size_t GLES2DecoderImpl::GetBackbufferMemoryTotal() { |
| 3301 size_t total = 0; | 3245 size_t total = 0; |
| 3302 if (offscreen_target_frame_buffer_.get()) { | 3246 if (offscreen_target_frame_buffer_.get()) { |
| 3303 if (offscreen_target_color_texture_.get()) { | 3247 if (offscreen_target_color_texture_.get()) { |
| 3304 total += offscreen_target_color_texture_->estimated_size(); | 3248 total += offscreen_target_color_texture_->estimated_size(); |
| 3305 } | 3249 } |
| 3306 if (offscreen_target_color_render_buffer_.get()) { | 3250 if (offscreen_target_color_render_buffer_.get()) { |
| 3307 total += offscreen_target_color_render_buffer_->estimated_size(); | 3251 total += offscreen_target_color_render_buffer_->estimated_size(); |
| (...skipping 5725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9033 | 8977 |
| 9034 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { | 8978 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { |
| 9035 // Only loses the context once. | 8979 // Only loses the context once. |
| 9036 if (reset_status_ != GL_NO_ERROR) { | 8980 if (reset_status_ != GL_NO_ERROR) { |
| 9037 return; | 8981 return; |
| 9038 } | 8982 } |
| 9039 | 8983 |
| 9040 // Marks this context as lost. | 8984 // Marks this context as lost. |
| 9041 reset_status_ = reset_status; | 8985 reset_status_ = reset_status; |
| 9042 current_decoder_error_ = error::kLostContext; | 8986 current_decoder_error_ = error::kLostContext; |
| 9043 | |
| 9044 // Loses the parent's context. | |
| 9045 if (parent_.get()) { | |
| 9046 parent_->LoseContext(reset_status); | |
| 9047 } | |
| 9048 | |
| 9049 // Loses any child contexts. | |
| 9050 for (ChildList::iterator it = children_.begin(); | |
| 9051 it != children_.end(); | |
| 9052 ++it) { | |
| 9053 (*it)->LoseContext(reset_status); | |
| 9054 } | |
| 9055 } | 8987 } |
| 9056 | 8988 |
| 9057 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( | 8989 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( |
| 9058 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { | 8990 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { |
| 9059 GLenum current = static_cast<GLenum>(c.current); | 8991 GLenum current = static_cast<GLenum>(c.current); |
| 9060 GLenum other = static_cast<GLenum>(c.other); | 8992 GLenum other = static_cast<GLenum>(c.other); |
| 9061 if (!validators_->reset_status.IsValid(current)) { | 8993 if (!validators_->reset_status.IsValid(current)) { |
| 9062 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 8994 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
| 9063 "glLoseContextCHROMIUM", current, "current"); | 8995 "glLoseContextCHROMIUM", current, "current"); |
| 9064 } | 8996 } |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10370 return error::kNoError; | 10302 return error::kNoError; |
| 10371 } | 10303 } |
| 10372 | 10304 |
| 10373 // Include the auto-generated part of this file. We split this because it means | 10305 // Include the auto-generated part of this file. We split this because it means |
| 10374 // we can easily edit the non-auto generated parts right here in this file | 10306 // we can easily edit the non-auto generated parts right here in this file |
| 10375 // instead of having to edit some template or the code generator. | 10307 // instead of having to edit some template or the code generator. |
| 10376 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10308 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10377 | 10309 |
| 10378 } // namespace gles2 | 10310 } // namespace gles2 |
| 10379 } // namespace gpu | 10311 } // namespace gpu |
| OLD | NEW |