freedreno/ir3: use const_index helpers
authorRob Clark <robclark@freedesktop.org>
Thu, 21 Jan 2016 20:15:56 +0000 (15:15 -0500)
committerRob Clark <robclark@freedesktop.org>
Tue, 9 Feb 2016 22:30:33 +0000 (17:30 -0500)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c

index 6eb6a2d52eff55de0e22b172b3dfcfed20fc9f50..f38dc8643b412e1e9dd60fbd272e4b185342f70c 100644 (file)
@@ -1004,7 +1004,7 @@ emit_intrinsic_load_ubo(struct ir3_compile *ctx, nir_intrinsic_instr *intr,
        nir_const_value *const_offset;
        /* UBO addresses are the first driver params: */
        unsigned ubo = regid(ctx->so->first_driver_param + IR3_UBOS_OFF, 0);
-       int off = intr->const_index[0];
+       int off = 0;
 
        /* First src is ubo index, which could either be an immed or not: */
        src0 = get_src(ctx, &intr->src[0])[0];
@@ -1092,7 +1092,7 @@ emit_intrinsic_store_var(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
        nir_deref_array *darr = nir_deref_as_array(dvar->deref.child);
        struct ir3_array *arr = get_var(ctx, dvar->var);
        struct ir3_instruction *addr, **src;
-       unsigned wrmask = intr->const_index[0];
+       unsigned wrmask = nir_intrinsic_write_mask(intr);
 
        compile_assert(ctx, dvar->deref.child &&
                (dvar->deref.child->deref_type == nir_deref_type_array));
@@ -1145,8 +1145,8 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
        const nir_intrinsic_info *info = &nir_intrinsic_infos[intr->intrinsic];
        struct ir3_instruction **dst, **src;
        struct ir3_block *b = ctx->block;
-       int idx = intr->const_index[0];
        nir_const_value *const_offset;
+       int idx;
 
        if (info->has_dest) {
                dst = get_dst(ctx, &intr->dest, intr->num_components);
@@ -1156,6 +1156,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
 
        switch (intr->intrinsic) {
        case nir_intrinsic_load_uniform:
+               idx = nir_intrinsic_base(intr);
                const_offset = nir_src_as_const_value(intr->src[0]);
                if (const_offset) {
                        idx += const_offset->u[0];
@@ -1182,6 +1183,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
                emit_intrinsic_load_ubo(ctx, intr, dst);
                break;
        case nir_intrinsic_load_input:
+               idx = nir_intrinsic_base(intr);
                const_offset = nir_src_as_const_value(intr->src[0]);
                if (const_offset) {
                        idx += const_offset->u[0];
@@ -1208,6 +1210,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
                emit_intrinsic_store_var(ctx, intr);
                break;
        case nir_intrinsic_store_output:
+               idx = nir_intrinsic_base(intr);
                const_offset = nir_src_as_const_value(intr->src[1]);
                compile_assert(ctx, const_offset != NULL);
                idx += const_offset->u[0];
@@ -1243,6 +1246,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
                dst[0] = ctx->instance_id;
                break;
        case nir_intrinsic_load_user_clip_plane:
+               idx = nir_intrinsic_ucp_id(intr);
                for (int i = 0; i < intr->num_components; i++) {
                        unsigned n = idx * 4 + i;
                        dst[i] = create_driver_param(ctx, IR3_DP_UCP0_X + n);