diff options
author | Stephan Unverwerth <s.unverwerth@serenityos.org> | 2021-12-22 23:51:28 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-24 05:10:28 -0800 |
commit | de0069188f700e3e5487e7e02adb7876ba3dd178 (patch) | |
tree | 71fbbb69c1dbbe8ae3d48376afbd19e9efd67f0f /Userland | |
parent | f4d29bf665ee98b430c4eb7b80c86824eb147db2 (diff) | |
download | serenity-de0069188f700e3e5487e7e02adb7876ba3dd178.zip |
LibSoftGPU: Remove OpenGL type for polygon mode
Replaces the GLenum used to setup polygon mode in RasterizerOptions with
our own enum.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibSoftGPU/Device.h | 8 |
2 files changed, 20 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index d73344159d..cd74afcb44 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -2293,7 +2293,19 @@ void SoftwareGLContext::gl_polygon_mode(GLenum face, GLenum mode) RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); auto options = m_rasterizer.options(); - options.polygon_mode = mode; + + // 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; + } m_rasterizer.set_options(options); } diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h index 0f04b05ce4..d5483a9be7 100644 --- a/Userland/Libraries/LibSoftGPU/Device.h +++ b/Userland/Libraries/LibSoftGPU/Device.h @@ -68,6 +68,12 @@ enum FogMode { Exp2 }; +enum class PolygonMode { + Point, + Line, + Fill, +}; + enum class WindingOrder { Clockwise, CounterClockwise, @@ -87,7 +93,7 @@ struct RasterizerOptions { float depth_min { 0 }; float depth_max { 1 }; DepthTestFunction depth_func { DepthTestFunction::Less }; - GLenum polygon_mode { GL_FILL }; + PolygonMode polygon_mode { PolygonMode::Fill }; FloatVector4 fog_color { 0.0f, 0.0f, 0.0f, 0.0f }; float fog_density { 1.0f }; FogMode fog_mode { FogMode::Exp }; |