ladybird/Userland/Libraries/LibGL/Tex/NameAllocator.h
Jelle Raaijmakers 7ad70f623e LibGL: Make glDeleteTextures skip over 0 names
As stated in the manual:
     glDeleteTextures silently ignores 0's and names that do not
     correspond to existing textures.

If we do not skip these 0 names, they end up as invalid free texture
names in our name allocator.
2021-12-11 23:15:24 +01:00

26 lines
447 B
C++

/*
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Stack.h>
#include <LibGL/GL/gl.h>
namespace GL {
class TextureNameAllocator {
public:
TextureNameAllocator() = default;
void allocate(GLsizei count, GLuint* textures);
void free(GLuint texture);
private:
Stack<GLuint, 512> m_free_texture_names;
GLuint m_last_texture_id { 1 };
};
}