mesa/main: Clamp GetUniformuiv values to be >= 0
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 18 May 2017 09:43:53 +0000 (11:43 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 1 Jun 2017 06:44:34 +0000 (08:44 +0200)
commit83e74d7dc14ee0f31652cd2a6c0bb66380458f2b
tree10f9620da2f75899080e87f30021b0f202c14d5f
parent102044870042d0e5e51ef0b88e91a9d59a8fda5b
mesa/main: Clamp GetUniformuiv values to be >= 0

Section 2.2.2 (Data Conversions For State Query Commands) of the
OpenGL 4.5 October 24th 2016 specification says:

"If a command returning unsigned integer data is called, such as
 GetSamplerParameterIuiv, negative values are clamped to zero."

v2: uint to int conversion should clamp to INT_MAX (Nicolai)

v3 (Iago)
  - Add conversions conversions from 64-bit integer paths
  - Rebase on master

v4:
  - need unsigned rounding for float/double->uint conversions (Nicolai)
  - use round{f}() instead of IROUND() macros (Iago)

Fixes:
KHR-GL45.gpu_shader_fp64.state_query

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v2)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/uniform_query.cpp