[Mesa-dev] [PATCH 22/38] i965/fs: Migrate FS interpolation code to the IR builder.

Matt Turner mattst88 at gmail.com
Thu Jun 4 19:20:11 PDT 2015


On Thu, Jun 4, 2015 at 9:05 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp         | 28 ++++++------
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 66 ++++++++++++++--------------
>  2 files changed, 46 insertions(+), 48 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index bd94dc4..d2ec2a7 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1128,15 +1128,15 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,
>
>     /* gl_FragCoord.x */
>     if (pixel_center_integer) {
> -      emit(MOV(wpos, this->pixel_x));
> +      bld.MOV(wpos, this->pixel_x);
>     } else {
> -      emit(ADD(wpos, this->pixel_x, fs_reg(0.5f)));
> +      bld.ADD(wpos, this->pixel_x, fs_reg(0.5f));
>     }
>     wpos = offset(wpos, 1);
>
>     /* gl_FragCoord.y */
>     if (!flip && pixel_center_integer) {
> -      emit(MOV(wpos, this->pixel_y));
> +      bld.MOV(wpos, this->pixel_y);
>     } else {
>        fs_reg pixel_y = this->pixel_y;
>        float offset = (pixel_center_integer ? 0.0 : 0.5);
> @@ -1146,22 +1146,22 @@ fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,
>          offset += key->drawable_height - 1.0;
>        }
>
> -      emit(ADD(wpos, pixel_y, fs_reg(offset)));
> +      bld.ADD(wpos, pixel_y, fs_reg(offset));
>     }
>     wpos = offset(wpos, 1);
>
>     /* gl_FragCoord.z */
>     if (devinfo->gen >= 6) {
> -      emit(MOV(wpos, fs_reg(brw_vec8_grf(payload.source_depth_reg, 0))));
> +      bld.MOV(wpos, fs_reg(brw_vec8_grf(payload.source_depth_reg, 0)));
>     } else {
> -      emit(FS_OPCODE_LINTERP, wpos,
> +      bld.emit(FS_OPCODE_LINTERP, wpos,
>             this->delta_xy[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],
>             interp_reg(VARYING_SLOT_POS, 2));
>     }
>     wpos = offset(wpos, 1);
>
>     /* gl_FragCoord.w: Already set up in emit_interpolation */
> -   emit(BRW_OPCODE_MOV, wpos, this->wpos_w);
> +   bld.emit(BRW_OPCODE_MOV, wpos, this->wpos_w);

bld.MOV

>
>     return reg;
>  }
> @@ -1196,8 +1196,8 @@ fs_visitor::emit_linterp(const fs_reg &attr, const fs_reg &interp,
>         */
>        barycoord_mode = BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC;
>     }
> -   return emit(FS_OPCODE_LINTERP, attr,
> -               this->delta_xy[barycoord_mode], interp);
> +   return bld.emit(FS_OPCODE_LINTERP, attr,
> +                   this->delta_xy[barycoord_mode], interp);
>  }
>
>  void
> @@ -1255,7 +1255,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
>                struct brw_reg interp = interp_reg(location, k);
>                interp = suboffset(interp, 3);
>                 interp.type = attr.type;
> -              emit(FS_OPCODE_CINTERP, attr, fs_reg(interp));
> +              bld.emit(FS_OPCODE_CINTERP, attr, fs_reg(interp));
>                attr = offset(attr, 1);
>             }
>          } else {
> @@ -1268,7 +1268,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
>                     * unlit, replace the centroid data with non-centroid
>                     * data.
>                     */
> -                  emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
> +                  bld.emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
>
>                    fs_inst *inst;
>                    inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
> @@ -1292,7 +1292,7 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
>                                 mod_sample || key->persample_shading);
>                 }
>                 if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) {
> -                  emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
> +                  bld.emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);

bld.MUL

>                 }
>                attr = offset(attr, 1);
>             }


More information about the mesa-dev mailing list