Mesa (master): i965/vs: Fix user clip plane setup on Gen4-5.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Nov 13 10:07:30 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Nov  6 22:23:05 2012 -0800

i965/vs: Fix user clip plane setup on Gen4-5.

On Gen6-7, we don't compact clip planes, and nr_userclip_plane_consts
is the last bit set, so iterating from i = 0..nr_userclip_plane_consts
covers all active clip planes and is the right thing to do.
works and is the right thing to do.

However, that doesn't work at all on Gen4-5.  Since we don't compact
clip planes, we skip over ones which aren't active (via the continue
statement).  We also set set nr_userclip_plane_consts to the number of
active clip planes, which means that we end the loop after checking that
many bits.  If the set of clip planes wasn't contiguous, this means we'd
fail to find the last few.

By changing the iteration to MAX_CLIP_PLANES, we correctly find all of
the active clip planes.

Fixes regressions since 66c8473e028d (replacing the old VS backend) in
Piglit's spec/glsl-1.20/execution/clipping/fixed-clip-enables and
oglconform's mustpass(basic.clip) and userclip(basic.allCases).

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

---

 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 325ef0d..72766a2 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -534,11 +534,10 @@ vec4_visitor::setup_uniform_clipplane_values()
        * thread.
        */
       int compacted_clipplane_index = 0;
-      for (int i = 0; i < c->key.nr_userclip_plane_consts; ++i) {
-	 if (intel->gen < 6 &&
-	     !(c->key.userclip_planes_enabled_gen_4_5 & (1 << i))) {
+      for (int i = 0; i < MAX_CLIP_PLANES; ++i) {
+	 if (!(c->key.userclip_planes_enabled_gen_4_5 & (1 << i)))
 	    continue;
-	 }
+
 	 this->uniform_vector_size[this->uniforms] = 4;
 	 this->userplane[compacted_clipplane_index] = dst_reg(UNIFORM, this->uniforms);
 	 this->userplane[compacted_clipplane_index].type = BRW_REGISTER_TYPE_F;




More information about the mesa-commit mailing list