[Mesa-dev] [PATCH] nir: Add support for scalarizing load_interpolated_input.

Kenneth Graunke kenneth at whitecape.org
Wed Aug 10 07:09:40 UTC 2016


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/nir/nir_lower_io_to_scalar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
index f2345d5..8be75e4 100644
--- a/src/compiler/nir/nir_lower_io_to_scalar.c
+++ b/src/compiler/nir/nir_lower_io_to_scalar.c
@@ -48,8 +48,10 @@ lower_load_input_to_scalar(nir_builder *b, nir_intrinsic_instr *intr)
 
       nir_intrinsic_set_base(chan_intr, nir_intrinsic_base(intr));
       nir_intrinsic_set_component(chan_intr, nir_intrinsic_component(intr) + i);
-      /* offset */
-      chan_intr->src[0] = intr->src[0];
+
+      /* offset and possibly barycentric coordinates */
+      for (int i = 0; i < nir_intrinsic_infos[intr->intrinsic].num_srcs; i++)
+         chan_intr->src[i] = intr->src[i];
 
       nir_builder_instr_insert(b, &chan_intr->instr);
 
@@ -112,6 +114,7 @@ nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask)
 
                switch (intr->intrinsic) {
                case nir_intrinsic_load_input:
+               case nir_intrinsic_load_interpolated_input:
                   if (mask & nir_var_shader_in)
                      lower_load_input_to_scalar(&b, intr);
                   break;
-- 
2.9.0



More information about the mesa-dev mailing list