On Mon, Sep 24, 2012 at 10:21:03AM -0400, Tom Stellard wrote:
> On Mon, Sep 24, 2012 at 12:43:16AM +0200, Vincent Lejeune wrote:
> > ---
>
> I'm not too familiar with this code, but this patch looks good to me.
> Just make sure there are no regressions with the TGSI compiler.
>
> Reviewed-by: Tom Stellard <[email protected]>
>
You can go ahead and push patches 3 and 4 of this series. They both have
my Reviewed-by, and they have been on the mailing list long enough to give other
developers a chance to review them.
-Tom
> > src/gallium/drivers/r600/r600_shader.c | 59
> > ++++++++++++++++++++--------------
> > src/gallium/drivers/r600/r600_shader.h | 1 +
> > 2 files changed, 35 insertions(+), 25 deletions(-)
> >
> > diff --git a/src/gallium/drivers/r600/r600_shader.c
> > b/src/gallium/drivers/r600/r600_shader.c
> > index 14c1763..310ab62 100644
> > --- a/src/gallium/drivers/r600/r600_shader.c
> > +++ b/src/gallium/drivers/r600/r600_shader.c
> > @@ -1123,36 +1123,14 @@ static int process_twoside_color_inputs(struct
> > r600_shader_ctx *ctx)
> > {
> > int i, r, count = ctx->shader->ninput;
> >
> > - /* additional inputs will be allocated right after the existing inputs,
> > - * we won't need them after the color selection, so we don't need to
> > - * reserve these gprs for the rest of the shader code and to adjust
> > - * output offsets etc. */
> > - int gpr = ctx->file_offset[TGSI_FILE_INPUT] +
> > - ctx->info.file_max[TGSI_FILE_INPUT] + 1;
> > -
> > - if (ctx->face_gpr == -1) {
> > - i = ctx->shader->ninput++;
> > - ctx->shader->input[i].name = TGSI_SEMANTIC_FACE;
> > - ctx->shader->input[i].spi_sid = 0;
> > - ctx->shader->input[i].gpr = gpr++;
> > - ctx->face_gpr = ctx->shader->input[i].gpr;
> > - }
> > -
> > for (i = 0; i < count; i++) {
> > if (ctx->shader->input[i].name == TGSI_SEMANTIC_COLOR) {
> > - int ni = ctx->shader->ninput++;
> > - memcpy(&ctx->shader->input[ni],&ctx->shader->input[i],
> > sizeof(struct r600_shader_io));
> > - ctx->shader->input[ni].name = TGSI_SEMANTIC_BCOLOR;
> > - ctx->shader->input[ni].spi_sid =
> > r600_spi_sid(&ctx->shader->input[ni]);
> > - ctx->shader->input[ni].gpr = gpr++;
> > -
> > + unsigned back_facing_reg =
> > ctx->shader->input[i].potential_back_facing_reg;
> > if (ctx->bc->chip_class >= EVERGREEN) {
> > - r = evergreen_interp_input(ctx, ni);
> > - if (r)
> > + if ((r = evergreen_interp_input(ctx,
> > back_facing_reg)))
> > return r;
> > }
> > -
> > - r = select_twoside_color(ctx, i, ni);
> > + r = select_twoside_color(ctx, i, back_facing_reg);
> > if (r)
> > return r;
> > }
> > @@ -1313,6 +1291,37 @@ static int r600_shader_from_tgsi(struct r600_context
> > * rctx, struct r600_pipe_sh
> > goto out_err;
> > }
> > }
> > +
> > + /* Process two side if needed */
> > + if (shader->two_side && ctx.colors_used) {
> > + int i, count = ctx.shader->ninput;
> > +
> > + /* additional inputs will be allocated right after the existing
> > inputs,
> > + * we won't need them after the color selection, so we don't
> > need to
> > + * reserve these gprs for the rest of the shader code and to
> > adjust
> > + * output offsets etc. */
> > + int gpr = ctx.file_offset[TGSI_FILE_INPUT] +
> > + ctx.info.file_max[TGSI_FILE_INPUT] + 1;
> > +
> > + if (ctx.face_gpr == -1) {
> > + i = ctx.shader->ninput++;
> > + ctx.shader->input[i].name = TGSI_SEMANTIC_FACE;
> > + ctx.shader->input[i].spi_sid = 0;
> > + ctx.shader->input[i].gpr = gpr++;
> > + ctx.face_gpr = ctx.shader->input[i].gpr;
> > + }
> > +
> > + for (i = 0; i < count; i++) {
> > + if (ctx.shader->input[i].name == TGSI_SEMANTIC_COLOR) {
> > + int ni = ctx.shader->ninput++;
> > +
> > memcpy(&ctx.shader->input[ni],&ctx.shader->input[i], sizeof(struct
> > r600_shader_io));
> > + ctx.shader->input[ni].name =
> > TGSI_SEMANTIC_BCOLOR;
> > + ctx.shader->input[ni].spi_sid =
> > r600_spi_sid(&ctx.shader->input[ni]);
> > + ctx.shader->input[ni].gpr = gpr++;
> > + ctx.shader->input[i].potential_back_facing_reg
> > = ni;
> > + }
> > + }
> > + }
> >
> > /* LLVM backend setup */
> > #ifdef R600_USE_LLVM
> > diff --git a/src/gallium/drivers/r600/r600_shader.h
> > b/src/gallium/drivers/r600/r600_shader.h
> > index eb0bbf6..e8a8cec 100644
> > --- a/src/gallium/drivers/r600/r600_shader.h
> > +++ b/src/gallium/drivers/r600/r600_shader.h
> > @@ -34,6 +34,7 @@ struct r600_shader_io {
> > unsigned interpolate;
> > boolean centroid;
> > unsigned lds_pos; /* for evergreen */
> > + unsigned potential_back_facing_reg;
> > unsigned write_mask;
> > };
> >
> > --
> > 1.7.11.4
> >
> > _______________________________________________
> > mesa-dev mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev