Skip to content

Fix clamping of out-of-range integers in parameter getters

Alexander Shi requested to merge alshi-msft/mesa:gettersclamps into master

mesa: texparam: Add a clamping macro to handle out-of-range floats returned as integers.

The parameters GL_TEXTURE_MIN_LOD, GL_TEXTURE_MAX_LOD, GL_TEXTURE_MAX_ANISOTROPY_EXT, GL_TEXTURE_LOD_BIAS are stored as floats but returned as integers. Setting their values outside of the integer range results has undefined behaviour when the c-runtime method lroundf converts the value back to an integer.

Fixes Khronos CTS regression caused by 53c36dfc('replace IROUND with util functions').

Merge request reports

Loading