glsl: Check earlier for MaxTextureImageUnits and MaxImageUniforms
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 9 Nov 2019 06:21:10 +0000 (22:21 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 11 Nov 2019 18:58:40 +0000 (10:58 -0800)
commitd4a3b09c4bfd955dab92dbb27ab8bc273d18e649
tree82cb9ce926227f57436aefd8c7d3e7e2dafe7e05
parentfce76ae7690e5a36f3744466d0e8df90e69bc80f
glsl: Check earlier for MaxTextureImageUnits and MaxImageUniforms

Currently the linker do all the work then check for the limits, which
means num_textures and num_images in shader_info may have to store more
than the limit.  This breaks down now since shader_info was packed and
doesn't expect to store larger invalid values.

To fix this, pull the check before we set the counts in shader_info.
Add necessary plumbing to make sure we bail once those errors are
found.

Fixes: 84a1a2578da ("compiler: pack shader_info from 160 bytes to 96 bytes")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/link_uniforms.cpp
src/compiler/glsl/linker.cpp