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

LibSoftGPU: Make rasterization and shading member functions of Device

This adds member functions Device::rasterize_triangle() and
Device::shade_fragments(). They were free standing functions/lambdas
previously which led to a lot of parameters being passed around.
This commit is contained in:
Stephan Unverwerth 2022-01-06 17:52:07 +01:00 committed by Ali Mohammad Pur
parent d89c515609
commit b4a18eaaf0
2 changed files with 104 additions and 100 deletions

View file

@ -67,6 +67,8 @@ struct RasterizerOptions {
Array<TexCoordGenerationConfig, 4> texcoord_generation_config {};
};
struct PixelQuad;
class Device final {
public:
Device(const Gfx::IntSize& min_size);
@ -90,9 +92,11 @@ public:
void set_sampler_config(unsigned, SamplerConfig const&);
private:
void submit_triangle(Triangle const& triangle, Vector<size_t> const& enabled_texture_units);
void draw_statistics_overlay(Gfx::Bitmap&);
void rasterize_triangle(const Triangle& triangle);
void shade_fragments(PixelQuad&);
private:
RefPtr<Gfx::Bitmap> m_render_target;
OwnPtr<DepthBuffer> m_depth_buffer;
@ -102,6 +106,7 @@ private:
Vector<Triangle> m_processed_triangles;
Vector<Vertex> m_clipped_vertices;
Array<Sampler, NUM_SAMPLERS> m_samplers;
Vector<size_t> m_enabled_texture_units;
};
}