Merge pull request #11603 from Dentomologist/fix_d3d_nan_regression D3D: Restore workaround for erroneous NaN optimization