intel/fs: Bail in optimize_extract_to_float if we have modifiers

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: 1f862e923c "i965/fs: Optimize float conversions of byte/word..."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109601
Tested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 367b0ede4d)
[Emil: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

Conflicts:
	src/intel/compiler/brw_fs_nir.cpp
This commit is contained in:
Jason Ekstrand 2019-02-11 22:39:45 -06:00 committed by Emil Velikov
parent bfb5bdaa97
commit 41d78f9ed7

View file

@ -511,6 +511,15 @@ 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.
*
* TODO: We can potentially handle source modifiers if both of the opcodes
* we're combining are signed integers.
*/
if (instr->src[0].abs || instr->src[0].negate ||
src0->src[0].abs || src0->src[0].negate)
return false;
nir_const_value *element = nir_src_as_const_value(src0->src[1].src);
assert(element != NULL);