[Mesa-dev] [PATCH 8/8] i965/vs: Include URB payload setup in shader_time.

Eric Anholt eric at anholt.net
Tue Mar 19 17:06:03 PDT 2013


This much more accurately reflects the cost of the vertex shader, since
the payload setup is often a significant fraction of the instructions in
the VS.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp         |    3 ---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   12 +++++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 6891023..9f0d03c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1285,9 +1285,6 @@ vec4_visitor::run()
    if (c->key.userclip_active && !c->key.uses_clip_distance)
       setup_uniform_clipplane_values();
 
-   if (INTEL_DEBUG & DEBUG_SHADER_TIME)
-      emit_shader_time_end();
-
    emit_urb_writes();
 
    /* Before any optimization, push array accesses out to scratch
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 60575d7..ec686c4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2639,11 +2639,16 @@ vec4_visitor::emit_urb_writes()
       }
    }
 
+   bool eot = slot >= c->prog_data.vue_map.num_slots;
+   if (eot) {
+      if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+         emit_shader_time_end();
+   }
    current_annotation = "URB write";
    vec4_instruction *inst = emit(VS_OPCODE_URB_WRITE);
    inst->base_mrf = base_mrf;
    inst->mlen = align_interleaved_urb_mlen(brw, mrf - base_mrf);
-   inst->eot = (slot >= c->prog_data.vue_map.num_slots);
+   inst->eot = eot;
 
    /* Optional second URB write */
    if (!inst->eot) {
@@ -2655,6 +2660,11 @@ vec4_visitor::emit_urb_writes()
          emit_urb_slot(mrf++, c->prog_data.vue_map.slot_to_vert_result[slot]);
       }
 
+      if (eot) {
+         if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+            emit_shader_time_end();
+      }
+
       current_annotation = "URB write";
       inst = emit(VS_OPCODE_URB_WRITE);
       inst->base_mrf = base_mrf;
-- 
1.7.10.4



More information about the mesa-dev mailing list