[Mesa-dev] [PATCH 1/2] i965/fs: Flag all slots of a flat input as flat

Jason Ekstrand jason at jlekstrand.net
Tue Jul 31 13:38:08 UTC 2018


Otherwise, only the first vec4 of a matrix or other complex type will
get marked as flat and we'll interpolate the others.  This was caught by
a dEQP test which started failing because it did a SSO vs. non-SSO
comparison.  Previously, we did the interpolation wrong consistently in
both versions.  However, with one of Tim Arceri's NIR linkingpatches, we
started splitting the matrix input into vectors at link time in the
non-SSO version and it started getting correctly interpolated which
didn't match the broken SSO version.  As of this commit, they both get
correctly interpolated.

Fixes: e61cc87c757f8bc "i965/fs: Add a flat_inputs field to prog_data"
---
 src/intel/compiler/brw_fs.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 7ddbd285fe2..55cd5c6e72a 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -6886,8 +6886,10 @@ brw_compute_flat_inputs(struct brw_wm_prog_data *prog_data,
 	 continue;
 
       /* flat shading */
-      if (var->data.interpolation == INTERP_MODE_FLAT)
-         prog_data->flat_inputs |= (1 << input_index);
+      if (var->data.interpolation == INTERP_MODE_FLAT) {
+         unsigned slots = glsl_count_attribute_slots(var->type, false);
+         prog_data->flat_inputs |= (((1 << slots) - 1) << input_index);
+      }
    }
 }
 
-- 
2.17.1



More information about the mesa-dev mailing list