mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibSoftGPU: Use AK::SIMD::exp_approximate
instead of ::exp
The approximate version is properly vectorized and results in fewer stalls than the `::exp` version.
This commit is contained in:
parent
f4342c9118
commit
f54d9c0a61
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/f54d9c0a61 Pull-request: https://github.com/SerenityOS/serenity/pull/17504
@ -39,7 +39,7 @@ static i64 g_num_quads;
|
||||
|
||||
using AK::abs;
|
||||
using AK::SIMD::any;
|
||||
using AK::SIMD::exp;
|
||||
using AK::SIMD::exp_approximate;
|
||||
using AK::SIMD::expand4;
|
||||
using AK::SIMD::f32x4;
|
||||
using AK::SIMD::i32x4;
|
||||
@ -1277,7 +1277,6 @@ ALWAYS_INLINE void Device::shade_fragments(PixelQuad& quad)
|
||||
// Calculate fog
|
||||
// Math from here: https://opengl-notes.readthedocs.io/en/latest/topics/texturing/aliasing.html
|
||||
|
||||
// FIXME: exponential fog is not vectorized, we should add a SIMD exp function that calculates an approximation.
|
||||
if (m_options.fog_enabled) {
|
||||
f32x4 factor;
|
||||
switch (m_options.fog_mode) {
|
||||
@ -1286,12 +1285,12 @@ ALWAYS_INLINE void Device::shade_fragments(PixelQuad& quad)
|
||||
break;
|
||||
case GPU::FogMode::Exp: {
|
||||
auto argument = -m_options.fog_density * quad.fog_depth;
|
||||
factor = exp(argument);
|
||||
factor = exp_approximate(argument);
|
||||
} break;
|
||||
case GPU::FogMode::Exp2: {
|
||||
auto argument = m_options.fog_density * quad.fog_depth;
|
||||
argument *= -argument;
|
||||
factor = exp(argument);
|
||||
factor = exp_approximate(argument);
|
||||
} break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
Loading…
Reference in New Issue
Block a user