diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 23:03:47 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 23:03:47 +0000 |
commit | a93bb846c70d2491171bd7211d24f6f0fa56e853 (patch) | |
tree | 8cb20ea75cf5f9a175d756d0605ddaa302f6d751 /gpu/command_buffer/service/id_manager.h | |
parent | 024d468c601e94f26717c1ddc68f68cfcdf4c23c (diff) | |
download | chromium_src-a93bb846c70d2491171bd7211d24f6f0fa56e853.zip chromium_src-a93bb846c70d2491171bd7211d24f6f0fa56e853.tar.gz chromium_src-a93bb846c70d2491171bd7211d24f6f0fa56e853.tar.bz2 |
Adds texture tracking.
I need to add a bunch more unit tests for the TextureManager
but this CL is getting large so if you don't mind I'll
do that in the next CL.
I still need to use the texture tracking at draw time but
that's going to require uniform tracking! UGH!
Also breaks out a bunch of the tracking classes into their own files.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/605018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/id_manager.h')
-rw-r--r-- | gpu/command_buffer/service/id_manager.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/id_manager.h b/gpu/command_buffer/service/id_manager.h new file mode 100644 index 0000000..5c5f603 --- /dev/null +++ b/gpu/command_buffer/service/id_manager.h @@ -0,0 +1,50 @@ +// 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_ID_MANAGER_H_ +#define GPU_COMMAND_BUFFER_SERVICE_ID_MANAGER_H_ + +#include <map> +#include "base/basictypes.h" +#include "gpu/command_buffer/service/gl_utils.h" + +namespace gpu { +namespace gles2 { + +// This class maps one set of ids to another. +// +// NOTE: To support shared resources an instance of this class will +// need to be shared by multiple GLES2Decoders. +class IdManager { + public: + IdManager() { }; + + // Maps a client_id to a service_id. Return false if the client_id or + // service_id are already mapped to something else. + bool AddMapping(GLuint client_id, GLuint service_id); + + // Unmaps a pair of ids. Returns false if the pair were not previously mapped. + bool RemoveMapping(GLuint client_id, GLuint service_id); + + // Gets the corresponding service_id for the given client_id. + // Returns false if there is no corresponding service_id. + bool GetServiceId(GLuint client_id, GLuint* service_id); + + // Gets the corresponding client_id for the given service_id. + // Returns false if there is no corresponding client_id. + bool GetClientId(GLuint service_id, GLuint* client_id); + + private: + // TODO(gman): Replace with faster implementation. + typedef std::map<GLuint, GLuint> MapType; + MapType id_map_; + + DISALLOW_COPY_AND_ASSIGN(IdManager); +}; + +} // namespace gles2 +} // namespace gpu + +#endif // GPU_COMMAND_BUFFER_SERVICE_ID_MANAGER_H_ + |