[Mesa-dev] [PATCH] intel/fs: Bail in optimize_extract_to_float if we have modifiers

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Feb 14 18:51:06 UTC 2019


On 12/02/2019 04:44, Jason Ekstrand wrote:
> This fixes a bug in runscape where we were optimizing x >> 16 to an
> extract and then negating and converting to float.  The NIR to fs pass
> was dropping the negate on the floor breaking a geometry shader and
> causing it to render nothing.
>
> Fixes: 1f862e923cb "i965/fs: Optimize float conversions of byte/word..."
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109601
> Cc: Matt Turner <mattst88 at gmail.com>


Tested-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>


With a new piglit test : https://patchwork.freedesktop.org/patch/286177/


> ---
>   src/intel/compiler/brw_fs_nir.cpp | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
> index b80f4351b49..204640ac726 100644
> --- a/src/intel/compiler/brw_fs_nir.cpp
> +++ b/src/intel/compiler/brw_fs_nir.cpp
> @@ -510,6 +510,11 @@ fs_visitor::optimize_extract_to_float(nir_alu_instr *instr,
>          src0->op != nir_op_extract_i8 && src0->op != nir_op_extract_i16)
>         return false;
>   
> +   /* If either opcode has source modifiers, bail. */
> +   if (instr->src[0].abs || instr->src[0].negate ||
> +        src0->src[0].abs || src0->src[0].negate)
> +      return false;
> +
>      unsigned element = nir_src_as_uint(src0->src[1].src);
>   
>      /* Element type to extract.*/




More information about the mesa-dev mailing list