mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Fix incorrect clamping in SWRenderer.
A previous PR changed a whole lot of min/maxes to std::min/std::max but made a mistake here and used a templated min which cast it's arguments to unsigned instead of casting return value. This resulted in glitchy artifacts in bright areas (See issue 7439) I rewrote the code to use a proper clamping function so it's cleaner to read.
This commit is contained in:
@ -20,6 +20,14 @@ inline void Clamp(T* val, const T& min, const T& max)
|
||||
*val = max;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T Clamp(const T val, const T& min, const T& max)
|
||||
{
|
||||
T ret = val;
|
||||
Clamp(&ret, min, max);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// The most significant bit of the fraction is an is-quiet bit on all architectures we care about.
|
||||
|
||||
static const u64 DOUBLE_SIGN = 0x8000000000000000ULL,
|
||||
|
Reference in New Issue
Block a user