2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 // ResourceManager.h : Defines the ResourceManager class, which tracks objects
8 // shared by multiple GL contexts.
10 #ifndef LIBGLESV2_RESOURCEMANAGER_H_
11 #define LIBGLESV2_RESOURCEMANAGER_H_
14 #include <GLES2/gl2.h>
18 #include "common/angleutils.h"
19 #include "libGLESv2/HandleAllocator.h"
53 GLuint createBuffer();
54 GLuint createShader(GLenum type);
55 GLuint createProgram();
56 GLuint createTexture();
57 GLuint createRenderbuffer();
59 void deleteBuffer(GLuint buffer);
60 void deleteShader(GLuint shader);
61 void deleteProgram(GLuint program);
62 void deleteTexture(GLuint texture);
63 void deleteRenderbuffer(GLuint renderbuffer);
65 Buffer *getBuffer(GLuint handle);
66 Shader *getShader(GLuint handle);
67 Program *getProgram(GLuint handle);
68 Texture *getTexture(GLuint handle);
69 Renderbuffer *getRenderbuffer(GLuint handle);
71 void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
73 void checkBufferAllocation(unsigned int buffer);
74 void checkTextureAllocation(GLuint texture, TextureType type);
75 void checkRenderbufferAllocation(GLuint renderbuffer);
78 DISALLOW_COPY_AND_ASSIGN(ResourceManager);
80 std::size_t mRefCount;
82 typedef stdext::hash_map<GLuint, Buffer*> BufferMap;
84 HandleAllocator mBufferHandleAllocator;
86 typedef stdext::hash_map<GLuint, Shader*> ShaderMap;
89 typedef stdext::hash_map<GLuint, Program*> ProgramMap;
90 ProgramMap mProgramMap;
91 HandleAllocator mProgramShaderHandleAllocator;
93 typedef stdext::hash_map<GLuint, Texture*> TextureMap;
94 TextureMap mTextureMap;
95 HandleAllocator mTextureHandleAllocator;
97 typedef stdext::hash_map<GLuint, Renderbuffer*> RenderbufferMap;
98 RenderbufferMap mRenderbufferMap;
99 HandleAllocator mRenderbufferHandleAllocator;
104 #endif // LIBGLESV2_RESOURCEMANAGER_H_