nir/lower_samplers: Use the right memory context for realloc'ing tex sources
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 3 Apr 2015 22:23:20 +0000 (15:23 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 4 Apr 2015 00:02:20 +0000 (17:02 -0700)
As of da5ec2a, we allocate instruction sources out of the instruction
itself.  When we realloc the texture sources we need to use the right
memory context or ralloc will get angry and assert-fail

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir_lower_samplers.cpp

index 3015dbd09e7059598188dd7567c382717806ca03..1e509a9019e814bc6fa1167942a1d7e2c1d66547 100644 (file)
@@ -90,7 +90,7 @@ lower_sampler(nir_tex_instr *instr, struct gl_shader_program *shader_program,
                ralloc_asprintf_append(&name, "[%u]", deref_array->base_offset);
             break;
          case nir_deref_array_type_indirect: {
-            instr->src = reralloc(mem_ctx, instr->src, nir_tex_src,
+            instr->src = reralloc(instr, instr->src, nir_tex_src,
                                   instr->num_srcs + 1);
             memset(&instr->src[instr->num_srcs], 0, sizeof *instr->src);
             instr->src[instr->num_srcs].src_type = nir_tex_src_sampler_offset;