From: Eric Anholt Date: Thu, 4 Aug 2016 23:33:16 +0000 (-0700) Subject: vc4: Use the intrinsic's first_component for vattr VPM index. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8fecc396abf00bb6e3e31087875c834981fa699;p=mesa.git vc4: Use the intrinsic's first_component for vattr VPM index. Avoids another multiplication by 4 of the base in the NIR. --- diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index d2b27bd7c8a..ad96ef5ad82 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -196,8 +196,8 @@ vc4_nir_lower_vertex_attr(struct vc4_compile *c, nir_builder *b, nir_intrinsic_instr_create(c->s, nir_intrinsic_load_input); intr_comp->num_components = 1; - nir_intrinsic_set_base(intr_comp, - nir_intrinsic_base(intr) * 4 + i); + nir_intrinsic_set_base(intr_comp, nir_intrinsic_base(intr)); + nir_intrinsic_set_component(intr_comp, i); intr_comp->src[0] = nir_src_for_ssa(nir_imm_int(b, 0)); nir_ssa_dest_init(&intr_comp->instr, &intr_comp->dest, 1, 32, NULL); nir_builder_instr_insert(b, &intr_comp->instr); diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 4d1d6237a0c..454202753a5 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1627,15 +1627,11 @@ ntq_emit_intrinsic(struct vc4_compile *c, nir_intrinsic_instr *instr) } ntq_store_dest(c, &instr->dest, 0, c->color_reads[sample_index]); - } else if (c->stage == QSTAGE_FRAG) { + } else { offset = nir_intrinsic_base(instr) + const_offset->u32[0]; int comp = nir_intrinsic_component(instr); ntq_store_dest(c, &instr->dest, 0, c->inputs[offset * 4 + comp]); - } else { - offset = nir_intrinsic_base(instr) + const_offset->u32[0]; - ntq_store_dest(c, &instr->dest, 0, - c->inputs[offset]); } break;