[Mesa-dev] [PATCH 06/10] i965/vs: Remove support for the old parameter layout.

Kenneth Graunke kenneth at whitecape.org
Fri Oct 26 13:23:54 PDT 2012


Only the old backend used it.
---
 src/mesa/drivers/dri/i965/brw_context.h     |  1 -
 src/mesa/drivers/dri/i965/brw_curbe.c       | 21 ++-------------
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp |  1 -
 src/mesa/drivers/dri/i965/brw_vs_state.c    | 12 +--------
 src/mesa/drivers/dri/i965/gen6_vs_state.c   | 42 +++--------------------------
 5 files changed, 7 insertions(+), 70 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 3862e8a..fbdd9cb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -451,7 +451,6 @@ struct brw_vs_prog_data {
     */
    GLuint urb_entry_size;
 
-   bool uses_new_param_layout;
    bool uses_vertexid;
    bool userclip;
 
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 35980bb..8f196f4 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -184,8 +184,6 @@ brw_upload_constant_buffer(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
-   const struct brw_vertex_program *vp =
-      brw_vertex_program_const(brw->vertex_program);
    const GLuint sz = brw->curbe.total_size;
    const GLuint bufsz = sz * 16 * sizeof(GLfloat);
    GLfloat *buf;
@@ -249,24 +247,9 @@ brw_upload_constant_buffer(struct brw_context *brw)
    /* vertex shader constants */
    if (brw->curbe.vs_size) {
       GLuint offset = brw->curbe.vs_start * 16;
-      GLuint nr = brw->vs.prog_data->nr_params / 4;
 
-      if (brw->vs.prog_data->uses_new_param_layout) {
-	 for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
-	    buf[offset + i] = *brw->vs.prog_data->param[i];
-	 }
-      } else {
-	 /* Load the subset of push constants that will get used when
-	  * we also have a pull constant buffer.
-	  */
-	 for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
-	    if (brw->vs.constant_map[i] != -1) {
-	       assert(brw->vs.constant_map[i] <= nr);
-	       memcpy(buf + offset + brw->vs.constant_map[i] * 4,
-		      vp->program.Base.Parameters->ParameterValues[i],
-		      4 * sizeof(float));
-	    }
-	 }
+      for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
+         buf[offset + i] = *brw->vs.prog_data->param[i];
       }
    }
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 1567765..812fa47 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -132,7 +132,6 @@ vec4_visitor::setup_uniforms(int reg)
    c->prog_data.nr_params = this->uniforms * 4;
 
    c->prog_data.curb_read_length = reg - 1;
-   c->prog_data.uses_new_param_layout = true;
 
    return reg;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c
index f572123..a72a283 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_state.c
@@ -40,7 +40,6 @@ static void
 brw_upload_vs_unit(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
-   struct gl_context *ctx = &intel->ctx;
    struct brw_vs_unit_state *vs;
 
    vs = brw_state_batch(brw, AUB_TRACE_VS_STATE,
@@ -89,16 +88,7 @@ brw_upload_vs_unit(struct brw_context *brw)
    vs->thread3.urb_entry_read_offset = 0;
 
    /* BRW_NEW_CURBE_OFFSETS, _NEW_TRANSFORM, BRW_NEW_VERTEX_PROGRAM */
-   if (ctx->Transform.ClipPlanesEnabled && !brw->vs.prog_data->uses_new_param_layout) {
-      /* Note that we read in the userclip planes as well, hence
-       * clip_start:
-       */
-      vs->thread3.const_urb_entry_read_offset = brw->curbe.clip_start * 2;
-   }
-   else {
-      vs->thread3.const_urb_entry_read_offset = brw->curbe.vs_start * 2;
-   }
-
+   vs->thread3.const_urb_entry_read_offset = brw->curbe.vs_start * 2;
 
    /* BRW_NEW_URB_FENCE */
    if (intel->gen == 5) {
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index 0e80c27..d293482 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -42,7 +42,6 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
    const struct brw_vertex_program *vp =
       brw_vertex_program_const(brw->vertex_program);
    unsigned int nr_params = brw->vs.prog_data->nr_params / 4;
-   bool uses_clip_distance = vp->program.UsesClipDistance;
 
    /* Updates the ParamaterValues[i] pointers for all parameters of the
     * basic type of PROGRAM_STATE_VAR.
@@ -63,48 +62,15 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
 			      4 * sizeof(float),
 			      32, &brw->vs.push_const_offset);
 
-      float *save_param = param;
-
-      if (brw->vs.prog_data->uses_new_param_layout) {
-	 for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
-	    *param = *brw->vs.prog_data->param[i];
-	    param++;
-	 }
-	 params_uploaded += brw->vs.prog_data->nr_params / 4;
-      } else {
-         /* This should be loaded like any other param, but it's ad-hoc
-          * until we redo the VS backend.
-          */
-         if (ctx->Transform.ClipPlanesEnabled != 0 && !uses_clip_distance) {
-            gl_clip_plane *clip_planes = brw_select_clip_planes(ctx);
-            int num_userclip_plane_consts
-               = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
-            int num_floats = 4 * num_userclip_plane_consts;
-            memcpy(param, clip_planes, num_floats * sizeof(float));
-            param += num_floats;
-            params_uploaded += num_userclip_plane_consts;
-         }
-
-         /* Align to a reg for convenience for brw_vs_emit.c */
-         if (params_uploaded & 1) {
-            param += 4;
-            params_uploaded++;
-         }
-
-	 for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
-	    if (brw->vs.constant_map[i] != -1) {
-	       memcpy(param + brw->vs.constant_map[i] * 4,
-		      vp->program.Base.Parameters->ParameterValues[i],
-		      4 * sizeof(float));
-	       params_uploaded++;
-	    }
-	 }
+      for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
+         param[i] = *brw->vs.prog_data->param[i];
       }
+      params_uploaded += brw->vs.prog_data->nr_params / 4;
 
       if (0) {
 	 printf("VS constant buffer:\n");
 	 for (i = 0; i < params_uploaded; i++) {
-	    float *buf = save_param + i * 4;
+	    float *buf = param + i * 4;
 	    printf("%d: %f %f %f %f\n",
 		   i, buf[0], buf[1], buf[2], buf[3]);
 	 }
-- 
1.8.0



More information about the mesa-dev mailing list