summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-09-09 12:58:58 -0700
committerEmil Velikov <emil.l.velikov@gmail.com>2015-11-07 15:17:49 +0000
commit2cc4e973962c1d5ea0357685036879c7bf9575ce (patch)
tree91a8627da1b4dba6a457dfa2f101df369c27a1ae
parentba0c78f4e278a89e6871ac334819e73e41ddc94d (diff)
nir/lower_vec_to_movs: Pass the shader around directly
Previously, we were passing the shader around, we were just calling it "mem_ctx". However, the nir_shader is (and must be for the purposes of mark-and-sweep) the mem_ctx so we might as well pass it around explicitly. Reviewed-by: Eduardo Lima Mitev <elima@igalia.com> (cherry picked from commit b7eeced3c724bf5de05290551ced8621ce2c7c52)
-rw-r--r--src/glsl/nir/nir_lower_vec_to_movs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c
index b7f096d14ff..25a6f7d3ad9 100644
--- a/src/glsl/nir/nir_lower_vec_to_movs.c
+++ b/src/glsl/nir/nir_lower_vec_to_movs.c
@@ -54,12 +54,12 @@ src_matches_dest_reg(nir_dest *dest, nir_src *src)
*/
static unsigned
insert_mov(nir_alu_instr *vec, unsigned start_channel,
- unsigned start_src_idx, void *mem_ctx)
+ unsigned start_src_idx, nir_shader *shader)
{
unsigned src_idx = start_src_idx;
assert(src_idx < nir_op_infos[vec->op].num_inputs);
- nir_alu_instr *mov = nir_alu_instr_create(mem_ctx, nir_op_imov);
+ nir_alu_instr *mov = nir_alu_instr_create(shader, nir_op_imov);
nir_alu_src_copy(&mov->src[0], &vec->src[src_idx], mov);
nir_alu_dest_copy(&mov->dest, &vec->dest, mov);
@@ -84,7 +84,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_channel,
}
static bool
-lower_vec_to_movs_block(nir_block *block, void *mem_ctx)
+lower_vec_to_movs_block(nir_block *block, void *shader)
{
nir_foreach_instr_safe(block, instr) {
if (instr->type != nir_instr_type_alu)
@@ -115,7 +115,7 @@ lower_vec_to_movs_block(nir_block *block, void *mem_ctx)
continue;
if (src_matches_dest_reg(&vec->dest.dest, &vec->src[src_idx].src)) {
- finished_write_mask |= insert_mov(vec, i, src_idx, mem_ctx);
+ finished_write_mask |= insert_mov(vec, i, src_idx, shader);
break;
}
src_idx++;
@@ -127,7 +127,7 @@ lower_vec_to_movs_block(nir_block *block, void *mem_ctx)
continue;
if (!(finished_write_mask & (1 << i)))
- finished_write_mask |= insert_mov(vec, i, src_idx, mem_ctx);
+ finished_write_mask |= insert_mov(vec, i, src_idx, shader);
src_idx++;
}
@@ -142,7 +142,9 @@ lower_vec_to_movs_block(nir_block *block, void *mem_ctx)
static void
nir_lower_vec_to_movs_impl(nir_function_impl *impl)
{
- nir_foreach_block(impl, lower_vec_to_movs_block, ralloc_parent(impl));
+ nir_shader *shader = impl->overload->function->shader;
+
+ nir_foreach_block(impl, lower_vec_to_movs_block, shader);
}
void