mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibSoftGPU: Make blending simpler and more efficient
Previously, we would precalculate "alpha blend factors" on every configuration update and then calculate the source and destination blending factors in one go using all these factors. The idea here was probably that we would get better performance by avoiding branching. However, by measuring blending performance in Quake III, it seems that this simpler version that only calculates the required factors reduces the CPU time spent in `rasterize_triangle` by 3%. As a bonus, `GL_SRC_ALPHA_SATURATE` is now also implemented.
This commit is contained in:
parent
f0f9d8f1e0
commit
69b94e4235
4 changed files with 63 additions and 130 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
* Copyright (c) 2023, Jelle Raaijmakers <jelle@gmta.nl>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -138,4 +139,9 @@ ALWAYS_INLINE static Vector2<AK::SIMD::f32x4> to_vec2_f32x4(Vector2<AK::SIMD::i3
|
|||
};
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static constexpr Vector4<AK::SIMD::f32x4> to_vec4(AK::SIMD::f32x4 v)
|
||||
{
|
||||
return { v, v, v, v };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue