mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[util] Implement replaceNaN for non-x86 platforms
This commit is contained in:
parent
2d8e14fcf4
commit
57cee691b3
@ -151,12 +151,18 @@ namespace dxvk {
|
||||
static_assert(sizeof(Vector4i) == sizeof(int) * 4);
|
||||
|
||||
inline Vector4 replaceNaN(Vector4 a) {
|
||||
#ifdef DXVK_ARCH_X86
|
||||
Vector4 result;
|
||||
__m128 value = _mm_load_ps(a.data);
|
||||
__m128 mask = _mm_cmpeq_ps(value, value);
|
||||
value = _mm_and_ps(value, mask);
|
||||
_mm_store_ps(result.data, value);
|
||||
return result;
|
||||
#else
|
||||
for (int i = 0; i < 4; i++)
|
||||
a[i] = std::isnan(a[i]) ? 0.0f : a[i];
|
||||
return a;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user