summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-01-19 22:50:16 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-20 10:35:01 +0100
commitc5abef86dbb980ac736825de3705a4122f7e66b6 (patch)
tree634bb6bb16e0af902207fdb465a3038d9b80b932 /Userland/Libraries/LibGL
parent453f62c935a8c6b282d4a605dfd2007185d9e3d7 (diff)
downloadserenity-c5abef86dbb980ac736825de3705a4122f7e66b6.zip
LibGL: Stub `GL_BACK` implementation for `glPolygonMode`
This prevents overwriting the front face mode when providing `GL_BACK` as a parameter.
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index dc310e6721..a00f0c8fdc 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -2548,18 +2548,25 @@ void SoftwareGLContext::gl_polygon_mode(GLenum face, GLenum mode)
auto options = m_rasterizer.options();
// FIXME: This must support different polygon modes for front- and backside
- switch (mode) {
- case GL_POINT:
- options.polygon_mode = SoftGPU::PolygonMode::Point;
- break;
- case GL_LINE:
- options.polygon_mode = SoftGPU::PolygonMode::Line;
- break;
- case GL_FILL:
- options.polygon_mode = SoftGPU::PolygonMode::Fill;
- break;
+ if (face == GL_BACK) {
+ dbgln_if(GL_DEBUG, "gl_polygon_mode(GL_BACK, {:#x}): unimplemented", mode);
+ return;
}
+ auto map_mode = [](GLenum mode) -> SoftGPU::PolygonMode {
+ switch (mode) {
+ case GL_FILL:
+ return SoftGPU::PolygonMode::Fill;
+ case GL_LINE:
+ return SoftGPU::PolygonMode::Line;
+ case GL_POINT:
+ return SoftGPU::PolygonMode::Point;
+ default:
+ VERIFY_NOT_REACHED();
+ }
+ };
+
+ options.polygon_mode = map_mode(mode);
m_rasterizer.set_options(options);
}