From 42ef5c9e12a1e51b4ff84cc0f47f7328198d0471 Mon Sep 17 00:00:00 2001 From: Stephan Unverwerth Date: Sun, 28 Aug 2022 11:19:36 +0200 Subject: [PATCH] LibGL: Implement glCompileShader --- Userland/Libraries/LibGL/Shader.cpp | 8 ++++++-- Userland/Libraries/LibGL/Shaders/Shader.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGL/Shader.cpp b/Userland/Libraries/LibGL/Shader.cpp index 52c6a57edc..5e9c8f39de 100644 --- a/Userland/Libraries/LibGL/Shader.cpp +++ b/Userland/Libraries/LibGL/Shader.cpp @@ -62,8 +62,12 @@ void GLContext::gl_shader_source(GLuint shader, GLsizei count, GLchar const** st void GLContext::gl_compile_shader(GLuint shader) { - dbgln("gl_compile_shader({}) unimplemented ", shader); - TODO(); + auto it = m_allocated_shaders.find(shader); + // FIXME: implement check "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL." + RETURN_WITH_ERROR_IF(it == m_allocated_shaders.end(), GL_INVALID_OPERATION); + + // NOTE: We are ignoring the compilation result here since it is tracked inside the shader object + (void)it->value->compile(); } GLuint GLContext::gl_create_program() diff --git a/Userland/Libraries/LibGL/Shaders/Shader.h b/Userland/Libraries/LibGL/Shaders/Shader.h index c4a1a7d70f..9b5c30c8ef 100644 --- a/Userland/Libraries/LibGL/Shaders/Shader.h +++ b/Userland/Libraries/LibGL/Shaders/Shader.h @@ -24,6 +24,7 @@ public: ErrorOr add_source(StringView source_code); ErrorOr compile(); GLenum type() const { return m_type; } + bool compile_status() const { return m_compile_status; } private: explicit Shader(GLenum shader_type) @@ -33,6 +34,7 @@ private: Vector m_sources; GLenum m_type; + bool m_compile_status { false }; }; }