| 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/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "gpu/command_buffer/service/buffer_manager.h" | 14 #include "gpu/command_buffer/service/buffer_manager.h" |
| 15 #include "gpu/command_buffer/service/framebuffer_manager.h" | 15 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 16 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
| 16 #include "gpu/command_buffer/service/gpu_preferences.h" | 17 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 17 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 18 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| 18 #include "gpu/command_buffer/service/path_manager.h" | 19 #include "gpu/command_buffer/service/path_manager.h" |
| 19 #include "gpu/command_buffer/service/program_manager.h" | 20 #include "gpu/command_buffer/service/program_manager.h" |
| 20 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 21 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| 21 #include "gpu/command_buffer/service/sampler_manager.h" | 22 #include "gpu/command_buffer/service/sampler_manager.h" |
| 22 #include "gpu/command_buffer/service/shader_manager.h" | 23 #include "gpu/command_buffer/service/shader_manager.h" |
| 23 #include "gpu/command_buffer/service/texture_manager.h" | 24 #include "gpu/command_buffer/service/texture_manager.h" |
| 24 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 25 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 25 #include "ui/gl/gl_bindings.h" | 26 #include "ui/gl/gl_bindings.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 max_dual_source_draw_buffers_(0u), | 95 max_dual_source_draw_buffers_(0u), |
| 95 max_vertex_output_components_(0u), | 96 max_vertex_output_components_(0u), |
| 96 max_fragment_input_components_(0u), | 97 max_fragment_input_components_(0u), |
| 97 min_program_texel_offset_(0), | 98 min_program_texel_offset_(0), |
| 98 max_program_texel_offset_(0), | 99 max_program_texel_offset_(0), |
| 99 max_transform_feedback_separate_attribs_(0u), | 100 max_transform_feedback_separate_attribs_(0u), |
| 100 max_uniform_buffer_bindings_(0u), | 101 max_uniform_buffer_bindings_(0u), |
| 101 uniform_buffer_offset_alignment_(1u), | 102 uniform_buffer_offset_alignment_(1u), |
| 102 program_cache_(NULL), | 103 program_cache_(NULL), |
| 103 feature_info_(feature_info), | 104 feature_info_(feature_info), |
| 104 image_factory_(image_factory) { | 105 image_factory_(image_factory), |
| 106 passthrough_resources_(new PassthroughResources) { |
| 105 { | 107 { |
| 106 DCHECK(feature_info_); | 108 DCHECK(feature_info_); |
| 107 if (!mailbox_manager_.get()) | 109 if (!mailbox_manager_.get()) |
| 108 mailbox_manager_ = new MailboxManagerImpl; | 110 mailbox_manager_ = new MailboxManagerImpl; |
| 109 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); | 111 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); |
| 110 } | 112 } |
| 111 } | 113 } |
| 112 | 114 |
| 113 bool ContextGroup::Initialize(GLES2Decoder* decoder, | 115 bool ContextGroup::Initialize(GLES2Decoder* decoder, |
| 114 ContextType context_type, | 116 ContextType context_type, |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 shader_manager_->Destroy(have_context); | 529 shader_manager_->Destroy(have_context); |
| 528 shader_manager_.reset(); | 530 shader_manager_.reset(); |
| 529 } | 531 } |
| 530 | 532 |
| 531 if (sampler_manager_ != NULL) { | 533 if (sampler_manager_ != NULL) { |
| 532 sampler_manager_->Destroy(have_context); | 534 sampler_manager_->Destroy(have_context); |
| 533 sampler_manager_.reset(); | 535 sampler_manager_.reset(); |
| 534 } | 536 } |
| 535 | 537 |
| 536 memory_tracker_ = NULL; | 538 memory_tracker_ = NULL; |
| 539 |
| 540 passthrough_resources_->Destroy(have_context); |
| 541 passthrough_resources_.reset(); |
| 537 } | 542 } |
| 538 | 543 |
| 539 uint32_t ContextGroup::GetMemRepresented() const { | 544 uint32_t ContextGroup::GetMemRepresented() const { |
| 540 uint32_t total = 0; | 545 uint32_t total = 0; |
| 541 if (buffer_manager_.get()) | 546 if (buffer_manager_.get()) |
| 542 total += buffer_manager_->mem_represented(); | 547 total += buffer_manager_->mem_represented(); |
| 543 if (renderbuffer_manager_.get()) | 548 if (renderbuffer_manager_.get()) |
| 544 total += renderbuffer_manager_->mem_represented(); | 549 total += renderbuffer_manager_->mem_represented(); |
| 545 if (texture_manager_.get()) | 550 if (texture_manager_.get()) |
| 546 total += texture_manager_->mem_represented(); | 551 total += texture_manager_->mem_represented(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 GLuint client_id, GLuint* service_id) const { | 607 GLuint client_id, GLuint* service_id) const { |
| 603 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 608 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 604 if (!buffer) | 609 if (!buffer) |
| 605 return false; | 610 return false; |
| 606 *service_id = buffer->service_id(); | 611 *service_id = buffer->service_id(); |
| 607 return true; | 612 return true; |
| 608 } | 613 } |
| 609 | 614 |
| 610 } // namespace gles2 | 615 } // namespace gles2 |
| 611 } // namespace gpu | 616 } // namespace gpu |
| OLD | NEW |