Avoid division by zero in cube map coordinates
authorJari Komppa <jari.komppa@siru.fi>
Wed, 24 Nov 2021 17:34:46 +0000 (19:34 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 9 Dec 2021 21:42:53 +0000 (21:42 +0000)
commita5c09ca368601b2c2c1dbca8be382cd9d3690396
treeeb9b08aa3d67dd4ca6c0f275a1ca9b456e01ebda
parent03cb2be937af5670a9b1b8f12e1f167a4454780b
Avoid division by zero in cube map coordinates

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
framework/common/tcuTexture.cpp