diff options
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibSoftGPU/Device.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibSoftGPU/Device.h | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 3707b43fc4..ef3b5e54fd 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -917,7 +917,8 @@ void SoftwareGLContext::gl_cull_face(GLenum cull_mode) m_culled_sides = cull_mode; auto rasterizer_options = m_rasterizer.options(); - rasterizer_options.culled_sides = cull_mode; + rasterizer_options.cull_back = cull_mode == GL_BACK || cull_mode == GL_FRONT_AND_BACK; + rasterizer_options.cull_front = cull_mode == GL_FRONT || cull_mode == GL_FRONT_AND_BACK; m_rasterizer.set_options(rasterizer_options); } diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 8da6745345..290391fb5a 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -636,10 +636,10 @@ void Device::draw_primitives(GLenum primitive_type, FloatMatrix4x4 const& transf if (m_options.enable_culling) { bool is_front = (m_options.front_face == WindingOrder::CounterClockwise ? area < 0 : area > 0); - if (is_front && (m_options.culled_sides == GL_FRONT || m_options.culled_sides == GL_FRONT_AND_BACK)) + if (!is_front && m_options.cull_back) continue; - if (!is_front && (m_options.culled_sides == GL_BACK || m_options.culled_sides == GL_FRONT_AND_BACK)) + if (is_front && m_options.cull_front) continue; } diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h index 64d3dfa504..25209a7efd 100644 --- a/Userland/Libraries/LibSoftGPU/Device.h +++ b/Userland/Libraries/LibSoftGPU/Device.h @@ -84,7 +84,8 @@ struct RasterizerOptions { float depth_offset_constant { 0 }; bool enable_culling { false }; WindingOrder front_face { WindingOrder::CounterClockwise }; - GLenum culled_sides { GL_BACK }; + bool cull_back { true }; + bool cull_front { false }; }; inline static constexpr size_t const num_samplers = 32; |