mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibGL: Implement glAttachShader
This commit is contained in:
parent
42ef5c9e12
commit
7f062e35a4
4 changed files with 43 additions and 4 deletions
|
@ -95,8 +95,16 @@ void GLContext::gl_delete_program(GLuint program)
|
|||
|
||||
void GLContext::gl_attach_shader(GLuint program, GLuint shader)
|
||||
{
|
||||
dbgln("gl_attach_shader({}, {}) unimplemented ", program, shader);
|
||||
TODO();
|
||||
auto program_it = m_allocated_programs.find(program);
|
||||
auto shader_it = m_allocated_shaders.find(shader);
|
||||
// FIXME: implement check "GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL."
|
||||
RETURN_WITH_ERROR_IF(program_it == m_allocated_programs.end(), GL_INVALID_OPERATION);
|
||||
RETURN_WITH_ERROR_IF(shader_it == m_allocated_shaders.end(), GL_INVALID_OPERATION);
|
||||
|
||||
// NOTE: attach_result is Error if the shader is already attached to this program
|
||||
auto attach_result = program_it->value->attach_shader(*shader_it->value);
|
||||
RETURN_WITH_ERROR_IF(attach_result.is_error() && attach_result.error().is_errno() && attach_result.error().code() == ENOMEM, GL_OUT_OF_MEMORY);
|
||||
RETURN_WITH_ERROR_IF(attach_result.is_error(), GL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
void GLContext::gl_link_program(GLuint program)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue