diff options
author | Jesse Buhagiar <jooster669@gmail.com> | 2021-05-04 23:00:45 +1000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-08 10:13:22 +0200 |
commit | e8cd89a53818190ce23694401bff261209583336 (patch) | |
tree | 8571af6b91da9931d1e7faafb4b5d421c2e1e56f /Userland/Libraries/LibGL/SoftwareGLContext.h | |
parent | 834f3c64f0b54d14d8d5a39d670934d3a64a7f80 (diff) | |
download | serenity-e8cd89a53818190ce23694401bff261209583336.zip |
LibGL: Move polygon clipping to `Clipper` class
This code has also been optimised to be much more memory
friendly by removing a _lot_ of extraneous copies. The result
is that, when profiled, it's around 8x faster than the previous
implementation.
Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
Diffstat (limited to 'Userland/Libraries/LibGL/SoftwareGLContext.h')
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h index 38eef4573c..4b17713596 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.h +++ b/Userland/Libraries/LibGL/SoftwareGLContext.h @@ -6,6 +6,7 @@ #pragma once +#include "Clipper.h" #include "GLContext.h" #include "GLStruct.h" #include "SoftwareRasterizer.h" @@ -61,9 +62,9 @@ private: FloatVector4 m_clear_color = { 0.0f, 0.0f, 0.0f, 0.0f }; FloatVector4 m_current_vertex_color = { 1.0f, 1.0f, 1.0f, 1.0f }; - Vector<GLVertex> vertex_list; - Vector<GLTriangle> triangle_list; - Vector<GLTriangle> processed_triangles; + Vector<GLVertex, 96> vertex_list; + Vector<GLTriangle, 32> triangle_list; + Vector<GLTriangle, 32> processed_triangles; GLenum m_error = GL_NO_ERROR; bool m_in_draw_state = false; @@ -74,6 +75,8 @@ private: NonnullRefPtr<Gfx::Bitmap> m_frontbuffer; + Clipper m_clipper; + SoftwareRasterizer m_rasterizer; }; |