[Mesa-dev] [PATCH] i965: stop counting double outputs twice

Timothy Arceri timothy.arceri at collabora.com
Fri Jul 22 12:28:48 UTC 2016


Since 7f53fead5c we treat every location as using all
four components so there is no need for handling doubles
as a special case.

This fixes a crash in GL45-CTS.enhanced_layouts.varying_locations
where the outputs array would overflow when a double was stored at
the max varying location.

Cc: Iago Toral <itoral at igalia.com>
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 50d73eb..5d26018 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -67,14 +67,9 @@ fs_visitor::nir_setup_single_output_varying(fs_reg *reg,
       }
    } else {
       assert(type->is_scalar() || type->is_vector());
-      unsigned num_iter = 1;
-      if (type->is_double())
-         num_iter = 2;
-      for (unsigned count = 0; count < num_iter; count++) {
-         this->outputs[*location] = *reg;
-         *reg = offset(*reg, bld, 4);
-         (*location)++;
-      }
+      this->outputs[*location] = *reg;
+      *reg = offset(*reg, bld, 4);
+      (*location)++;
    }
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list