@@ -1018,9 +1018,31 @@ void Renderer::render(nbl::ITimer* timer)
1018
1018
camera->render ();
1019
1019
1020
1020
const auto currentViewProj = camera->getConcatenatedMatrix ();
1021
+ auto properEquals = [](const auto & rhs, const auto & lhs) -> bool
1022
+ {
1023
+ const float rotationTolerance = 1 .001f ;
1024
+ const float positionTolerance = 1 .005f ;
1025
+ const float projectionTolerance = 1 .0005f ;
1026
+ const core::matrix4SIMD tolerance (
1027
+ rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1028
+ rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1029
+ rotationTolerance,rotationTolerance,rotationTolerance,positionTolerance,
1030
+ projectionTolerance,projectionTolerance,projectionTolerance,projectionTolerance
1031
+ );
1032
+ for (auto r=0 ; r<4u ; r++)
1033
+ for (auto c=0 ; c<4u ; c++)
1034
+ {
1035
+ const float ratio = core::abs (rhs.rows [r][c]/lhs.rows [r][c]);
1036
+ // TODO: do by ULP
1037
+ if (core::isnan (ratio) || core::isinf (ratio))
1038
+ continue ;
1039
+ if (ratio>tolerance.rows [r][c] || ratio*tolerance.rows [r][c]<1 .f )
1040
+ return false ;
1041
+ }
1042
+ return true ;
1043
+ };
1021
1044
// TODO: instead of rasterizing vis-buffer only once, subpixel jitter it to obtain AA
1022
- const auto thresh = core::ROUNDING_ERROR<core::matrix4SIMD>()*128 .f ;
1023
- if (!core::equals (prevViewProj,currentViewProj,thresh))
1045
+ if (!properEquals (prevViewProj,currentViewProj))
1024
1046
{
1025
1047
m_raytraceCommonData.framesDispatched = 0u ;
1026
1048
0 commit comments