Mesa (master): i965/vs: Split setup_uniform_clipplane_values() into Gen4-5/ 6-7 parts.

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


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

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

i965/vs: Split setup_uniform_clipplane_values() into Gen4-5/6-7 parts.

Since Gen4-5 compacts clip planes and Gen6-7 doesn't, it makes sense to
split them into separate code paths.  This patch simply copies the code
to both halves; the next commits will simplify it.

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 |   60 +++++++++++++++--------
 1 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index f7e96e5..c68ff80 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -526,29 +526,47 @@ vec4_visitor::setup_uniform_clipplane_values()
 {
    gl_clip_plane *clip_planes = brw_select_clip_planes(ctx);
 
-   /* Pre-Gen6, we compact clip planes.  For example, if the user
-    * enables just clip planes 0, 1, and 3, we will enable clip planes
-    * 0, 1, and 2 in the hardware, and we'll move clip plane 3 to clip
-    * plane 2.  This simplifies the implementation of the Gen6 clip
-    * thread.
-    *
-    * In Gen6 and later, we don't compact clip planes, because this
-    * simplifies the implementation of gl_ClipDistance.
-    */
-   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))) {
-         continue;
+   if (intel->gen < 6) {
+      /* Pre-Gen6, we compact clip planes.  For example, if the user
+       * enables just clip planes 0, 1, and 3, we will enable clip planes
+       * 0, 1, and 2 in the hardware, and we'll move clip plane 3 to clip
+       * plane 2.  This simplifies the implementation of the Gen6 clip
+       * 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))) {
+	    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;
+	 for (int j = 0; j < 4; ++j) {
+	    c->prog_data.param[this->uniforms * 4 + j] = &clip_planes[i][j];
+	 }
+	 ++compacted_clipplane_index;
+	 ++this->uniforms;
       }
-      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;
-      for (int j = 0; j < 4; ++j) {
-         c->prog_data.param[this->uniforms * 4 + j] = &clip_planes[i][j];
+   } else {
+      /* In Gen6 and later, we don't compact clip planes, because this
+       * simplifies the implementation of gl_ClipDistance.
+       */
+      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))) {
+	    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;
+	 for (int j = 0; j < 4; ++j) {
+	    c->prog_data.param[this->uniforms * 4 + j] = &clip_planes[i][j];
+	 }
+	 ++compacted_clipplane_index;
+	 ++this->uniforms;
       }
-      ++compacted_clipplane_index;
-      ++this->uniforms;
    }
 }
 




More information about the mesa-commit mailing list