mesa: fix active subroutine uniforms properly
authorTimothy Arceri <timothy.arceri@collabora.com>
Sat, 26 Nov 2016 23:31:01 +0000 (10:31 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Tue, 29 Nov 2016 04:29:51 +0000 (15:29 +1100)
commit0303201dfb73c16751d5519cca7480fa678d429a
treedc6258f4a17a2da3a4f6f4f9880d7fb187231bb0
parentf469235a6e0c239166ba803e121994063b47ddd3
mesa: fix active subroutine uniforms properly

07fe2d565b introduced a big hack in order to return
NumSubroutineUniforms when querying ACTIVE_RESOURCES for
<shader>_SUBROUTINE_UNIFORM interfaces. However this is the
wrong fix we are meant to be returning the number of active
resources i.e. the count of subroutine uniforms in the
resource list which is what the code was previously doing,
anything else will cause trouble when trying to retrieve
the resource properties based on the ACTIVE_RESOURCES count.

The real problem is that NumSubroutineUniforms was counting
array elements as separate uniforms but the innermost array
is always considered a single uniform so we fix that count
instead which was counted incorrectly in 7fa0250f9.

Idealy we could probably completely remove
NumSubroutineUniforms and just compute its value when needed
from the resource list but this works for now.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
src/compiler/glsl/link_uniforms.cpp
src/compiler/glsl/linker.cpp
src/mesa/main/program_resource.c