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

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

Issue 1747013: Changes the code to use separate ids namspaces... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_RENDERBUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "gpu/command_buffer/service/gl_utils.h" 13 #include "gpu/command_buffer/service/gl_utils.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 namespace gles2 { 16 namespace gles2 {
17 17
18 // This class keeps track of the renderbuffers and whether or not they have 18 // This class keeps track of the renderbuffers and whether or not they have
19 // been cleared. 19 // been cleared.
20 class RenderbufferManager { 20 class RenderbufferManager {
21 public: 21 public:
22 // Info about Renderbuffers currently in the system. 22 // Info about Renderbuffers currently in the system.
23 class RenderbufferInfo : public base::RefCounted<RenderbufferInfo> { 23 class RenderbufferInfo : public base::RefCounted<RenderbufferInfo> {
24 public: 24 public:
25 typedef scoped_refptr<RenderbufferInfo> Ref; 25 typedef scoped_refptr<RenderbufferInfo> Ref;
26 26
27 explicit RenderbufferInfo(GLuint renderbuffer_id) 27 explicit RenderbufferInfo(GLuint service_id)
28 : renderbuffer_id_(renderbuffer_id), 28 : service_id_(service_id),
29 cleared_(false) { 29 cleared_(false) {
30 } 30 }
31 31
32 GLuint renderbuffer_id() const { 32 GLuint service_id() const {
33 return renderbuffer_id_; 33 return service_id_;
34 } 34 }
35 35
36 bool cleared() const { 36 bool cleared() const {
37 return cleared_; 37 return cleared_;
38 } 38 }
39 39
40 void set_cleared() { 40 void set_cleared() {
41 cleared_ = true; 41 cleared_ = true;
42 } 42 }
43 43
44 bool IsDeleted() { 44 bool IsDeleted() {
45 return renderbuffer_id_ == 0; 45 return service_id_ == 0;
46 } 46 }
47 47
48 private: 48 private:
49 friend class RenderbufferManager; 49 friend class RenderbufferManager;
50 friend class base::RefCounted<RenderbufferInfo>; 50 friend class base::RefCounted<RenderbufferInfo>;
51 51
52 ~RenderbufferInfo() { } 52 ~RenderbufferInfo() { }
53 53
54 void MarkAsDeleted() { 54 void MarkAsDeleted() {
55 renderbuffer_id_ = 0; 55 service_id_ = 0;
56 } 56 }
57 57
58 // Service side renderbuffer id. 58 // Service side renderbuffer id.
59 GLuint renderbuffer_id_; 59 GLuint service_id_;
60 60
61 // Whether this renderbuffer has been cleared 61 // Whether this renderbuffer has been cleared
62 bool cleared_; 62 bool cleared_;
63 }; 63 };
64 64
65 RenderbufferManager() { } 65 RenderbufferManager() { }
66 66
67 // Creates a RenderbufferInfo for the given renderbuffer. 67 // Creates a RenderbufferInfo for the given renderbuffer.
68 void CreateRenderbufferInfo(GLuint renderbuffer_id); 68 void CreateRenderbufferInfo(GLuint client_id, GLuint service_id);
69 69
70 // Gets the renderbuffer info for the given renderbuffer. 70 // Gets the renderbuffer info for the given renderbuffer.
71 RenderbufferInfo* GetRenderbufferInfo(GLuint renderbuffer_id); 71 RenderbufferInfo* GetRenderbufferInfo(GLuint client_id);
72 72
73 // Removes a renderbuffer info for the given renderbuffer. 73 // Removes a renderbuffer info for the given renderbuffer.
74 void RemoveRenderbufferInfo(GLuint renderbuffer_id); 74 void RemoveRenderbufferInfo(GLuint client_id);
75 75
76 private: 76 private:
77 // Info for each renderbuffer in the system. 77 // Info for each renderbuffer in the system.
78 // TODO(gman): Choose a faster container. 78 // TODO(gman): Choose a faster container.
79 typedef std::map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap; 79 typedef std::map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap;
80 RenderbufferInfoMap renderbuffer_infos_; 80 RenderbufferInfoMap renderbuffer_infos_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(RenderbufferManager); 82 DISALLOW_COPY_AND_ASSIGN(RenderbufferManager);
83 }; 83 };
84 84
85 } // namespace gles2 85 } // namespace gles2
86 } // namespace gpu 86 } // namespace gpu
87 87
88 #endif // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ 88 #endif // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_
89 89
90 90
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager_unittest.cc ('k') | gpu/command_buffer/service/renderbuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698