glsl: fix error checking against MAX_UNIFORM_LOCATIONS
authorMarek Olšák <marek.olsak@amd.com>
Wed, 8 Aug 2018 19:53:10 +0000 (15:53 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 23 Aug 2018 20:56:17 +0000 (16:56 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/compiler/glsl/link_uniforms.cpp

index 8d3f95fe1148f0fdfea3e968c00855f31bb9110a..434ecefb2893eaec7b170b939e22334ea44d930a 100644 (file)
@@ -1209,8 +1209,12 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
       if (empty_locs)
          chosen_location = link_util_find_empty_block(prog, &prog->data->UniformStorage[i]);
 
-      /* Add new entries to the total amount of entries. */
-      total_entries += entries;
+      /* Add new entries to the total amount for checking against MAX_UNIFORM-
+       * _LOCATIONS. This only applies to the default uniform block (-1),
+       * because locations of uniform block entries are not assignable.
+       */
+      if (prog->data->UniformStorage[i].block_index == -1)
+         total_entries += entries;
 
       if (chosen_location != -1) {
          empty_locs -= entries;