1// 2// Copyright (c) 2002-2011 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. 5// 6 7// HandleAllocator.h: Defines the gl::HandleAllocator class, which is used to 8// allocate GL handles. 9 10#ifndef LIBGLESV2_HANDLEALLOCATOR_H_ 11#define LIBGLESV2_HANDLEALLOCATOR_H_ 12 13#include "common/angleutils.h" 14 15#include "angle_gl.h" 16 17#include <vector> 18 19namespace gl 20{ 21 22class HandleAllocator 23{ 24 public: 25 HandleAllocator(); 26 virtual ~HandleAllocator(); 27 28 void setBaseHandle(GLuint value); 29 30 GLuint allocate(); 31 void release(GLuint handle); 32 33 private: 34 DISALLOW_COPY_AND_ASSIGN(HandleAllocator); 35 36 GLuint mBaseValue; 37 GLuint mNextValue; 38 typedef std::vector<GLuint> HandleList; 39 HandleList mFreeValues; 40}; 41 42} 43 44#endif // LIBGLESV2_HANDLEALLOCATOR_H_ 45