glsl/tests: fix segfault in uniform initializer test
authorTimothy Arceri <timothy.arceri@collabora.com>
Thu, 11 Aug 2016 00:34:52 +0000 (10:34 +1000)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 11 Aug 2016 04:57:18 +0000 (14:57 +1000)
Caused by 549222f5

Tested-by: Aaron Watry <awatry@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97286

src/compiler/glsl/tests/set_uniform_initializer_tests.cpp

index a36ffdc58be070b37d8563026e5b54fd8f559cf4..9d4101743f9a28af09b0fa9c8afed1721ff08151 100644 (file)
@@ -24,6 +24,7 @@
 #include "main/compiler.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
+#include "program/hash_table.h"
 #include "util/ralloc.h"
 #include "uniform_initializer_utils.h"
 
@@ -108,6 +109,7 @@ establish_uniform_storage(struct gl_shader_program *prog, unsigned num_storage,
                                               + type->components()));
    const unsigned red_zone_components = total_components - data_components;
 
+   prog->UniformHash = new string_to_uint_map;
    prog->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
                                        num_storage);
    prog->NumUniformStorage = num_storage;
@@ -128,6 +130,9 @@ establish_uniform_storage(struct gl_shader_program *prog, unsigned num_storage,
                                     data_components,
                                     red_zone_components);
 
+   prog->UniformHash->put(index_to_set,
+                          prog->UniformStorage[index_to_set].name);
+
    for (unsigned i = 0; i < num_storage; i++) {
       if (i == index_to_set)
         continue;