[Mesa-dev] [PATCH 11/15] i965: abort linking if we exhaust the registers

Antia Puentes apuentes at igalia.com
Thu Apr 28 11:40:41 UTC 2016


From: "Juan A. Suarez Romero" <jasuarez at igalia.com>

Even when the number of vertex attributes is under the limit, for
shaders that use a high number of them, we can quickly exhaust the
number of hardware registers.

In this case, just abort the linking.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4b8835d..387a266 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1857,6 +1857,12 @@ fs_visitor::convert_attr_sources_to_hw_regs(fs_inst *inst)
                    inst->src[i].nr +
                    inst->src[i].reg_offset;
 
+         if (grf >= 128) {
+            fail("Failure to register allocate.  Reduce the number of "
+                 "vertex input attributes to avoid this.");
+            return;
+         }
+
          unsigned exec_size;
          /* As explained at brw_reg_from_fs_reg, From the Haswell PRM:
           *
-- 
2.5.0



More information about the mesa-dev mailing list