1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibGL+LibSoftGPU: Move primitive assembly and clipping into LibSoftGPU

This commit is contained in:
Stephan Unverwerth 2021-12-16 21:26:15 +01:00 committed by Brian Gianforcaro
parent 2f35135743
commit 73ba208ee7
4 changed files with 176 additions and 161 deletions

View file

@ -13,8 +13,10 @@
#include <LibGL/Tex/Texture2D.h>
#include <LibGL/Tex/TextureUnit.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Matrix4x4.h>
#include <LibGfx/Rect.h>
#include <LibGfx/Vector4.h>
#include <LibSoftGPU/Clipper.h>
#include <LibSoftGPU/DepthBuffer.h>
namespace SoftGPU {
@ -59,7 +61,7 @@ class SoftwareRasterizer final {
public:
SoftwareRasterizer(const Gfx::IntSize& min_size);
void submit_triangle(GL::GLTriangle const& triangle, GL::TextureUnit::BoundList const& bound_texture_units);
void draw_primitives(GLenum primitive_type, FloatMatrix4x4 const& transform, FloatMatrix4x4 const& texture_matrix, Vector<GL::GLVertex> const& vertices, GL::TextureUnit::BoundList const& bound_texture_units);
void resize(const Gfx::IntSize& min_size);
void clear_color(const FloatVector4&);
void clear_depth(float);
@ -71,10 +73,17 @@ public:
Gfx::RGBA32 get_backbuffer_pixel(int x, int y);
float get_depthbuffer_value(int x, int y);
private:
void submit_triangle(GL::GLTriangle const& triangle, GL::TextureUnit::BoundList const& bound_texture_units);
private:
RefPtr<Gfx::Bitmap> m_render_target;
OwnPtr<DepthBuffer> m_depth_buffer;
RasterizerOptions m_options;
Clipper m_clipper;
Vector<GL::GLTriangle, 32> m_triangle_list;
Vector<GL::GLTriangle, 32> m_processed_triangles;
Vector<GL::GLVertex> m_clipped_vertices;
};
}