[Mesa-dev] [PATCH 11/12] i965: Delete dead dFdy flipping code.

Matt Turner mattst88 at gmail.com
Thu May 19 20:25:39 UTC 2016


On Wed, May 18, 2016 at 3:00 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Rob's pass flips dFdy in the opposite case of what I expected,

"Rob's pass" might not mean anything to a future reader. I'd call it
out by name.

> so we always take the negate_value case.  It doesn't really matter.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 24 +++++-------------------
>  1 file changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index ed790b5..53131c4 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -1101,8 +1101,6 @@ void
>  fs_generator::generate_ddy(enum opcode opcode,
>                             struct brw_reg dst, struct brw_reg src)
>  {
> -   bool negate_value = true;
> -
>     if (opcode == FS_OPCODE_DDY_FINE) {
>        /* From the Ivy Bridge PRM, volume 4 part 3, section 3.3.9 (Register
>         * Region Restrictions):
> @@ -1152,20 +1150,11 @@ fs_generator::generate_ddy(enum opcode opcode,
>        if (unroll_to_simd8) {
>           brw_set_default_exec_size(p, BRW_EXECUTE_8);
>           brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
> -         if (negate_value) {
> -            brw_ADD(p, firsthalf(dst), firsthalf(src1), negate(firsthalf(src0)));
> -            brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
> -            brw_ADD(p, sechalf(dst), sechalf(src1), negate(sechalf(src0)));
> -         } else {
> -            brw_ADD(p, firsthalf(dst), firsthalf(src0), negate(firsthalf(src1)));
> -            brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
> -            brw_ADD(p, sechalf(dst), sechalf(src0), negate(sechalf(src1)));
> -         }
> +         brw_ADD(p, firsthalf(dst), firsthalf(src1), negate(firsthalf(src0)));
> +         brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
> +         brw_ADD(p, sechalf(dst), sechalf(src1), negate(sechalf(src0)));
>        } else {
> -         if (negate_value)
> -            brw_ADD(p, dst, src1, negate(src0));
> -         else
> -            brw_ADD(p, dst, src0, negate(src1));
> +         brw_ADD(p, dst, src1, negate(src0));
>        }
>        brw_pop_insn_state(p);
>     } else {
> @@ -1184,10 +1173,7 @@ fs_generator::generate_ddy(enum opcode opcode,
>                                      BRW_WIDTH_4,
>                                      BRW_HORIZONTAL_STRIDE_0,
>                                      BRW_SWIZZLE_XYZW, WRITEMASK_XYZW);
> -      if (negate_value)
> -         brw_ADD(p, dst, src1, negate(src0));
> -      else
> -         brw_ADD(p, dst, src0, negate(src1));
> +      brw_ADD(p, dst, src1, negate(src0));

Here, and above, the code reversed src0/src1 for visual clarity
between the two paths. With just one path, let's put src0 before src1.


More information about the mesa-dev mailing list