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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3621 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { | 3621 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { |
3622 total_processing_commands_time_ += time; | 3622 total_processing_commands_time_ += time; |
3623 } | 3623 } |
3624 | 3624 |
3625 void GLES2DecoderImpl::Destroy(bool have_context) { | 3625 void GLES2DecoderImpl::Destroy(bool have_context) { |
3626 if (!initialized()) | 3626 if (!initialized()) |
3627 return; | 3627 return; |
3628 | 3628 |
3629 DCHECK(!have_context || context_->IsCurrent(NULL)); | 3629 DCHECK(!have_context || context_->IsCurrent(NULL)); |
3630 | 3630 |
3631 if (vertex_array_manager_ .get()) { | |
3632 // Destroy needs to be called before the VertexAttribManagers are destoryed | |
jamesr
2015/04/30 00:11:21
s/destoryed/destroyed/
etiennej
2015/04/30 12:27:08
Done.
| |
3633 // so that they know the context is no longer available and do not attempts | |
3634 // to call gl* functions. | |
3635 vertex_array_manager_->Destroy(have_context); | |
3636 } | |
3637 | |
3631 // Unbind everything. | 3638 // Unbind everything. |
3632 state_.vertex_attrib_manager = NULL; | 3639 state_.vertex_attrib_manager = NULL; |
3633 state_.default_vertex_attrib_manager = NULL; | 3640 state_.default_vertex_attrib_manager = NULL; |
3634 state_.texture_units.clear(); | 3641 state_.texture_units.clear(); |
3635 state_.bound_array_buffer = NULL; | 3642 state_.bound_array_buffer = NULL; |
3636 state_.current_queries.clear(); | 3643 state_.current_queries.clear(); |
3637 framebuffer_state_.bound_read_framebuffer = NULL; | 3644 framebuffer_state_.bound_read_framebuffer = NULL; |
3638 framebuffer_state_.bound_draw_framebuffer = NULL; | 3645 framebuffer_state_.bound_draw_framebuffer = NULL; |
3639 state_.bound_renderbuffer = NULL; | 3646 state_.bound_renderbuffer = NULL; |
3640 state_.bound_valuebuffer = NULL; | 3647 state_.bound_valuebuffer = NULL; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3720 | 3727 |
3721 copy_texture_CHROMIUM_.reset(); | 3728 copy_texture_CHROMIUM_.reset(); |
3722 clear_framebuffer_blit_.reset(); | 3729 clear_framebuffer_blit_.reset(); |
3723 | 3730 |
3724 if (query_manager_.get()) { | 3731 if (query_manager_.get()) { |
3725 query_manager_->Destroy(have_context); | 3732 query_manager_->Destroy(have_context); |
3726 query_manager_.reset(); | 3733 query_manager_.reset(); |
3727 } | 3734 } |
3728 | 3735 |
3729 if (vertex_array_manager_ .get()) { | 3736 if (vertex_array_manager_ .get()) { |
3730 vertex_array_manager_->Destroy(have_context); | |
3731 vertex_array_manager_.reset(); | 3737 vertex_array_manager_.reset(); |
3732 } | 3738 } |
3733 | 3739 |
3734 if (image_manager_.get()) { | 3740 if (image_manager_.get()) { |
3735 image_manager_->Destroy(have_context); | 3741 image_manager_->Destroy(have_context); |
3736 image_manager_.reset(); | 3742 image_manager_.reset(); |
3737 } | 3743 } |
3738 | 3744 |
3739 offscreen_target_frame_buffer_.reset(); | 3745 offscreen_target_frame_buffer_.reset(); |
3740 offscreen_target_color_texture_.reset(); | 3746 offscreen_target_color_texture_.reset(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3945 if (is_offscreen) { | 3951 if (is_offscreen) { |
3946 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { | 3952 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { |
3947 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " | 3953 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " |
3948 << "ResizeOffscreenFrameBuffer failed."; | 3954 << "ResizeOffscreenFrameBuffer failed."; |
3949 return error::kLostContext; | 3955 return error::kLostContext; |
3950 } | 3956 } |
3951 } | 3957 } |
3952 | 3958 |
3953 if (!resize_callback_.is_null()) { | 3959 if (!resize_callback_.is_null()) { |
3954 resize_callback_.Run(gfx::Size(width, height), scale_factor); | 3960 resize_callback_.Run(gfx::Size(width, height), scale_factor); |
3955 DCHECK(context_->IsCurrent(surface_.get())); | |
3956 if (!context_->IsCurrent(surface_.get())) { | 3961 if (!context_->IsCurrent(surface_.get())) { |
3957 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " | 3962 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " |
3958 << "current after resize callback."; | 3963 << "current after resize callback."; |
3959 return error::kLostContext; | 3964 return error::kLostContext; |
3960 } | 3965 } |
3961 } | 3966 } |
3962 | 3967 |
3963 return error::kNoError; | 3968 return error::kNoError; |
3964 } | 3969 } |
3965 | 3970 |
(...skipping 8465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12431 } | 12436 } |
12432 } | 12437 } |
12433 | 12438 |
12434 // Include the auto-generated part of this file. We split this because it means | 12439 // Include the auto-generated part of this file. We split this because it means |
12435 // we can easily edit the non-auto generated parts right here in this file | 12440 // we can easily edit the non-auto generated parts right here in this file |
12436 // instead of having to edit some template or the code generator. | 12441 // instead of having to edit some template or the code generator. |
12437 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 12442 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
12438 | 12443 |
12439 } // namespace gles2 | 12444 } // namespace gles2 |
12440 } // namespace gpu | 12445 } // namespace gpu |
OLD | NEW |