Cube map coordinates are calculated from 3-dimensional uv coordinates by
scaling two of the coordinates by the third. In case of using 0,0,0 as
the coordinates, a division by zero occurs. The result is undefined
behavior.
This change detects the division by zero event and returns uv
coordinates as 0,0. Since the behavior is undefined, it doesn't matter
what we return, but after this change the result should at least be
consistent.
Affects:
dEQP-GL*cube*
Components: Framework
VK-GL-CTS issue: 3351
Change-Id: I094a98f790a28bdf7b26ccb170888f2ea9c1e64c
DE_ASSERT(DE_FALSE);
}
+ if (fabs(ma) < FLT_EPSILON)
+ {
+ return Vec2(0.0f);
+ }
+
// Compute s, t
s = ((sc / ma) + 1.0f) / 2.0f;
t = ((tc / ma) + 1.0f) / 2.0f;