mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Unit tests: Allow rsqrt precision in spline normal lengths
x86 normalizes with a bare _mm_rsqrt_ps, so normal lengths are only good to about 3.7e-4 there and the 1e-4 check failed on every x86 CI job. Compare direction after normalizing instead. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
0715f43ab8
commit
d3ea417241
1 file changed
+4
-2
@@ -358,8 +358,10 @@ bool CheckVertex(const TestCase &tc, const RefSurface &ref, const SimpleVertex &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const D3 gotN = { got.nrm.x, got.nrm.y, got.nrm.z };
|
const D3 gotN = { got.nrm.x, got.nrm.y, got.nrm.z };
|
||||||
const double dot = gotN.x * wantN.x + gotN.y * wantN.y + gotN.z * wantN.z;
|
// The length only to rsqrt precision: x86 normalizes with a bare _mm_rsqrt_ps (relative error up to 3.7e-4).
|
||||||
if (!(fabs(gotN.Length() - 1.0) < 1e-4 && dot > 0.9999)) {
|
const double gotLen = gotN.Length();
|
||||||
|
const double dot = (gotN.x * wantN.x + gotN.y * wantN.y + gotN.z * wantN.z) / gotLen;
|
||||||
|
if (!(fabs(gotLen - 1.0) < 5e-4 && dot > 0.9999)) {
|
||||||
printf("%s: vertex %d at (%.3f, %.3f): normal %f %f %f, want %f %f %f\n", tc.name, index, u, v,
|
printf("%s: vertex %d at (%.3f, %.3f): normal %f %f %f, want %f %f %f\n", tc.name, index, u, v,
|
||||||
gotN.x, gotN.y, gotN.z, wantN.x, wantN.y, wantN.z);
|
gotN.x, gotN.y, gotN.z, wantN.x, wantN.y, wantN.z);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in new issue
Block a user