[Mesa-dev] [PATCH 1/2] i965/fs: Fix texelFetchOffset() on pre-Gen7.

Eric Anholt eric at anholt.net
Tue Jun 5 19:59:34 CEST 2012


On Mon,  4 Jun 2012 14:15:10 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Commit f41ecade7b458c02d504158b522acb2231585040 fixed texelFetchOffset()
> on Ivybridge, but didn't update the Ironlake/Sandybridge code.
> 
> +15 piglits on Sandybridge.
> 
> NOTE: This and f41ecade7b458 are both candidates for stable branches.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   45 +++++++++++++++++++-------
>  1 file changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index 275a1f4..8d124a0 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -884,20 +884,41 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate,
>     const int vector_elements =
>        ir->coordinate ? ir->coordinate->type->vector_elements : 0;
>  
> -   if (ir->offset) {
> -      /* The offsets set up by the ir_texture visitor are in the
> -       * m1 header, so we can't go headerless.
> +   if (ir->offset != NULL && ir->op == ir_txf) {
> +      /* It appears that the ld instruction used for txf does its
> +       * address bounds check before adding in the offset.  To work
> +       * around this, just add the integer offset to the integer texel
> +       * coordinate, and don't put the offset in the header.
>         */
> -      header_present = true;
> -      mlen++;
> -      base_mrf--;
> -   }
> +      int offsets[3];
> +      ir_constant *offset = ir->offset->as_constant();
> +      offsets[0] = offset->value.i[0];
> +      offsets[1] = offset->value.i[1];
> +      offsets[2] = offset->value.i[2];

No need for this temporary array (unlike in the fs where it was shared
with a non-offset path).

Other than that,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120605/55eb6970/attachment.pgp>


More information about the mesa-dev mailing list