Mesa (master): i965: Only emit interpolation setup if there are actual FS inputs.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Oct 22 06:31:08 UTC 2013


Module: Mesa
Branch: master
Commit: 43b05b8fac68784bc8d61851125bd49783e5ebd0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43b05b8fac68784bc8d61851125bd49783e5ebd0

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Oct 19 21:27:37 2013 -0700

i965: Only emit interpolation setup if there are actual FS inputs.

Dead code elimination would get rid of the extra instructions, but
skipping this saves iterations through the optimization loop.

>From shader-db:

      N     Min     Max        Median           Avg        Stddev
x 14672       3      16             3     3.1334515    0.59904168
+ 14672       1      16             3     2.8955153    0.77732963
Difference at 95.0% confidence
        -0.237936 +/- 0.0158798
        -7.59342% +/- 0.506783%
        (Student's t, pooled s = 0.693935)

Embarassingly, the classic shadow mapping shader:

   void main() { }

used to require three iterations through the optimization loop.
With this patch, it only requires one (which makes no progress).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 65a4b66..a3268fb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3025,10 +3025,12 @@ fs_visitor::run()
          emit_shader_time_begin();
 
       calculate_urb_setup();
-      if (brw->gen < 6)
-	 emit_interpolation_setup_gen4();
-      else
-	 emit_interpolation_setup_gen6();
+      if (fp->Base.InputsRead > 0) {
+         if (brw->gen < 6)
+            emit_interpolation_setup_gen4();
+         else
+            emit_interpolation_setup_gen6();
+      }
 
       /* We handle discards by keeping track of the still-live pixels in f0.1.
        * Initialize it with the dispatched pixels.




More information about the mesa-commit mailing list