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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 506 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
506 const scoped_refptr<gfx::GLContext>& context, | 507 const scoped_refptr<gfx::GLContext>& context, |
507 bool offscreen, | 508 bool offscreen, |
508 const gfx::Size& size, | 509 const gfx::Size& size, |
509 const DisallowedFeatures& disallowed_features, | 510 const DisallowedFeatures& disallowed_features, |
510 const char* allowed_extensions, | 511 const char* allowed_extensions, |
511 const std::vector<int32>& attribs) OVERRIDE; | 512 const std::vector<int32>& attribs) OVERRIDE; |
512 virtual void Destroy(bool have_context) OVERRIDE; | 513 virtual void Destroy(bool have_context) OVERRIDE; |
513 virtual void SetSurface( | 514 virtual void SetSurface( |
514 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; | 515 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; |
515 virtual bool SetParent(GLES2Decoder* parent_decoder, | 516 virtual bool ProduceFrontBuffer(const Mailbox& mailbox) OVERRIDE; |
516 uint32 parent_texture_id) OVERRIDE; | |
517 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; | 517 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; |
518 void UpdateParentTextureInfo(); | 518 void UpdateParentTextureInfo(); |
519 virtual bool MakeCurrent() OVERRIDE; | 519 virtual bool MakeCurrent() OVERRIDE; |
520 virtual void ReleaseCurrent() OVERRIDE; | 520 virtual void ReleaseCurrent() OVERRIDE; |
521 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } | 521 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } |
522 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } | 522 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } |
523 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } | 523 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } |
524 virtual void RestoreState() const OVERRIDE; | 524 virtual void RestoreState() const OVERRIDE; |
525 | 525 |
526 virtual void RestoreActiveTexture() const OVERRIDE { | 526 virtual void RestoreActiveTexture() const OVERRIDE { |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 | 1549 |
1550 // The ContextGroup for this decoder uses to track resources. | 1550 // The ContextGroup for this decoder uses to track resources. |
1551 scoped_refptr<ContextGroup> group_; | 1551 scoped_refptr<ContextGroup> group_; |
1552 | 1552 |
1553 DebugMarkerManager debug_marker_manager_; | 1553 DebugMarkerManager debug_marker_manager_; |
1554 Logger logger_; | 1554 Logger logger_; |
1555 | 1555 |
1556 // All the state for this context. | 1556 // All the state for this context. |
1557 ContextState state_; | 1557 ContextState state_; |
1558 | 1558 |
1559 // A parent decoder can access this decoders saved offscreen frame buffer. | |
1560 // The parent pointer is reset if the parent is destroyed. | |
1561 base::WeakPtr<GLES2DecoderImpl> parent_; | |
1562 | |
1563 // Current width and height of the offscreen frame buffer. | 1559 // Current width and height of the offscreen frame buffer. |
1564 gfx::Size offscreen_size_; | 1560 gfx::Size offscreen_size_; |
1565 | 1561 |
1566 // Util to help with GL. | 1562 // Util to help with GL. |
1567 GLES2Util util_; | 1563 GLES2Util util_; |
1568 | 1564 |
1569 // unpack flip y as last set by glPixelStorei | 1565 // unpack flip y as last set by glPixelStorei |
1570 bool unpack_flip_y_; | 1566 bool unpack_flip_y_; |
1571 | 1567 |
1572 // unpack (un)premultiply alpha as last set by glPixelStorei | 1568 // unpack (un)premultiply alpha as last set by glPixelStorei |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 bool compile_shader_always_succeeds_; | 1676 bool compile_shader_always_succeeds_; |
1681 | 1677 |
1682 // Log extra info. | 1678 // Log extra info. |
1683 bool service_logging_; | 1679 bool service_logging_; |
1684 | 1680 |
1685 #if defined(OS_MACOSX) | 1681 #if defined(OS_MACOSX) |
1686 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; | 1682 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; |
1687 TextureToIOSurfaceMap texture_to_io_surface_map_; | 1683 TextureToIOSurfaceMap texture_to_io_surface_map_; |
1688 #endif | 1684 #endif |
1689 | 1685 |
1690 typedef std::vector<GLES2DecoderImpl*> ChildList; | |
1691 ChildList children_; | |
1692 | |
1693 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 1686 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
1694 | 1687 |
1695 // Cached values of the currently assigned viewport dimensions. | 1688 // Cached values of the currently assigned viewport dimensions. |
1696 GLsizei viewport_max_width_; | 1689 GLsizei viewport_max_width_; |
1697 GLsizei viewport_max_height_; | 1690 GLsizei viewport_max_height_; |
1698 | 1691 |
1699 // Command buffer stats. | 1692 // Command buffer stats. |
1700 int texture_upload_count_; | 1693 int texture_upload_count_; |
1701 base::TimeDelta total_texture_upload_time_; | 1694 base::TimeDelta total_texture_upload_time_; |
1702 base::TimeDelta total_processing_commands_time_; | 1695 base::TimeDelta total_processing_commands_time_; |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2969 if (framebuffer != NULL) { | 2962 if (framebuffer != NULL) { |
2970 return framebuffer->GetColorAttachmentFormat(); | 2963 return framebuffer->GetColorAttachmentFormat(); |
2971 } else if (offscreen_target_frame_buffer_.get()) { | 2964 } else if (offscreen_target_frame_buffer_.get()) { |
2972 return offscreen_target_color_format_; | 2965 return offscreen_target_color_format_; |
2973 } else { | 2966 } else { |
2974 return back_buffer_color_format_; | 2967 return back_buffer_color_format_; |
2975 } | 2968 } |
2976 } | 2969 } |
2977 | 2970 |
2978 void GLES2DecoderImpl::UpdateParentTextureInfo() { | 2971 void GLES2DecoderImpl::UpdateParentTextureInfo() { |
2979 if (parent_) { | 2972 if (!offscreen_saved_color_texture_info_.get()) |
2980 // Update the info about the offscreen saved color texture in the parent. | 2973 return; |
2981 // The reference to the parent is a weak pointer and will become null if the | 2974 GLenum target = offscreen_saved_color_texture_info_->texture()->target(); |
2982 // parent is later destroyed. | 2975 glBindTexture(target, offscreen_saved_color_texture_info_->service_id()); |
2983 GLenum target = offscreen_saved_color_texture_info_->texture()->target(); | 2976 texture_manager()->SetLevelInfo( |
2984 TextureManager* parent_texture_manager = parent_->texture_manager(); | 2977 offscreen_saved_color_texture_info_.get(), |
2985 glBindTexture(target, offscreen_saved_color_texture_info_->service_id()); | 2978 GL_TEXTURE_2D, |
2986 parent_texture_manager->SetLevelInfo( | 2979 0, // level |
2987 offscreen_saved_color_texture_info_.get(), | 2980 GL_RGBA, |
2988 GL_TEXTURE_2D, | 2981 offscreen_size_.width(), |
2989 0, // level | 2982 offscreen_size_.height(), |
2990 GL_RGBA, | 2983 1, // depth |
2991 offscreen_size_.width(), | 2984 0, // border |
2992 offscreen_size_.height(), | 2985 GL_RGBA, |
2993 1, // depth | 2986 GL_UNSIGNED_BYTE, |
2994 0, // border | 2987 true); |
2995 GL_RGBA, | 2988 texture_manager()->SetParameter( |
2996 GL_UNSIGNED_BYTE, | 2989 "UpdateParentTextureInfo", |
2997 true); | 2990 GetErrorState(), |
2998 parent_texture_manager->SetParameter( | 2991 offscreen_saved_color_texture_info_.get(), |
2999 "UpdateParentTextureInfo", | 2992 GL_TEXTURE_MAG_FILTER, |
3000 GetErrorState(), | 2993 GL_NEAREST); |
3001 offscreen_saved_color_texture_info_.get(), | 2994 texture_manager()->SetParameter( |
3002 GL_TEXTURE_MAG_FILTER, | 2995 "UpdateParentTextureInfo", |
3003 GL_NEAREST); | 2996 GetErrorState(), |
3004 parent_texture_manager->SetParameter( | 2997 offscreen_saved_color_texture_info_.get(), |
3005 "UpdateParentTextureInfo", | 2998 GL_TEXTURE_MIN_FILTER, |
3006 GetErrorState(), | 2999 GL_NEAREST); |
3007 offscreen_saved_color_texture_info_.get(), | 3000 texture_manager()->SetParameter( |
3008 GL_TEXTURE_MIN_FILTER, | 3001 "UpdateParentTextureInfo", |
3009 GL_NEAREST); | 3002 GetErrorState(), |
3010 parent_texture_manager->SetParameter( | 3003 offscreen_saved_color_texture_info_.get(), |
3011 "UpdateParentTextureInfo", | 3004 GL_TEXTURE_WRAP_S, |
3012 GetErrorState(), | 3005 GL_CLAMP_TO_EDGE); |
3013 offscreen_saved_color_texture_info_.get(), | 3006 texture_manager()->SetParameter( |
3014 GL_TEXTURE_WRAP_S, | 3007 "UpdateParentTextureInfo", |
3015 GL_CLAMP_TO_EDGE); | 3008 GetErrorState(), |
3016 parent_texture_manager->SetParameter( | 3009 offscreen_saved_color_texture_info_.get(), |
3017 "UpdateParentTextureInfo", | 3010 GL_TEXTURE_WRAP_T, |
3018 GetErrorState(), | 3011 GL_CLAMP_TO_EDGE); |
3019 offscreen_saved_color_texture_info_.get(), | 3012 TextureRef* texture_ref = GetTextureInfoForTarget(target); |
3020 GL_TEXTURE_WRAP_T, | 3013 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); |
3021 GL_CLAMP_TO_EDGE); | |
3022 TextureRef* texture_ref = GetTextureInfoForTarget(target); | |
3023 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); | |
3024 } else { | |
3025 offscreen_saved_color_texture_info_ = NULL; | |
3026 } | |
3027 } | 3014 } |
3028 | 3015 |
3029 void GLES2DecoderImpl::SetResizeCallback( | 3016 void GLES2DecoderImpl::SetResizeCallback( |
3030 const base::Callback<void(gfx::Size, float)>& callback) { | 3017 const base::Callback<void(gfx::Size, float)>& callback) { |
3031 resize_callback_ = callback; | 3018 resize_callback_ = callback; |
3032 } | 3019 } |
3033 | 3020 |
3034 Logger* GLES2DecoderImpl::GetLogger() { | 3021 Logger* GLES2DecoderImpl::GetLogger() { |
3035 return &logger_; | 3022 return &logger_; |
3036 } | 3023 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { | 3086 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { |
3100 total_processing_commands_time_ += time; | 3087 total_processing_commands_time_ += time; |
3101 } | 3088 } |
3102 | 3089 |
3103 void GLES2DecoderImpl::Destroy(bool have_context) { | 3090 void GLES2DecoderImpl::Destroy(bool have_context) { |
3104 if (!initialized()) | 3091 if (!initialized()) |
3105 return; | 3092 return; |
3106 | 3093 |
3107 DCHECK(!have_context || context_->IsCurrent(NULL)); | 3094 DCHECK(!have_context || context_->IsCurrent(NULL)); |
3108 | 3095 |
3109 ChildList children = children_; | |
3110 for (ChildList::iterator it = children.begin(); it != children.end(); ++it) | |
3111 (*it)->SetParent(NULL, 0); | |
3112 DCHECK(children_.empty()); | |
3113 SetParent(NULL, 0); | |
3114 | |
3115 // Unbind everything. | 3096 // Unbind everything. |
3116 state_.vertex_attrib_manager = NULL; | 3097 state_.vertex_attrib_manager = NULL; |
3117 default_vertex_attrib_manager_ = NULL; | 3098 default_vertex_attrib_manager_ = NULL; |
3118 state_.texture_units.clear(); | 3099 state_.texture_units.clear(); |
3119 state_.bound_array_buffer = NULL; | 3100 state_.bound_array_buffer = NULL; |
3120 state_.current_query = NULL; | 3101 state_.current_query = NULL; |
3121 state_.current_program = NULL; | 3102 state_.current_program = NULL; |
3122 state_.bound_read_framebuffer = NULL; | 3103 state_.bound_read_framebuffer = NULL; |
3123 state_.bound_draw_framebuffer = NULL; | 3104 state_.bound_draw_framebuffer = NULL; |
3124 state_.bound_renderbuffer = NULL; | 3105 state_.bound_renderbuffer = NULL; |
3125 | 3106 |
| 3107 if (offscreen_saved_color_texture_info_) { |
| 3108 DCHECK(offscreen_target_color_texture_); |
| 3109 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
| 3110 offscreen_saved_color_texture_->id()); |
| 3111 offscreen_saved_color_texture_->Invalidate(); |
| 3112 offscreen_saved_color_texture_info_ = NULL; |
| 3113 } |
3126 if (have_context) { | 3114 if (have_context) { |
3127 if (copy_texture_CHROMIUM_.get()) { | 3115 if (copy_texture_CHROMIUM_.get()) { |
3128 copy_texture_CHROMIUM_->Destroy(); | 3116 copy_texture_CHROMIUM_->Destroy(); |
3129 copy_texture_CHROMIUM_.reset(); | 3117 copy_texture_CHROMIUM_.reset(); |
3130 } | 3118 } |
3131 | 3119 |
3132 if (state_.current_program.get()) { | 3120 if (state_.current_program.get()) { |
3133 program_manager()->UnuseProgram(shader_manager(), | 3121 program_manager()->UnuseProgram(shader_manager(), |
3134 state_.current_program.get()); | 3122 state_.current_program.get()); |
3135 state_.current_program = NULL; | 3123 state_.current_program = NULL; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3226 } | 3214 } |
3227 | 3215 |
3228 void GLES2DecoderImpl::SetSurface( | 3216 void GLES2DecoderImpl::SetSurface( |
3229 const scoped_refptr<gfx::GLSurface>& surface) { | 3217 const scoped_refptr<gfx::GLSurface>& surface) { |
3230 DCHECK(context_->IsCurrent(NULL)); | 3218 DCHECK(context_->IsCurrent(NULL)); |
3231 DCHECK(surface_.get()); | 3219 DCHECK(surface_.get()); |
3232 surface_ = surface; | 3220 surface_ = surface; |
3233 RestoreCurrentFramebufferBindings(); | 3221 RestoreCurrentFramebufferBindings(); |
3234 } | 3222 } |
3235 | 3223 |
3236 bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent, | 3224 bool GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { |
3237 uint32 new_parent_texture_id) { | |
3238 if (!offscreen_saved_color_texture_.get()) | 3225 if (!offscreen_saved_color_texture_.get()) |
3239 return false; | 3226 return false; |
3240 | 3227 if (!offscreen_saved_color_texture_info_.get()) { |
3241 // Remove the saved frame buffer mapping from the parent decoder. The | 3228 GLuint service_id = offscreen_saved_color_texture_->id(); |
3242 // parent pointer is a weak pointer so it will be null if the parent has | 3229 offscreen_saved_color_texture_info_ = CreateTexture(0, service_id); |
3243 // already been destroyed. | 3230 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), |
3244 if (parent_) { | 3231 GL_TEXTURE_2D); |
3245 ChildList::iterator it = std::find( | 3232 UpdateParentTextureInfo(); |
3246 parent_->children_.begin(), | |
3247 parent_->children_.end(), | |
3248 this); | |
3249 DCHECK(it != parent_->children_.end()); | |
3250 parent_->children_.erase(it); | |
3251 // First check the texture has been mapped into the parent. This might not | |
3252 // be the case if initialization failed midway through. | |
3253 if (offscreen_saved_color_texture_info_.get() && | |
3254 offscreen_saved_color_texture_info_->client_id()) { | |
3255 parent_->texture_manager()->RemoveTexture( | |
3256 offscreen_saved_color_texture_info_->client_id()); | |
3257 } | |
3258 } | 3233 } |
3259 | 3234 gpu::gles2::MailboxName name; |
3260 GLES2DecoderImpl* new_parent_impl = static_cast<GLES2DecoderImpl*>( | 3235 memcpy(name.key, mailbox.name, sizeof(mailbox.name)); |
3261 new_parent); | 3236 return mailbox_manager()->ProduceTexture( |
3262 if (new_parent_impl) { | 3237 GL_TEXTURE_2D, name, offscreen_saved_color_texture_info_->texture()); |
3263 #ifndef NDEBUG | |
3264 ChildList::iterator it = std::find( | |
3265 new_parent_impl->children_.begin(), | |
3266 new_parent_impl->children_.end(), | |
3267 this); | |
3268 DCHECK(it == new_parent_impl->children_.end()); | |
3269 #endif | |
3270 new_parent_impl->children_.push_back(this); | |
3271 // Map the ID of the saved offscreen texture into the parent so that | |
3272 // it can reference it. | |
3273 GLuint service_id = offscreen_saved_color_texture_->id(); | |
3274 | |
3275 // Replace texture info when ID is already in use by parent. | |
3276 if (new_parent_impl->texture_manager()->GetTexture( | |
3277 new_parent_texture_id)) | |
3278 new_parent_impl->texture_manager()->RemoveTexture( | |
3279 new_parent_texture_id); | |
3280 | |
3281 offscreen_saved_color_texture_info_ = | |
3282 new_parent_impl->CreateTexture(new_parent_texture_id, service_id); | |
3283 offscreen_saved_color_texture_info_->texture()->SetNotOwned(); | |
3284 new_parent_impl->texture_manager() | |
3285 ->SetTarget(offscreen_saved_color_texture_info_.get(), GL_TEXTURE_2D); | |
3286 | |
3287 parent_ = base::AsWeakPtr<GLES2DecoderImpl>(new_parent_impl); | |
3288 | |
3289 UpdateParentTextureInfo(); | |
3290 } else { | |
3291 parent_.reset(); | |
3292 offscreen_saved_color_texture_info_ = NULL; | |
3293 } | |
3294 | |
3295 return true; | |
3296 } | 3238 } |
3297 | 3239 |
3298 size_t GLES2DecoderImpl::GetBackbufferMemoryTotal() { | 3240 size_t GLES2DecoderImpl::GetBackbufferMemoryTotal() { |
3299 size_t total = 0; | 3241 size_t total = 0; |
3300 if (offscreen_target_frame_buffer_.get()) { | 3242 if (offscreen_target_frame_buffer_.get()) { |
3301 if (offscreen_target_color_texture_.get()) { | 3243 if (offscreen_target_color_texture_.get()) { |
3302 total += offscreen_target_color_texture_->estimated_size(); | 3244 total += offscreen_target_color_texture_->estimated_size(); |
3303 } | 3245 } |
3304 if (offscreen_target_color_render_buffer_.get()) { | 3246 if (offscreen_target_color_render_buffer_.get()) { |
3305 total += offscreen_target_color_render_buffer_->estimated_size(); | 3247 total += offscreen_target_color_render_buffer_->estimated_size(); |
(...skipping 5711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9017 | 8959 |
9018 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { | 8960 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { |
9019 // Only loses the context once. | 8961 // Only loses the context once. |
9020 if (reset_status_ != GL_NO_ERROR) { | 8962 if (reset_status_ != GL_NO_ERROR) { |
9021 return; | 8963 return; |
9022 } | 8964 } |
9023 | 8965 |
9024 // Marks this context as lost. | 8966 // Marks this context as lost. |
9025 reset_status_ = reset_status; | 8967 reset_status_ = reset_status; |
9026 current_decoder_error_ = error::kLostContext; | 8968 current_decoder_error_ = error::kLostContext; |
9027 | |
9028 // Loses the parent's context. | |
9029 if (parent_) { | |
9030 parent_->LoseContext(reset_status); | |
9031 } | |
9032 | |
9033 // Loses any child contexts. | |
9034 for (ChildList::iterator it = children_.begin(); | |
9035 it != children_.end(); | |
9036 ++it) { | |
9037 (*it)->LoseContext(reset_status); | |
9038 } | |
9039 } | 8969 } |
9040 | 8970 |
9041 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( | 8971 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( |
9042 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { | 8972 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { |
9043 GLenum current = static_cast<GLenum>(c.current); | 8973 GLenum current = static_cast<GLenum>(c.current); |
9044 GLenum other = static_cast<GLenum>(c.other); | 8974 GLenum other = static_cast<GLenum>(c.other); |
9045 if (!validators_->reset_status.IsValid(current)) { | 8975 if (!validators_->reset_status.IsValid(current)) { |
9046 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 8976 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
9047 "glLoseContextCHROMIUM", current, "current"); | 8977 "glLoseContextCHROMIUM", current, "current"); |
9048 } | 8978 } |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10354 return error::kNoError; | 10284 return error::kNoError; |
10355 } | 10285 } |
10356 | 10286 |
10357 // Include the auto-generated part of this file. We split this because it means | 10287 // Include the auto-generated part of this file. We split this because it means |
10358 // we can easily edit the non-auto generated parts right here in this file | 10288 // we can easily edit the non-auto generated parts right here in this file |
10359 // instead of having to edit some template or the code generator. | 10289 // instead of having to edit some template or the code generator. |
10360 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10290 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10361 | 10291 |
10362 } // namespace gles2 | 10292 } // namespace gles2 |
10363 } // namespace gpu | 10293 } // namespace gpu |
OLD | NEW |