Mesa (master): i965/vs: split brw_vs_compile into generic and VS-specific parts.

Paul Berry stereotype441 at kemper.freedesktop.org
Thu Apr 11 16:35:14 UTC 2013


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Fri Feb 15 20:33:31 2013 -0800

i965/vs: split brw_vs_compile into generic and VS-specific parts.

This will allow the generic parts to be re-used for geometry shaders.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp     |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp     |    8 ++++----
 src/mesa/drivers/dri/i965/brw_vs.c                 |    4 ++--
 src/mesa/drivers/dri/i965/brw_vs.h                 |    8 ++++++--
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index ac3d401..0853c0a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -321,7 +321,7 @@ void
 vec4_visitor::spill_reg(int spill_reg_nr)
 {
    assert(virtual_grf_sizes[spill_reg_nr] == 1);
-   unsigned int spill_offset = c->last_scratch++;
+   unsigned int spill_offset = c->base.last_scratch++;
 
    /* Generate spill/unspill instructions for the objects being spilled. */
    foreach_list(node, &this->instructions) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 3a417ad..bfa33b6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2819,8 +2819,8 @@ vec4_visitor::move_grf_array_access_to_scratch()
 
       if (inst->dst.file == GRF && inst->dst.reladdr &&
 	  scratch_loc[inst->dst.reg] == -1) {
-	 scratch_loc[inst->dst.reg] = c->last_scratch;
-	 c->last_scratch += this->virtual_grf_sizes[inst->dst.reg];
+	 scratch_loc[inst->dst.reg] = c->base.last_scratch;
+	 c->base.last_scratch += this->virtual_grf_sizes[inst->dst.reg];
       }
 
       for (int i = 0 ; i < 3; i++) {
@@ -2828,8 +2828,8 @@ vec4_visitor::move_grf_array_access_to_scratch()
 
 	 if (src->file == GRF && src->reladdr &&
 	     scratch_loc[src->reg] == -1) {
-	    scratch_loc[src->reg] = c->last_scratch;
-	    c->last_scratch += this->virtual_grf_sizes[src->reg];
+	    scratch_loc[src->reg] = c->base.last_scratch;
+	    c->base.last_scratch += this->virtual_grf_sizes[src->reg];
 	 }
       }
    }
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 25cd397..c0a3bae 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -312,12 +312,12 @@ do_vs_prog(struct brw_context *brw,
    }
 
    /* Scratch space is used for register spilling */
-   if (c.last_scratch) {
+   if (c.base.last_scratch) {
       perf_debug("Vertex shader triggered register spilling.  "
                  "Try reducing the number of live vec4 values to "
                  "improve performance.\n");
 
-      prog_data.total_scratch = brw_get_scratch_size(c.last_scratch*REG_SIZE);
+      prog_data.total_scratch = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);
 
       brw_get_scratch_bo(intel, &brw->vs.scratch_bo,
 			 prog_data.total_scratch * brw->max_vs_threads);
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index d0f9805..c2b4bc6 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -103,12 +103,16 @@ struct brw_vs_prog_key {
 };
 
 
+struct brw_vec4_compile {
+   GLuint last_scratch; /**< measured in 32-byte (register size) units */
+};
+
+
 struct brw_vs_compile {
+   struct brw_vec4_compile base;
    struct brw_vs_prog_key key;
 
    struct brw_vertex_program *vp;
-
-   GLuint last_scratch; /**< measured in 32-byte (register size) units */
 };
 
 const unsigned *brw_vs_emit(struct brw_context *brw,




More information about the mesa-commit mailing list