Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: gpu/command_buffer/service/context_group.cc

Issue 2818993002: GL Implementation for GPU Discardable
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/gles2_cmd_decoder_passthrough.h"
17 #include "gpu/command_buffer/service/gpu_preferences.h" 17 #include "gpu/command_buffer/service/gpu_preferences.h"
18 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 18 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
19 #include "gpu/command_buffer/service/path_manager.h" 19 #include "gpu/command_buffer/service/path_manager.h"
20 #include "gpu/command_buffer/service/program_manager.h" 20 #include "gpu/command_buffer/service/program_manager.h"
21 #include "gpu/command_buffer/service/progress_reporter.h" 21 #include "gpu/command_buffer/service/progress_reporter.h"
22 #include "gpu/command_buffer/service/renderbuffer_manager.h" 22 #include "gpu/command_buffer/service/renderbuffer_manager.h"
23 #include "gpu/command_buffer/service/sampler_manager.h" 23 #include "gpu/command_buffer/service/sampler_manager.h"
24 #include "gpu/command_buffer/service/service_discardable_manager.h"
24 #include "gpu/command_buffer/service/shader_manager.h" 25 #include "gpu/command_buffer/service/shader_manager.h"
25 #include "gpu/command_buffer/service/texture_manager.h" 26 #include "gpu/command_buffer/service/texture_manager.h"
26 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 27 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
27 #include "ui/gl/gl_bindings.h" 28 #include "ui/gl/gl_bindings.h"
28 #include "ui/gl/gl_version_info.h" 29 #include "ui/gl/gl_version_info.h"
29 30
30 namespace gpu { 31 namespace gpu {
31 namespace gles2 { 32 namespace gles2 {
32 33
33 namespace { 34 namespace {
(...skipping 28 matching lines...) Expand all
62 const GpuPreferences& gpu_preferences, 63 const GpuPreferences& gpu_preferences,
63 const scoped_refptr<MailboxManager>& mailbox_manager, 64 const scoped_refptr<MailboxManager>& mailbox_manager,
64 const scoped_refptr<MemoryTracker>& memory_tracker, 65 const scoped_refptr<MemoryTracker>& memory_tracker,
65 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, 66 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache,
66 const scoped_refptr<FramebufferCompletenessCache>& 67 const scoped_refptr<FramebufferCompletenessCache>&
67 framebuffer_completeness_cache, 68 framebuffer_completeness_cache,
68 const scoped_refptr<FeatureInfo>& feature_info, 69 const scoped_refptr<FeatureInfo>& feature_info,
69 bool bind_generates_resource, 70 bool bind_generates_resource,
70 gpu::ImageFactory* image_factory, 71 gpu::ImageFactory* image_factory,
71 ProgressReporter* progress_reporter, 72 ProgressReporter* progress_reporter,
72 const GpuFeatureInfo& gpu_feature_info) 73 const GpuFeatureInfo& gpu_feature_info,
74 const scoped_refptr<ServiceDiscardableManager>& discardable_manager)
73 : gpu_preferences_(gpu_preferences), 75 : gpu_preferences_(gpu_preferences),
74 mailbox_manager_(mailbox_manager), 76 mailbox_manager_(mailbox_manager),
75 memory_tracker_(memory_tracker), 77 memory_tracker_(memory_tracker),
76 shader_translator_cache_(shader_translator_cache), 78 shader_translator_cache_(shader_translator_cache),
77 #if defined(OS_MACOSX) 79 #if defined(OS_MACOSX)
78 // Framebuffer completeness is not cacheable on OS X because of dynamic 80 // Framebuffer completeness is not cacheable on OS X because of dynamic
79 // graphics switching. 81 // graphics switching.
80 // http://crbug.com/180876 82 // http://crbug.com/180876
81 // TODO(tobiasjs): determine whether GPU switching is possible 83 // TODO(tobiasjs): determine whether GPU switching is possible
82 // programmatically, rather than just hardcoding this behaviour 84 // programmatically, rather than just hardcoding this behaviour
(...skipping 19 matching lines...) Expand all
102 min_program_texel_offset_(0), 104 min_program_texel_offset_(0),
103 max_program_texel_offset_(0), 105 max_program_texel_offset_(0),
104 max_transform_feedback_separate_attribs_(0u), 106 max_transform_feedback_separate_attribs_(0u),
105 max_uniform_buffer_bindings_(0u), 107 max_uniform_buffer_bindings_(0u),
106 uniform_buffer_offset_alignment_(1u), 108 uniform_buffer_offset_alignment_(1u),
107 program_cache_(NULL), 109 program_cache_(NULL),
108 feature_info_(feature_info), 110 feature_info_(feature_info),
109 image_factory_(image_factory), 111 image_factory_(image_factory),
110 passthrough_resources_(new PassthroughResources), 112 passthrough_resources_(new PassthroughResources),
111 progress_reporter_(progress_reporter), 113 progress_reporter_(progress_reporter),
112 gpu_feature_info_(gpu_feature_info) { 114 gpu_feature_info_(gpu_feature_info),
115 discardable_manager_(discardable_manager) {
113 { 116 {
117 CHECK(discardable_manager);
114 DCHECK(feature_info_); 118 DCHECK(feature_info_);
115 if (!mailbox_manager_.get()) 119 if (!mailbox_manager_.get())
116 mailbox_manager_ = new MailboxManagerImpl; 120 mailbox_manager_ = new MailboxManagerImpl;
117 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); 121 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get());
118 } 122 }
119 } 123 }
120 124
121 bool ContextGroup::Initialize(GLES2Decoder* decoder, 125 bool ContextGroup::Initialize(GLES2Decoder* decoder,
122 ContextType context_type, 126 ContextType context_type,
123 const DisallowedFeatures& disallowed_features) { 127 const DisallowedFeatures& disallowed_features) {
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 GLuint client_id, GLuint* service_id) const { 633 GLuint client_id, GLuint* service_id) const {
630 Buffer* buffer = buffer_manager_->GetBuffer(client_id); 634 Buffer* buffer = buffer_manager_->GetBuffer(client_id);
631 if (!buffer) 635 if (!buffer)
632 return false; 636 return false;
633 *service_id = buffer->service_id(); 637 *service_id = buffer->service_id();
634 return true; 638 return true;
635 } 639 }
636 640
637 } // namespace gles2 641 } // namespace gles2
638 } // namespace gpu 642 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group.h ('k') | gpu/command_buffer/service/context_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698