NameAllocator.h 470 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Stack.h>
  8. #include <LibGL/GL/gl.h>
  9. namespace GL {
  10. class TextureNameAllocator {
  11. public:
  12. TextureNameAllocator() = default;
  13. void allocate(GLsizei count, GLuint* textures);
  14. void free(GLsizei count, const GLuint* textures);
  15. private:
  16. Stack<GLuint, 512> m_free_texture_names;
  17. GLuint m_last_texture_id { 1 };
  18. };
  19. }