summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-11-27 10:31:01 +1100
committerEmil Velikov <emil.l.velikov@gmail.com>2016-12-14 19:03:10 +0000
commit7f2ee55aacaf1aae80d276ef9b7a0b12cc1c71f1 (patch)
tree321c0983824f93610eea933fe19c4aabeffe0d93 /src/compiler
parent8b9f8d306244f1977b0d1bb255ce84709e4b6cf4 (diff)
downloadexternal_mesa3d-7f2ee55aacaf1aae80d276ef9b7a0b12cc1c71f1.zip
external_mesa3d-7f2ee55aacaf1aae80d276ef9b7a0b12cc1c71f1.tar.gz
external_mesa3d-7f2ee55aacaf1aae80d276ef9b7a0b12cc1c71f1.tar.bz2
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> (cherry picked from commit 0303201dfb73c16751d5519cca7480fa678d429a) [Emil Velikov: LinkStatus is in gl_shader_program] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Conflicts: src/mesa/main/program_resource.c
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp2
-rw-r--r--src/compiler/glsl/linker.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index b3c3c5a..8529b74 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -633,6 +633,8 @@ private:
uniform->opaque[shader_type].index = this->next_subroutine;
uniform->opaque[shader_type].active = true;
+ prog->_LinkedShaders[shader_type]->NumSubroutineUniforms++;
+
/* Increment the subroutine index by 1 for non-arrays and by the
* number of array elements for arrays.
*/
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index f62a848..b71c51e 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3118,7 +3118,6 @@ link_calculate_subroutine_compat(struct gl_shader_program *prog)
if (!uni)
continue;
- sh->NumSubroutineUniforms++;
count = 0;
if (sh->NumSubroutineFunctions == 0) {
linker_error(prog, "subroutine uniform %s defined but no valid functions found\n", uni->type->name);