diff options
Diffstat (limited to 'src/glsl/nir/nir_lower_samplers.cpp')
-rw-r--r-- | src/glsl/nir/nir_lower_samplers.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/glsl/nir/nir_lower_samplers.cpp b/src/glsl/nir/nir_lower_samplers.cpp index 5e90a4ce82e..99f31fc0281 100644 --- a/src/glsl/nir/nir_lower_samplers.cpp +++ b/src/glsl/nir/nir_lower_samplers.cpp @@ -94,12 +94,15 @@ lower_sampler(nir_tex_instr *instr, struct gl_shader_program *shader_program, case nir_deref_array_type_indirect: { assert(!has_indirect); - assert(instr->num_srcs < 4); + instr->src = reralloc(mem_ctx, 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; + instr->num_srcs++; - nir_instr_rewrite_src(&instr->instr, &instr->src[instr->num_srcs], + nir_instr_rewrite_src(&instr->instr, + &instr->src[instr->num_srcs - 1].src, nir_src_copy(deref_array->indirect, mem_ctx)); - instr->src_type[instr->num_srcs] = nir_tex_src_sampler_offset; - instr->num_srcs++; instr->sampler_array_size = glsl_get_length(deref->type); |