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

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

Issue 1498033003: Implement SamplerManager in the command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more tweak from zmo@'s feedback Created 5 years 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 16 matching lines...) Expand all
27 namespace gles2 { 27 namespace gles2 {
28 28
29 class ProgramCache; 29 class ProgramCache;
30 class BufferManager; 30 class BufferManager;
31 class GLES2Decoder; 31 class GLES2Decoder;
32 class FramebufferManager; 32 class FramebufferManager;
33 class MailboxManager; 33 class MailboxManager;
34 class RenderbufferManager; 34 class RenderbufferManager;
35 class PathManager; 35 class PathManager;
36 class ProgramManager; 36 class ProgramManager;
37 class SamplerManager;
37 class ShaderManager; 38 class ShaderManager;
38 class TextureManager; 39 class TextureManager;
39 class SubscriptionRefSet; 40 class SubscriptionRefSet;
40 class ValuebufferManager; 41 class ValuebufferManager;
41 class MemoryTracker; 42 class MemoryTracker;
42 struct DisallowedFeatures; 43 struct DisallowedFeatures;
43 44
44 // A Context Group helps manage multiple GLES2Decoders that share 45 // A Context Group helps manage multiple GLES2Decoders that share
45 // resources. 46 // resources.
46 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { 47 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 167 }
167 168
168 ShaderManager* shader_manager() const { 169 ShaderManager* shader_manager() const {
169 return shader_manager_.get(); 170 return shader_manager_.get();
170 } 171 }
171 172
172 TransferBufferManager* transfer_buffer_manager() const { 173 TransferBufferManager* transfer_buffer_manager() const {
173 return transfer_buffer_manager_.get(); 174 return transfer_buffer_manager_.get();
174 } 175 }
175 176
177 SamplerManager* sampler_manager() const {
178 return sampler_manager_.get();
179 }
180
176 uint32 GetMemRepresented() const; 181 uint32 GetMemRepresented() const;
177 182
178 // Loses all the context associated with this group. 183 // Loses all the context associated with this group.
179 void LoseContexts(error::ContextLostReason reason); 184 void LoseContexts(error::ContextLostReason reason);
180 185
181 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; 186 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const;
182 187
183 void AddSamplerId(GLuint client_id, GLuint service_id) {
184 samplers_id_map_[client_id] = service_id;
185 }
186
187 bool GetSamplerServiceId(GLuint client_id, GLuint* service_id) const {
188 base::hash_map<GLuint, GLuint>::const_iterator iter =
189 samplers_id_map_.find(client_id);
190 if (iter == samplers_id_map_.end())
191 return false;
192 if (service_id)
193 *service_id = iter->second;
194 return true;
195 }
196
197 void RemoveSamplerId(GLuint client_id) {
198 samplers_id_map_.erase(client_id);
199 }
200
201 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { 188 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) {
202 transformfeedbacks_id_map_[client_id] = service_id; 189 transformfeedbacks_id_map_[client_id] = service_id;
203 } 190 }
204 191
205 bool GetTransformFeedbackServiceId( 192 bool GetTransformFeedbackServiceId(
206 GLuint client_id, GLuint* service_id) const { 193 GLuint client_id, GLuint* service_id) const {
207 if (client_id == 0) { 194 if (client_id == 0) {
208 // Default one. 195 // Default one.
209 if (service_id) 196 if (service_id)
210 *service_id = 0; 197 *service_id = 0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 scoped_ptr<RenderbufferManager> renderbuffer_manager_; 268 scoped_ptr<RenderbufferManager> renderbuffer_manager_;
282 269
283 scoped_ptr<TextureManager> texture_manager_; 270 scoped_ptr<TextureManager> texture_manager_;
284 271
285 scoped_ptr<PathManager> path_manager_; 272 scoped_ptr<PathManager> path_manager_;
286 273
287 scoped_ptr<ProgramManager> program_manager_; 274 scoped_ptr<ProgramManager> program_manager_;
288 275
289 scoped_ptr<ShaderManager> shader_manager_; 276 scoped_ptr<ShaderManager> shader_manager_;
290 277
278 scoped_ptr<SamplerManager> sampler_manager_;
279
291 scoped_ptr<ValuebufferManager> valuebuffer_manager_; 280 scoped_ptr<ValuebufferManager> valuebuffer_manager_;
292 281
293 scoped_refptr<FeatureInfo> feature_info_; 282 scoped_refptr<FeatureInfo> feature_info_;
294 283
295 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; 284 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_;
296 285
297 // Mappings from client side IDs to service side IDs. 286 // Mappings from client side IDs to service side IDs.
298 base::hash_map<GLuint, GLuint> samplers_id_map_;
299 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; 287 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_;
300 base::hash_map<GLuint, GLsync> syncs_id_map_; 288 base::hash_map<GLuint, GLsync> syncs_id_map_;
301 289
302 DISALLOW_COPY_AND_ASSIGN(ContextGroup); 290 DISALLOW_COPY_AND_ASSIGN(ContextGroup);
303 }; 291 };
304 292
305 } // namespace gles2 293 } // namespace gles2
306 } // namespace gpu 294 } // namespace gpu
307 295
308 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 296 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698