glsl: Check earlier for MaxShaderStorageBlocks and MaxUniformBlocks
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 9 Nov 2019 06:00:10 +0000 (22:00 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 11 Nov 2019 18:58:40 +0000 (10:58 -0800)
commitfce76ae7690e5a36f3744466d0e8df90e69bc80f
tree736e58b9306a5e629a1a1fe15bdddee161873df0
parenta8d941091f72923561a6c58b46ccb264b6a0e205
glsl: Check earlier for MaxShaderStorageBlocks and MaxUniformBlocks

Currently the linker do all the work then check for the limits, which
means num_ssbos and num_ubos 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.
One drawback of this approach is that for some cases we might not see
the collected errors from various stages, but bail as soon as a stage
breaks the limits.

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