From 6004ad9df1d3ee6cfba90de029c867da73660800 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 7 Aug 2020 10:34:30 +0200 Subject: [PATCH] nir/lower_io: add an option to lower interpolateAt functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir.h | 10 ++++++++++ src/compiler/nir/nir_lower_io.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5e630d19a2e..99ad032caff 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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; diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index a4247fa9ead..9d9e3200f89 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -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 */