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

LibSoftGPU: Move alpha blend factor setup out of triangle rasterization

Since the alpha blend configuration should not change between most calls
of draw_primitives it makes no sense to reinitialize the blend factors
for every rasterized triangle.
The alpha blend factors are now set up whenever the device config
changes. The blend factors are stored in struct AlphaBlendFactors.
This commit is contained in:
Stephan Unverwerth 2022-01-06 18:47:35 +01:00 committed by Ali Mohammad Pur
parent b4a18eaaf0
commit 68a1727547
3 changed files with 107 additions and 61 deletions

View file

@ -14,6 +14,7 @@
#include <LibGfx/Matrix4x4.h>
#include <LibGfx/Rect.h>
#include <LibGfx/Vector4.h>
#include <LibSoftGPU/AlphaBlendFactors.h>
#include <LibSoftGPU/Clipper.h>
#include <LibSoftGPU/Config.h>
#include <LibSoftGPU/DepthBuffer.h>
@ -95,6 +96,7 @@ private:
void draw_statistics_overlay(Gfx::Bitmap&);
void rasterize_triangle(const Triangle& triangle);
void setup_blend_factors();
void shade_fragments(PixelQuad&);
private:
@ -107,6 +109,7 @@ private:
Vector<Vertex> m_clipped_vertices;
Array<Sampler, NUM_SAMPLERS> m_samplers;
Vector<size_t> m_enabled_texture_units;
AlphaBlendFactors m_alpha_blend_factors;
};
}