mesa: Follow OpenGL conversion rules for values that exceed storage size

Section 2.2.2 (Data Conversions For State Query Commands) of the
OpenGL 4.5 spec says:

  Following these steps, if a value is so large in magnitude that
  it cannot be represented by the returned data type, then the
  nearest value representable using that type is returned.

The current code doesn't do the correct thing, because it truncates a
long (potentially a 64bit values) to an int.

Closes: mesa/mesa#2828
Fixes: 53c36dfc
       ("replace IROUND with util functions")

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <mesa/mesa!4673>
54 jobs for !4673 with fix-utils-functions in 26 minutes and 41 seconds (queued for 10 seconds)
detached
Status Job ID Name Coverage
  Container
passed #2489924
aarch64
arm_build

00:00:21

passed #2489926
aarch64
arm_test

00:00:20

passed #2489928
windows shell 1809 mesa
windows_build_vs2019

00:00:13

passed #2489918
x86_build

00:03:00

passed #2489922
x86_build_old

00:00:22

passed #2489919
x86_test-gl

00:00:23

passed #2489921
x86_test-vk

00:00:20

 
  Meson X86 64
passed #2489936
meson-clang

00:06:31

passed #2489935
meson-classic

00:03:02

passed #2489937
meson-clover

00:07:36

passed #2489938
meson-clover-old-llvm

00:05:13

passed #2489933
meson-gallium

00:09:48

passed #2489931
meson-testing

00:04:48

passed #2489939
meson-vulkan

00:04:08

 
  Scons
passed #2489940
scons-win64

00:08:27

 
  Meson Misc
passed #2489942
aarch64
meson-arm64

00:05:33

passed #2489943
aarch64
meson-arm64-build-test

00:05:34

passed #2489941
aarch64
meson-armhf

00:06:11

passed #2489945
meson-i386

00:04:31

passed #2489948
meson-mingw32-x86_64

00:04:36

passed #2489947
kvm
meson-ppc64el

00:05:46

passed #2489946
kvm
meson-s390x

00:04:32

passed #2489944
windows docker 1809 mesa
meson-windows-vs2019

00:05:52

 
  Llvmpipe
passed #2489952
llvmpipe-gles2

00:04:21

passed #2489953
llvmpipe-traces

00:00:37

passed #2489950
piglit-glslparser

00:05:06

passed #2489949
piglit-quick_gl

00:10:12

passed #2489951
piglit-quick_shader

00:07:33

 
  Softpipe
passed #2489954
softpipe-gles2

00:07:45

passed #2489957
softpipe-gles31 1/4

00:03:50

passed #2489955
softpipe-gles3 1/2

00:05:33

passed #2489958
softpipe-gles31 2/4

00:04:34

passed #2489959
softpipe-gles31 3/4

00:05:25

passed #2489960
softpipe-gles31 4/4

00:03:47

passed #2489956
softpipe-gles3 2/2

00:05:14

 
  Freedreno
passed #2489965
google-freedreno-db410c
arm64_a306_gles2

00:08:54

passed #2489966
google-freedreno-db410c
arm64_a306_gles3

00:06:39

passed #2489967
google-freedreno-db820c
arm64_a530_gles2

00:10:24

passed #2489968
google-freedreno-db820c
arm64_a530_gles3

00:20:37

passed #2489969
google-freedreno-db820c
arm64_a530_gles31

00:12:27

passed #2489961
mesa-cheza
arm64_a630_gles2

00:01:37

passed #2489963
mesa-cheza
arm64_a630_gles3

00:05:55

passed #2489962
mesa-cheza
arm64_a630_gles31

00:04:18

passed #2489964
mesa-cheza
arm64_a630_gles31_options

00:03:00

 
  Panfrost
passed #2489970
mesa-ci-aarch64-lava-collabora
panfrost-t720-gles2:arm64

00:11:55

passed #2489971
mesa-ci-aarch64-lava-collabora
panfrost-t760-gles2:armhf

00:05:45

passed #2489972
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles2:arm64

00:04:26

passed #2489973
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64

00:04:10

 
  Radv
passed #2489974
radv-fossils

00:00:36

 
  Virgl
passed #2489975
virgl-gles2

00:03:44

passed #2489976
virgl-gles3

00:04:01

passed #2489977
virgl-gles31

00:02:30

passed #2489978
virgl-traces

00:06:33

 
  External
passed continuous-integration/appveyor/branch