| 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> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } // namespace anonymous | 56 } // namespace anonymous |
| 57 | 57 |
| 58 ContextGroup::ContextGroup( | 58 ContextGroup::ContextGroup( |
| 59 const GpuPreferences& gpu_preferences, | 59 const GpuPreferences& gpu_preferences, |
| 60 const scoped_refptr<MailboxManager>& mailbox_manager, | 60 const scoped_refptr<MailboxManager>& mailbox_manager, |
| 61 const scoped_refptr<MemoryTracker>& memory_tracker, | 61 const scoped_refptr<MemoryTracker>& memory_tracker, |
| 62 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 62 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
| 63 const scoped_refptr<FramebufferCompletenessCache>& | 63 const scoped_refptr<FramebufferCompletenessCache>& |
| 64 framebuffer_completeness_cache, | 64 framebuffer_completeness_cache, |
| 65 const scoped_refptr<FeatureInfo>& feature_info, | 65 const scoped_refptr<FeatureInfo>& feature_info, |
| 66 bool bind_generates_resource) | 66 bool bind_generates_resource, |
| 67 gpu::ImageFactory* image_factory) |
| 67 : gpu_preferences_(gpu_preferences), | 68 : gpu_preferences_(gpu_preferences), |
| 68 mailbox_manager_(mailbox_manager), | 69 mailbox_manager_(mailbox_manager), |
| 69 memory_tracker_(memory_tracker), | 70 memory_tracker_(memory_tracker), |
| 70 shader_translator_cache_(shader_translator_cache), | 71 shader_translator_cache_(shader_translator_cache), |
| 71 #if defined(OS_MACOSX) | 72 #if defined(OS_MACOSX) |
| 72 // Framebuffer completeness is not cacheable on OS X because of dynamic | 73 // Framebuffer completeness is not cacheable on OS X because of dynamic |
| 73 // graphics switching. | 74 // graphics switching. |
| 74 // http://crbug.com/180876 | 75 // http://crbug.com/180876 |
| 75 // TODO(tobiasjs): determine whether GPU switching is possible | 76 // TODO(tobiasjs): determine whether GPU switching is possible |
| 76 // programmatically, rather than just hardcoding this behaviour | 77 // programmatically, rather than just hardcoding this behaviour |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 max_draw_buffers_(1u), | 93 max_draw_buffers_(1u), |
| 93 max_dual_source_draw_buffers_(0u), | 94 max_dual_source_draw_buffers_(0u), |
| 94 max_vertex_output_components_(0u), | 95 max_vertex_output_components_(0u), |
| 95 max_fragment_input_components_(0u), | 96 max_fragment_input_components_(0u), |
| 96 min_program_texel_offset_(0), | 97 min_program_texel_offset_(0), |
| 97 max_program_texel_offset_(0), | 98 max_program_texel_offset_(0), |
| 98 max_transform_feedback_separate_attribs_(0u), | 99 max_transform_feedback_separate_attribs_(0u), |
| 99 max_uniform_buffer_bindings_(0u), | 100 max_uniform_buffer_bindings_(0u), |
| 100 uniform_buffer_offset_alignment_(1u), | 101 uniform_buffer_offset_alignment_(1u), |
| 101 program_cache_(NULL), | 102 program_cache_(NULL), |
| 102 feature_info_(feature_info) { | 103 feature_info_(feature_info), |
| 104 image_factory_(image_factory) { |
| 103 { | 105 { |
| 104 DCHECK(feature_info_); | 106 DCHECK(feature_info_); |
| 105 if (!mailbox_manager_.get()) | 107 if (!mailbox_manager_.get()) |
| 106 mailbox_manager_ = new MailboxManagerImpl; | 108 mailbox_manager_ = new MailboxManagerImpl; |
| 107 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); | 109 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 | 112 |
| 111 bool ContextGroup::Initialize(GLES2Decoder* decoder, | 113 bool ContextGroup::Initialize(GLES2Decoder* decoder, |
| 112 ContextType context_type, | 114 ContextType context_type, |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 GLuint client_id, GLuint* service_id) const { | 594 GLuint client_id, GLuint* service_id) const { |
| 593 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 595 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 594 if (!buffer) | 596 if (!buffer) |
| 595 return false; | 597 return false; |
| 596 *service_id = buffer->service_id(); | 598 *service_id = buffer->service_id(); |
| 597 return true; | 599 return true; |
| 598 } | 600 } |
| 599 | 601 |
| 600 } // namespace gles2 | 602 } // namespace gles2 |
| 601 } // namespace gpu | 603 } // namespace gpu |
| OLD | NEW |