mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +00:00
LibGL: Add Texture Name Allocation
Texture names can now be allocated via `glGenTextures` and deallocated via `glDeleteTextures`.
This commit is contained in:
parent
8a69e6714e
commit
21dff6d40b
8 changed files with 118 additions and 0 deletions
26
Userland/Libraries/LibGL/Tex/NameAllocator.h
Normal file
26
Userland/Libraries/LibGL/Tex/NameAllocator.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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(GLsizei count, const GLuint* textures);
|
||||
|
||||
private:
|
||||
Stack<GLuint, 512> m_free_texture_names;
|
||||
GLuint m_last_texture_id { 1 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue