1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:57:35 +00:00

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>
This commit is contained in:
Jesse Buhagiar 2021-05-04 23:00:45 +10:00 committed by Andreas Kling
parent 834f3c64f0
commit e8cd89a538
5 changed files with 177 additions and 112 deletions

View file

@ -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;
};