diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 02:57:58 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 02:57:58 +0000 |
commit | a25fa87a6cf2d10414454d8b8ad75ffeb13fb2cd (patch) | |
tree | ec191648b64ae8d31baee4f5f437535d3e0e0615 /gpu/command_buffer/service/renderbuffer_manager.h | |
parent | 319cedc65c0a9ffe5c3515b066b65f07d1fd7258 (diff) | |
download | chromium_src-a25fa87a6cf2d10414454d8b8ad75ffeb13fb2cd.zip chromium_src-a25fa87a6cf2d10414454d8b8ad75ffeb13fb2cd.tar.gz chromium_src-a25fa87a6cf2d10414454d8b8ad75ffeb13fb2cd.tar.bz2 |
Adds renderbuffer and framebuffer tracking so we can
clear the buffers.
Note: I did not actually write the clearing code
or the binding code. Will do in another CL after
Al checks in his code.
TEST=unit tests
BUG=none
Review URL: http://codereview.chromium.org/1243002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42577 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/renderbuffer_manager.h')
-rw-r--r-- | gpu/command_buffer/service/renderbuffer_manager.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h new file mode 100644 index 0000000..47c5282 --- /dev/null +++ b/gpu/command_buffer/service/renderbuffer_manager.h @@ -0,0 +1,90 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ +#define GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ + +#include <map> +#include "base/basictypes.h" +#include "base/logging.h" +#include "base/ref_counted.h" +#include "base/scoped_ptr.h" +#include "gpu/command_buffer/service/gl_utils.h" + +namespace gpu { +namespace gles2 { + +// This class keeps track of the renderbuffers and whether or not they have +// been cleared. +class RenderbufferManager { + public: + // Info about Renderbuffers currently in the system. + class RenderbufferInfo : public base::RefCounted<RenderbufferInfo> { + public: + typedef scoped_refptr<RenderbufferInfo> Ref; + + explicit RenderbufferInfo(GLuint renderbuffer_id) + : renderbuffer_id_(renderbuffer_id), + cleared_(false) { + } + + GLuint renderbuffer_id() const { + return renderbuffer_id_; + } + + bool cleared() const { + return cleared_; + } + + void set_cleared() { + cleared_ = true; + } + + bool IsDeleted() { + return renderbuffer_id_ == 0; + } + + private: + friend class RenderbufferManager; + friend class base::RefCounted<RenderbufferInfo>; + + ~RenderbufferInfo() { } + + void MarkAsDeleted() { + renderbuffer_id_ = 0; + } + + // Service side renderbuffer id. + GLuint renderbuffer_id_; + + // Whether this renderbuffer has been cleared + bool cleared_; + }; + + RenderbufferManager() { } + + // Creates a RenderbufferInfo for the given renderbuffer. + void CreateRenderbufferInfo(GLuint renderbuffer_id); + + // Gets the renderbuffer info for the given renderbuffer. + RenderbufferInfo* GetRenderbufferInfo(GLuint renderbuffer_id); + + // Removes a renderbuffer info for the given renderbuffer. + void RemoveRenderbufferInfo(GLuint renderbuffer_id); + + private: + // Info for each renderbuffer in the system. + // TODO(gman): Choose a faster container. + typedef std::map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap; + RenderbufferInfoMap renderbuffer_infos_; + + DISALLOW_COPY_AND_ASSIGN(RenderbufferManager); +}; + +} // namespace gles2 +} // namespace gpu + +#endif // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_ + + |