compiler/glsl: Fix uniform location counting.
authorPlamena Manolova <plamena.manolova@intel.com>
Thu, 11 Feb 2016 13:00:02 +0000 (15:00 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Thu, 18 Feb 2016 09:53:35 +0000 (11:53 +0200)
commit65dfb3048e8291675ca33581aeff8921f7ea509d
tree8a2aba1e5b5460df1eff630bfcda3ba0b4524d88
parentd335b6abc0eaa7506203df7c99898645214b4c72
compiler/glsl: Fix uniform location counting.

This patch moves the calculation of current uniforms to
link_uniforms, which makes use of UniformRemapTable which
stores all the reserved uniform locations.

Location assignment for implicit uniforms now tries to use
any gaps left in the table after the location assignment
for explicit uniforms. This gives us more space to store more
uniforms.

Patch is based on earlier patch with following changes/additions:

   1: Move the counting of explicit locations to
      check_explicit_uniform_locations and then pass
      the number to link_assign_uniform_locations.
   2: Count the number of empty slots in UniformRemapTable
      and store them in a list_head.
   3: Try to find an empty slot for implicit locations from
      the list, if that fails resize UniformRemapTable.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696
src/compiler/glsl/link_uniforms.cpp
src/compiler/glsl/linker.cpp
src/compiler/glsl/linker.h
src/mesa/main/mtypes.h