Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | // HandleAllocator.h: Defines the gl::HandleAllocator class, which is used to |
michael@0 | 8 | // allocate GL handles. |
michael@0 | 9 | |
michael@0 | 10 | #ifndef LIBGLESV2_HANDLEALLOCATOR_H_ |
michael@0 | 11 | #define LIBGLESV2_HANDLEALLOCATOR_H_ |
michael@0 | 12 | |
michael@0 | 13 | #define GL_APICALL |
michael@0 | 14 | #include <GLES2/gl2.h> |
michael@0 | 15 | |
michael@0 | 16 | #include <vector> |
michael@0 | 17 | |
michael@0 | 18 | #include "common/angleutils.h" |
michael@0 | 19 | |
michael@0 | 20 | namespace gl |
michael@0 | 21 | { |
michael@0 | 22 | |
michael@0 | 23 | class HandleAllocator |
michael@0 | 24 | { |
michael@0 | 25 | public: |
michael@0 | 26 | HandleAllocator(); |
michael@0 | 27 | virtual ~HandleAllocator(); |
michael@0 | 28 | |
michael@0 | 29 | void setBaseHandle(GLuint value); |
michael@0 | 30 | |
michael@0 | 31 | GLuint allocate(); |
michael@0 | 32 | void release(GLuint handle); |
michael@0 | 33 | |
michael@0 | 34 | private: |
michael@0 | 35 | DISALLOW_COPY_AND_ASSIGN(HandleAllocator); |
michael@0 | 36 | |
michael@0 | 37 | GLuint mBaseValue; |
michael@0 | 38 | GLuint mNextValue; |
michael@0 | 39 | typedef std::vector<GLuint> HandleList; |
michael@0 | 40 | HandleList mFreeValues; |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | #endif // LIBGLESV2_HANDLEALLOCATOR_H_ |