summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-08-28 12:04:18 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-17 22:39:09 -0700
commitfdd76639d8ef93723fee379f0b75af47dd9d49fd (patch)
tree6df70353394ca1719acd06019d265ccba5f64ee0
parent7f062e35a4c34454be180fd2e53e02e229cba91d (diff)
downloadserenity-fdd76639d8ef93723fee379f0b75af47dd9d49fd.zip
LibGL: Implement glLinkProgram
-rw-r--r--Userland/Libraries/LibGL/Shader.cpp9
-rw-r--r--Userland/Libraries/LibGL/Shaders/Program.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGL/Shader.cpp b/Userland/Libraries/LibGL/Shader.cpp
index 01b1bbfd78..eea40ae53b 100644
--- a/Userland/Libraries/LibGL/Shader.cpp
+++ b/Userland/Libraries/LibGL/Shader.cpp
@@ -109,8 +109,13 @@ void GLContext::gl_attach_shader(GLuint program, GLuint shader)
void GLContext::gl_link_program(GLuint program)
{
- dbgln("gl_link_program({}) unimplemented ", program);
- TODO();
+ auto program_it = m_allocated_programs.find(program);
+ // FIXME: implement check "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."
+ RETURN_WITH_ERROR_IF(program_it == m_allocated_programs.end(), GL_INVALID_OPERATION);
+ // FIXME: implement check "GL_INVALID_OPERATION is generated if program is the currently active program object and transform feedback mode is active."
+
+ // NOTE: We are ignoring the link result since this is tracked inside the program object
+ (void)program_it->value->link();
}
}
diff --git a/Userland/Libraries/LibGL/Shaders/Program.h b/Userland/Libraries/LibGL/Shaders/Program.h
index 338149b9ca..3cdf377d87 100644
--- a/Userland/Libraries/LibGL/Shaders/Program.h
+++ b/Userland/Libraries/LibGL/Shaders/Program.h
@@ -21,8 +21,10 @@ public:
bool is_shader_attached(Shader const&) const;
ErrorOr<void> attach_shader(Shader&);
ErrorOr<void> link();
+ bool link_status() const { return m_link_status; }
private:
+ bool m_link_status { false };
Vector<NonnullRefPtr<Shader>> m_vertex_shaders;
Vector<NonnullRefPtr<Shader>> m_fragment_shaders;
};