Mesa (master): i965/vs: Take attributes into account when deciding urb_entry_size.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Jan 18 22:44:45 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Jan 18 04:53:40 2012 -0800

i965/vs: Take attributes into account when deciding urb_entry_size.

Both the VF and VS share space in the URB.  First, the VF stores
attributes (shader inputs) there.  The VS then reads the attributes,
executes, and reuses the space to store varyings (shader outputs).

Thus, we need to calculate the amount of URB space necessary for inputs,
outputs, and pick whichever is greater.

The old VS backend correctly did this (brw_vs_emit.c:408), but the new
VS backend only considered outputs.

Fixes vertex scrambling in GLBenchmark PRO on Ivybridge.

NOTE: This is a candidate for the 8.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41318
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp    |    8 ++++++++
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    5 -----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index a618614..dbe4dd0 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -25,6 +25,7 @@
 
 extern "C" {
 #include "brw_eu.h"
+#include "main/macros.h"
 };
 
 using namespace brw;
@@ -95,6 +96,13 @@ vec4_visitor::setup_attributes(int payload_reg)
 
    prog_data->urb_read_length = (nr_attributes + 1) / 2;
 
+   unsigned vue_entries = MAX2(nr_attributes, c->vue_map.num_slots);
+
+   if (intel->gen == 6)
+      c->prog_data.urb_entry_size = ALIGN(vue_entries, 8) / 8;
+   else
+      c->prog_data.urb_entry_size = ALIGN(vue_entries, 4) / 4;
+
    return payload_reg + nr_attributes;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index ecabcc8..06bde92 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2286,11 +2286,6 @@ vec4_visitor::emit_urb_writes()
        */
       inst->offset = (max_usable_mrf - base_mrf) / 2;
    }
-
-   if (intel->gen == 6)
-      c->prog_data.urb_entry_size = ALIGN(c->vue_map.num_slots, 8) / 8;
-   else
-      c->prog_data.urb_entry_size = ALIGN(c->vue_map.num_slots, 4) / 4;
 }
 
 src_reg




More information about the mesa-commit mailing list