We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab4e114 commit 3ec077fCopy full SHA for 3ec077f
DirectXTex/DirectXTexConvert.cpp
@@ -195,12 +195,15 @@ namespace
195
196
inline void SanitizeFloat16(XMVECTOR& v, DWORD flags)
197
{
198
- // Convert NaNs to 0.0f
199
- if (!(flags & TEX_FILTER_FLOAT_KEEP_NANS))
200
- v = XMVectorSelect(XMVectorZero(), v, XMVectorIsNaN(v));
+ XMVECTOR isNaN = XMVectorIsNaN(v);
201
202
if (!(flags & TEX_FILTER_FLOAT_SATURATE_TO_INF))
203
v = XMVectorClamp(v, g_HalfMin, g_HalfMax);
+
+ if (flags & TEX_FILTER_FLOAT_KEEP_NANS)
204
+ v = XMVectorSelect(XMVectorSplatQNaN(), v, isNaN);
205
+ else
206
+ v = XMVectorSelect(XMVectorZero(), v, isNaN);
207
}
208
209
inline void SanitizeFloat16(float& v, DWORD flags)
0 commit comments