nir/lower_io: add an option to lower interpolateAt functions

The option use_interpolated_input_intrinsics will lower these as well
as regular input loads. This is inconvenient for V3D, where we can
produce optimal code for regular input loads based on the input
variable layout qualifiers, so this change adds an option to only
lower instances of interpolateAt().

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2020-08-07 10:34:30 +02:00 committed by Marge Bot
parent 4394efd21b
commit 6004ad9df1
2 changed files with 12 additions and 1 deletions

View file

@ -3321,6 +3321,16 @@ typedef struct nir_shader_compiler_options {
*/
bool use_interpolated_input_intrinsics;
/**
* Whether nir_lower_io() will lower interpolateAt functions to
* load_interpolated_input intrinsics.
*
* Unlike use_interpolated_input_intrinsics this will only lower these
* functions and leave input load intrinsics untouched.
*/
bool lower_interpolate_at;
/* Lowers when 32x32->64 bit multiplication is not supported */
bool lower_mul_2x32_64;

View file

@ -610,7 +610,8 @@ nir_lower_io_block(nir_block *block,
case nir_intrinsic_interp_deref_at_offset:
case nir_intrinsic_interp_deref_at_vertex:
/* We can optionally lower these to load_interpolated_input */
if (options->use_interpolated_input_intrinsics)
if (options->use_interpolated_input_intrinsics ||
options->lower_interpolate_at)
break;
default:
/* We can't lower the io for this nir instrinsic, so skip it */