Fix: EEVEE: Hardware discrepancy with math wrap function
The math render tests were not passing on the AMD hardware. This was due to some compiler behavior not returning 1 on the `floor((a - c) / (b - c))` calculation even if `a` and `b` were equal.
This commit is contained in:
@@ -78,7 +78,9 @@ float fallback_pow(float x, float y, float fallback)
|
||||
float wrap(float a, float b, float c)
|
||||
{
|
||||
float range = b - c;
|
||||
return (range != 0.0) ? a - (range * floor((a - c) / range)) : c;
|
||||
/* Avoid discrepancy on some hardware due to floating point accuracy and fast math. */
|
||||
float s = (a != b) ? floor((a - c) / range) : 1.0;
|
||||
return (range == 0.0) ? a - range * s : c;
|
||||
}
|
||||
|
||||
vec3 wrap(vec3 a, vec3 b, vec3 c)
|
||||
|
||||
Reference in New Issue
Block a user