nir: Use nir_intrinsic_set_base in atomic lowering.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 14 Jul 2016 21:18:33 +0000 (14:18 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 16 Jul 2016 00:17:10 +0000 (17:17 -0700)
This is more readable and also offers assertions that protect against
setting const_index fields on the wrong kind of intrinsic.

Suggested by Jason.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_lower_io.c

index 1708e5b77e64fdcfefc291460fe10d9985876e9f..0a4de6a2d010c9e2e4e5eb966c4303a399eb3e7d 100644 (file)
@@ -277,9 +277,9 @@ lower_atomic(nir_intrinsic_instr *intrin, struct lower_io_state *state,
    nir_intrinsic_instr *atomic =
       nir_intrinsic_instr_create(state->mem_ctx, op);
 
-   atomic->src[0] = nir_src_for_ssa(offset);
-   atomic->const_index[0] = var->data.driver_location;
+   nir_intrinsic_set_base(atomic, var->data.driver_location);
 
+   atomic->src[0] = nir_src_for_ssa(offset);
    for (unsigned i = 0; i < nir_op_infos[intrin->intrinsic].num_inputs; i++) {
       nir_src_copy(&atomic->src[i+1], &intrin->src[i], atomic);
    }