From b455e6ca0d84c73d28fc990975655a2158aea1b8 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 24 Dec 2021 14:46:45 +0100 Subject: [PATCH] LibGL: Stub `glClear` support for stencil buffer Previously, if the client supplied `GL_STENCIL_BUFFER_BIT`, `glClear` would return an error. Since it is a valid parameter, we now continue and report that this parameter is unimplemented instead. --- Userland/Libraries/LibGL/SoftwareGLContext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 2aad429270..d786b2f01d 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -181,7 +181,7 @@ void SoftwareGLContext::gl_clear(GLbitfield mask) APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_clear, mask); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); - RETURN_WITH_ERROR_IF(mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT), GL_INVALID_ENUM); + RETURN_WITH_ERROR_IF(mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT), GL_INVALID_ENUM); if (mask & GL_COLOR_BUFFER_BIT) m_rasterizer.clear_color(m_clear_color); @@ -190,6 +190,8 @@ void SoftwareGLContext::gl_clear(GLbitfield mask) m_rasterizer.clear_depth(static_cast(m_clear_depth)); // FIXME: implement GL_STENCIL_BUFFER_BIT + if (mask & GL_STENCIL_BUFFER_BIT) + dbgln_if(GL_DEBUG, "gl_clear(): GL_STENCIL_BUFFER_BIT is unimplemented"); } void SoftwareGLContext::gl_clear_color(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)