mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibGL: Implement glCreateProgram and glDeleteProgram
This commit is contained in:
parent
a0adbfbf81
commit
962d088e4e
1 changed files with 15 additions and 5 deletions
|
@ -52,15 +52,25 @@ void GLContext::gl_compile_shader(GLuint shader)
|
||||||
|
|
||||||
GLuint GLContext::gl_create_program()
|
GLuint GLContext::gl_create_program()
|
||||||
{
|
{
|
||||||
dbgln("gl_create_program() unimplemented ");
|
GLuint program_name;
|
||||||
TODO();
|
m_program_name_allocator.allocate(1, &program_name);
|
||||||
return 0;
|
auto program = Program::create();
|
||||||
|
m_allocated_programs.set(program_name, program);
|
||||||
|
return program_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::gl_delete_program(GLuint program)
|
void GLContext::gl_delete_program(GLuint program)
|
||||||
{
|
{
|
||||||
dbgln("gl_delete_program({}) unimplemented ", program);
|
// "A value of 0 for program will be silently ignored." (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDeleteProgram.xhtml)
|
||||||
TODO();
|
if (program == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto it = m_allocated_programs.find(program);
|
||||||
|
RETURN_WITH_ERROR_IF(it == m_allocated_programs.end(), GL_INVALID_VALUE);
|
||||||
|
|
||||||
|
// FIXME: According to the spec, we should only flag the program for deletion here and delete it once it is not used anymore.
|
||||||
|
m_allocated_programs.remove(it);
|
||||||
|
m_program_name_allocator.free(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::gl_attach_shader(GLuint program, GLuint shader)
|
void GLContext::gl_attach_shader(GLuint program, GLuint shader)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue