diff options
Diffstat (limited to 'gpu/command_buffer/service/renderbuffer_manager.cc')
-rw-r--r-- | gpu/command_buffer/service/renderbuffer_manager.cc | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/gpu/command_buffer/service/renderbuffer_manager.cc b/gpu/command_buffer/service/renderbuffer_manager.cc index a12d66e..5c9ca30 100644 --- a/gpu/command_buffer/service/renderbuffer_manager.cc +++ b/gpu/command_buffer/service/renderbuffer_manager.cc @@ -13,7 +13,8 @@ namespace gles2 { RenderbufferManager::RenderbufferManager( GLint max_renderbuffer_size, GLint max_samples) : max_renderbuffer_size_(max_renderbuffer_size), - max_samples_(max_samples) { + max_samples_(max_samples), + num_uncleared_renderbuffers_(0) { } RenderbufferManager::~RenderbufferManager() { @@ -34,14 +35,39 @@ void RenderbufferManager::Destroy(bool have_context) { } } +void RenderbufferManager::SetInfo( + RenderbufferInfo* renderbuffer, + GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + DCHECK(renderbuffer); + if (!renderbuffer->cleared()) { + --num_uncleared_renderbuffers_; + } + renderbuffer->SetInfo(samples, internalformat, width, height); + if (!renderbuffer->cleared()) { + ++num_uncleared_renderbuffers_; + } +} + +void RenderbufferManager::SetCleared(RenderbufferInfo* renderbuffer) { + DCHECK(renderbuffer); + if (!renderbuffer->cleared()) { + --num_uncleared_renderbuffers_; + } + renderbuffer->set_cleared(); + if (!renderbuffer->cleared()) { + ++num_uncleared_renderbuffers_; + } +} + void RenderbufferManager::CreateRenderbufferInfo( GLuint client_id, GLuint service_id) { + RenderbufferInfo::Ref info(new RenderbufferInfo(service_id)); std::pair<RenderbufferInfoMap::iterator, bool> result = - renderbuffer_infos_.insert( - std::make_pair( - client_id, - RenderbufferInfo::Ref(new RenderbufferInfo(service_id)))); + renderbuffer_infos_.insert(std::make_pair(client_id, info)); DCHECK(result.second); + if (!info->cleared()) { + ++num_uncleared_renderbuffers_; + } } RenderbufferManager::RenderbufferInfo* RenderbufferManager::GetRenderbufferInfo( @@ -53,7 +79,11 @@ RenderbufferManager::RenderbufferInfo* RenderbufferManager::GetRenderbufferInfo( void RenderbufferManager::RemoveRenderbufferInfo(GLuint client_id) { RenderbufferInfoMap::iterator it = renderbuffer_infos_.find(client_id); if (it != renderbuffer_infos_.end()) { - it->second->MarkAsDeleted(); + RenderbufferInfo* info = it->second; + if (!info->cleared()) { + --num_uncleared_renderbuffers_; + } + info->MarkAsDeleted(); renderbuffer_infos_.erase(it); } } |