[Mesa-dev] [PATCH] i965/fs: Use greater-equal cmod to implement maximum.

Jordan Justen jordan.l.justen at intel.com
Fri Aug 28 18:42:06 PDT 2015


On 2015-08-28 17:12:31, Matt Turner wrote:
> See commit 3b7f683f.

That commit message seems short enough to replicate, although it is
also valuable to mention the hash here too.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

It almost seems like we could rename emit_minmax to emit_cmpsel,
optionally make it private, and add emit_min and emit_max.

Also, what about a two param form of each that uses the first param as
the dest?

-Jordan

> ---
>  src/mesa/drivers/dri/i965/brw_fs_builder.h           | 2 ++
>  src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 8 ++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_builder.h b/src/mesa/drivers/dri/i965/brw_fs_builder.h
> index 34545ea..df10a9d 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_builder.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs_builder.h
> @@ -372,6 +372,8 @@ namespace brw {
>        emit_minmax(const dst_reg &dst, const src_reg &src0,
>                    const src_reg &src1, brw_conditional_mod mod) const
>        {
> +         assert(mod == BRW_CONDITIONAL_GE || mod == BRW_CONDITIONAL_L);
> +
>           if (shader->devinfo->gen >= 6) {
>              set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
>                                   fix_unsigned_negate(src1)));
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> index 50e0acd..727e8d1 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> @@ -686,7 +686,7 @@ namespace {
>                 if (is_signed)
>                    bld.emit_minmax(offset(dst, bld, c), offset(dst, bld, c),
>                                    fs_reg(-(int)scale(widths[c] - s) - 1),
> -                                  BRW_CONDITIONAL_G);
> +                                  BRW_CONDITIONAL_GE);
>              }
>           }
>  
> @@ -717,7 +717,7 @@ namespace {
>                 if (is_signed)
>                    bld.emit_minmax(offset(dst, bld, c),
>                                    offset(dst, bld, c), fs_reg(-1.0f),
> -                                  BRW_CONDITIONAL_G);
> +                                  BRW_CONDITIONAL_GE);
>              }
>           }
>           return dst;
> @@ -741,7 +741,7 @@ namespace {
>                 /* Clamp the normalized floating-point argument. */
>                 if (is_signed) {
>                    bld.emit_minmax(offset(fdst, bld, c), offset(src, bld, c),
> -                                  fs_reg(-1.0f), BRW_CONDITIONAL_G);
> +                                  fs_reg(-1.0f), BRW_CONDITIONAL_GE);
>  
>                    bld.emit_minmax(offset(fdst, bld, c), offset(fdst, bld, c),
>                                    fs_reg(1.0f), BRW_CONDITIONAL_L);
> @@ -812,7 +812,7 @@ namespace {
>                 /* Clamp to the minimum value. */
>                 if (widths[c] < 16)
>                    bld.emit_minmax(offset(fdst, bld, c), offset(fdst, bld, c),
> -                                  fs_reg(0.0f), BRW_CONDITIONAL_G);
> +                                  fs_reg(0.0f), BRW_CONDITIONAL_GE);
>  
>                 /* Convert to 16-bit floating-point. */
>                 bld.F32TO16(offset(dst, bld, c), offset(fdst, bld, c));
> -- 
> 2.4.6
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list