[Mesa-dev] [PATCH 33/37] i965/gen6/gs: Enable transform feedback support in geometry shaders

Iago Toral Quiroga itoral at igalia.com
Thu Aug 14 04:12:05 PDT 2014


From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
 src/mesa/drivers/dri/i965/brw_vec4_gs.c   |  6 ++++++
 src/mesa/drivers/dri/i965/gen6_gs_state.c | 13 +++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
index f735cf3..53b0a2f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
@@ -105,6 +105,12 @@ do_gs_prog(struct brw_context *brw,
    } else {
       /* There are no control data bits in gen6. */
       c.control_data_bits_per_vertex = 0;
+
+      /* If it is using transform feedback, enable it */
+      if (prog->TransformFeedback.NumVarying)
+         c.prog_data.gen6_xfb_enabled = true;
+      else
+         c.prog_data.gen6_xfb_enabled = false;
    }
    c.control_data_header_size_bits =
       gp->program.VerticesOut * c.control_data_bits_per_vertex;
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
index e3256e2..f2eed19 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -171,10 +171,7 @@ upload_gs_state(struct brw_context *brw)
                 GEN6_GS_SO_STATISTICS_ENABLE |
                 GEN6_GS_RENDERING_ENABLE);
 
-      /* FIXME: Enable SVBI payload only when TF is enable in SNB for
-       * user-provided GS.
-       */
-      if (0) {
+      if (brw->gs.prog_data->gen6_xfb_enabled) {
          /* GEN6_GS_REORDER is equivalent to GEN7_GS_REORDER_TRAILING
           * in gen7. SNB and IVB specs are the same regarding the reordering of
           * TRISTRIP/TRISTRIP_REV vertices and triangle orientation, so we do
@@ -183,9 +180,6 @@ upload_gs_state(struct brw_context *brw)
           */
          OUT_BATCH(GEN6_GS_REORDER |
                    GEN6_GS_SVBI_PAYLOAD_ENABLE |
-                   GEN6_GS_SVBI_POSTINCREMENT_ENABLE |
-                   /* FIXME: prog_data->svbi_postincrement_value instead of 0 */
-                   (0 << GEN6_GS_SVBI_POSTINCREMENT_VALUE_SHIFT) |
                    GEN6_GS_ENABLE);
       } else {
          OUT_BATCH(GEN6_GS_REORDER | GEN6_GS_ENABLE);
@@ -203,7 +197,10 @@ upload_gs_state(struct brw_context *brw)
 const struct brw_tracked_state gen6_gs_state = {
    .dirty = {
       .mesa  = _NEW_TRANSFORM | _NEW_PROGRAM_CONSTANTS,
-      .brw   = BRW_NEW_CONTEXT | BRW_NEW_PUSH_CONSTANT_ALLOCATION,
+      .brw   = (BRW_NEW_CONTEXT |
+                BRW_NEW_PUSH_CONSTANT_ALLOCATION |
+                BRW_NEW_GEOMETRY_PROGRAM |
+                BRW_NEW_BATCH),
       .cache = (CACHE_NEW_GS_PROG | CACHE_NEW_FF_GS_PROG)
    },
    .emit = upload_gs_state,
-- 
1.9.1



More information about the mesa-dev mailing list