| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 4428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4439 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { | 4439 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { |
| 4440 total_processing_commands_time_ += time; | 4440 total_processing_commands_time_ += time; |
| 4441 } | 4441 } |
| 4442 | 4442 |
| 4443 void GLES2DecoderImpl::Destroy(bool have_context) { | 4443 void GLES2DecoderImpl::Destroy(bool have_context) { |
| 4444 if (!initialized()) | 4444 if (!initialized()) |
| 4445 return; | 4445 return; |
| 4446 | 4446 |
| 4447 DCHECK(!have_context || context_->IsCurrent(nullptr)); | 4447 DCHECK(!have_context || context_->IsCurrent(nullptr)); |
| 4448 | 4448 |
| 4449 // Unbind everything. | |
| 4450 state_.vertex_attrib_manager = nullptr; | |
| 4451 state_.default_vertex_attrib_manager = nullptr; | |
| 4452 state_.texture_units.clear(); | |
| 4453 state_.sampler_units.clear(); | |
| 4454 state_.bound_array_buffer = nullptr; | |
| 4455 state_.bound_copy_read_buffer = nullptr; | |
| 4456 state_.bound_copy_write_buffer = nullptr; | |
| 4457 state_.bound_pixel_pack_buffer = nullptr; | |
| 4458 state_.bound_pixel_unpack_buffer = nullptr; | |
| 4459 state_.bound_transform_feedback_buffer = nullptr; | |
| 4460 state_.bound_uniform_buffer = nullptr; | |
| 4461 framebuffer_state_.bound_read_framebuffer = nullptr; | |
| 4462 framebuffer_state_.bound_draw_framebuffer = nullptr; | |
| 4463 state_.bound_renderbuffer = nullptr; | |
| 4464 state_.bound_transform_feedback = nullptr; | |
| 4465 state_.default_transform_feedback = nullptr; | |
| 4466 state_.indexed_uniform_buffer_bindings = nullptr; | |
| 4467 | |
| 4468 ReleaseAllBackTextures(have_context); | 4449 ReleaseAllBackTextures(have_context); |
| 4469 if (have_context) { | 4450 if (have_context) { |
| 4470 if (apply_framebuffer_attachment_cmaa_intel_.get()) { | 4451 if (apply_framebuffer_attachment_cmaa_intel_.get()) { |
| 4471 apply_framebuffer_attachment_cmaa_intel_->Destroy(); | 4452 apply_framebuffer_attachment_cmaa_intel_->Destroy(); |
| 4472 apply_framebuffer_attachment_cmaa_intel_.reset(); | 4453 apply_framebuffer_attachment_cmaa_intel_.reset(); |
| 4473 } | 4454 } |
| 4474 | 4455 |
| 4475 if (copy_tex_image_blit_.get()) { | 4456 if (copy_tex_image_blit_.get()) { |
| 4476 copy_tex_image_blit_->Destroy(); | 4457 copy_tex_image_blit_->Destroy(); |
| 4477 copy_tex_image_blit_.reset(); | 4458 copy_tex_image_blit_.reset(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4538 if (offscreen_resolved_frame_buffer_.get()) | 4519 if (offscreen_resolved_frame_buffer_.get()) |
| 4539 offscreen_resolved_frame_buffer_->Invalidate(); | 4520 offscreen_resolved_frame_buffer_->Invalidate(); |
| 4540 if (offscreen_resolved_color_texture_.get()) | 4521 if (offscreen_resolved_color_texture_.get()) |
| 4541 offscreen_resolved_color_texture_->Invalidate(); | 4522 offscreen_resolved_color_texture_->Invalidate(); |
| 4542 for (auto& fence : deschedule_until_finished_fences_) { | 4523 for (auto& fence : deschedule_until_finished_fences_) { |
| 4543 fence->Invalidate(); | 4524 fence->Invalidate(); |
| 4544 } | 4525 } |
| 4545 } | 4526 } |
| 4546 deschedule_until_finished_fences_.clear(); | 4527 deschedule_until_finished_fences_.clear(); |
| 4547 | 4528 |
| 4529 // Unbind everything. |
| 4530 state_.vertex_attrib_manager = nullptr; |
| 4531 state_.default_vertex_attrib_manager = nullptr; |
| 4532 state_.texture_units.clear(); |
| 4533 state_.sampler_units.clear(); |
| 4534 state_.bound_array_buffer = nullptr; |
| 4535 state_.bound_copy_read_buffer = nullptr; |
| 4536 state_.bound_copy_write_buffer = nullptr; |
| 4537 state_.bound_pixel_pack_buffer = nullptr; |
| 4538 state_.bound_pixel_unpack_buffer = nullptr; |
| 4539 state_.bound_transform_feedback_buffer = nullptr; |
| 4540 state_.bound_uniform_buffer = nullptr; |
| 4541 framebuffer_state_.bound_read_framebuffer = nullptr; |
| 4542 framebuffer_state_.bound_draw_framebuffer = nullptr; |
| 4543 state_.bound_renderbuffer = nullptr; |
| 4544 state_.bound_transform_feedback = nullptr; |
| 4545 state_.default_transform_feedback = nullptr; |
| 4546 state_.indexed_uniform_buffer_bindings = nullptr; |
| 4547 |
| 4548 // Current program must be cleared after calling ProgramManager::UnuseProgram. | 4548 // Current program must be cleared after calling ProgramManager::UnuseProgram. |
| 4549 // Otherwise, we can leak objects. http://crbug.com/258772. | 4549 // Otherwise, we can leak objects. http://crbug.com/258772. |
| 4550 // state_.current_program must be reset before group_ is reset because | 4550 // state_.current_program must be reset before group_ is reset because |
| 4551 // the later deletes the ProgramManager object that referred by | 4551 // the later deletes the ProgramManager object that referred by |
| 4552 // state_.current_program object. | 4552 // state_.current_program object. |
| 4553 state_.current_program = NULL; | 4553 state_.current_program = NULL; |
| 4554 | 4554 |
| 4555 apply_framebuffer_attachment_cmaa_intel_.reset(); | 4555 apply_framebuffer_attachment_cmaa_intel_.reset(); |
| 4556 copy_tex_image_blit_.reset(); | 4556 copy_tex_image_blit_.reset(); |
| 4557 copy_texture_CHROMIUM_.reset(); | 4557 copy_texture_CHROMIUM_.reset(); |
| (...skipping 12489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17047 } | 17047 } |
| 17048 | 17048 |
| 17049 // Include the auto-generated part of this file. We split this because it means | 17049 // Include the auto-generated part of this file. We split this because it means |
| 17050 // we can easily edit the non-auto generated parts right here in this file | 17050 // we can easily edit the non-auto generated parts right here in this file |
| 17051 // instead of having to edit some template or the code generator. | 17051 // instead of having to edit some template or the code generator. |
| 17052 #include "base/macros.h" | 17052 #include "base/macros.h" |
| 17053 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17053 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17054 | 17054 |
| 17055 } // namespace gles2 | 17055 } // namespace gles2 |
| 17056 } // namespace gpu | 17056 } // namespace gpu |
| OLD | NEW |