1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

LibGL: Refactor TextureNameAllocator to a more general NameAllocator

This functionality can also be used for other types of objects.
This commit is contained in:
cflip 2022-11-13 15:04:55 -07:00 committed by Andreas Kling
parent 9a0bb8212a
commit 892006218a
7 changed files with 67 additions and 61 deletions

View file

@ -190,7 +190,7 @@ void GLContext::gl_delete_textures(GLsizei n, GLuint const* textures)
if (texture_object == m_allocated_textures.end() || texture_object->value.is_null())
continue;
m_name_allocator.free(name);
m_texture_name_allocator.free(name);
auto texture = texture_object->value;
@ -211,7 +211,7 @@ void GLContext::gl_gen_textures(GLsizei n, GLuint* textures)
RETURN_WITH_ERROR_IF(n < 0, GL_INVALID_VALUE);
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
m_name_allocator.allocate(n, textures);
m_texture_name_allocator.allocate(n, textures);
// Initialize all texture names with a nullptr
for (auto i = 0; i < n; ++i) {