| 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 #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 <string> | 8 #include <string> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Removes a renderbuffer info for the given renderbuffer. | 163 // Removes a renderbuffer info for the given renderbuffer. |
| 164 void RemoveRenderbufferInfo(GLuint client_id); | 164 void RemoveRenderbufferInfo(GLuint client_id); |
| 165 | 165 |
| 166 // Gets a client id for a given service id. | 166 // Gets a client id for a given service id. |
| 167 bool GetClientId(GLuint service_id, GLuint* client_id) const; | 167 bool GetClientId(GLuint service_id, GLuint* client_id) const; |
| 168 | 168 |
| 169 size_t mem_represented() const { | 169 size_t mem_represented() const { |
| 170 return memory_tracker_->GetMemRepresented(); | 170 return memory_tracker_->GetMemRepresented(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 static bool ComputeEstimatedRenderbufferSize( |
| 174 int width, int height, int samples, int internal_format, uint32* size); |
| 175 static GLenum InternalRenderbufferFormatToImplFormat(GLenum impl_format); |
| 176 |
| 173 private: | 177 private: |
| 174 void StartTracking(RenderbufferInfo* renderbuffer); | 178 void StartTracking(RenderbufferInfo* renderbuffer); |
| 175 void StopTracking(RenderbufferInfo* renderbuffer); | 179 void StopTracking(RenderbufferInfo* renderbuffer); |
| 176 | 180 |
| 177 scoped_ptr<MemoryTypeTracker> memory_tracker_; | 181 scoped_ptr<MemoryTypeTracker> memory_tracker_; |
| 178 | 182 |
| 179 GLint max_renderbuffer_size_; | 183 GLint max_renderbuffer_size_; |
| 180 GLint max_samples_; | 184 GLint max_samples_; |
| 181 | 185 |
| 182 int num_uncleared_renderbuffers_; | 186 int num_uncleared_renderbuffers_; |
| 183 | 187 |
| 184 // Counts the number of RenderbufferInfo allocated with 'this' as its manager. | 188 // Counts the number of RenderbufferInfo allocated with 'this' as its manager. |
| 185 // Allows to check no RenderbufferInfo will outlive this. | 189 // Allows to check no RenderbufferInfo will outlive this. |
| 186 unsigned renderbuffer_info_count_; | 190 unsigned renderbuffer_info_count_; |
| 187 | 191 |
| 188 bool have_context_; | 192 bool have_context_; |
| 189 | 193 |
| 190 // Info for each renderbuffer in the system. | 194 // Info for each renderbuffer in the system. |
| 191 typedef base::hash_map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap; | 195 typedef base::hash_map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap; |
| 192 RenderbufferInfoMap renderbuffer_infos_; | 196 RenderbufferInfoMap renderbuffer_infos_; |
| 193 | 197 |
| 194 DISALLOW_COPY_AND_ASSIGN(RenderbufferManager); | 198 DISALLOW_COPY_AND_ASSIGN(RenderbufferManager); |
| 195 }; | 199 }; |
| 196 | 200 |
| 197 } // namespace gles2 | 201 } // namespace gles2 |
| 198 } // namespace gpu | 202 } // namespace gpu |
| 199 | 203 |
| 200 #endif // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ | 204 #endif // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ |
| OLD | NEW |