On Mon, Jul 16, 2018 at 4:26 AM, Gert Wollny <gw.foss...@gmail.com> wrote: > From: Gert Wollny <gert.wol...@collabora.com> > > The added function evaluates the array index according to the function > > idx = floor(ai + 0.5); > > Signed-off-by: Gert Wollny <gert.wol...@collabora.com> > --- > src/gallium/drivers/r600/r600_shader.c | 34 > ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/src/gallium/drivers/r600/r600_shader.c > b/src/gallium/drivers/r600/r600_shader.c > index 6655b000aa..e2f44afc05 100644 > --- a/src/gallium/drivers/r600/r600_shader.c > +++ b/src/gallium/drivers/r600/r600_shader.c > @@ -7448,6 +7448,40 @@ static int r600_do_buffer_txq(struct r600_shader_ctx > *ctx, int reg_idx, int offs > } > } > > +/* Evaluate the texture array index according to floor(z+0.5) */ > +static int r600_shader_evaluate_array_index(struct r600_bytecode_alu *alu, > + > int reg, int chan, int rel, > + > struct r600_bytecode *bc) > +{ > + int r; > + > + /* evaluate array index according to floor(z+0.5) */ > + alu->op = ALU_OP2_ADD; > + alu->src[1].sel = V_SQ_ALU_SRC_0_5; > + alu->dst.sel = reg; > + alu->dst.chan = chan; > + alu->dst.rel = rel; > + alu->dst.write = 1; > + alu->last = 1; > + r = r600_bytecode_add_alu(bc, alu); > + if (r) > + return r; > + > + memset(alu, 0, sizeof(struct r600_bytecode_alu)); > + alu->op = ALU_OP1_FLOOR; > + alu->src[0].sel = reg; > + alu->src[0].chan = chan; > + alu->src[0].rel = rel; > + alu->dst.sel = reg; > + alu->dst.chan = chan; > + alu->dst.rel = rel; > + alu->dst.write = 1; > + alu->last = 1; > + r = r600_bytecode_add_alu(bc, alu); > + if (r) > + return r; > + return 0;
Why not use RNDNE? Then you don't have to add the 0.5... -ilia > +} > > static int tgsi_tex(struct r600_shader_ctx *ctx) > { > -- > 2.16.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev