Mesa (master): i965: Prepare gs_state emitting code to include gen4-5.

Rafael Antognolli rantogno at kemper.freedesktop.org
Thu Jul 13 23:43:17 UTC 2017


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

Author: Rafael Antognolli <rafael.antognolli at intel.com>
Date:   Tue Jun  6 09:38:46 2017 -0700

i965: Prepare gs_state emitting code to include gen4-5.

Since we always call brw_batch_emit anyways, we can hopefully make things
simpler by calling it only once, and then branching inside its body. This
can be helpful when bringing the gen4-5 code into this function.

Additionally, check for GEN_GEN == 6 instead of < 7 in cases that won't apply
to lower gens.

Signed-off-by: Rafael Antognolli <rafael.antognolli at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/genX_state_upload.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 62b0eeafdc..2a5b364810 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -2357,7 +2357,7 @@ genX(upload_gs_state)(struct brw_context *brw)
       brw_gs_prog_data(stage_prog_data);
 #endif
 
-#if GEN_GEN < 7
+#if GEN_GEN == 6
    brw_batch_emit(brw, GENX(3DSTATE_CONSTANT_GS), cgs) {
       if (active && stage_state->push_const_size != 0) {
          cgs.Buffer0Valid = true;
@@ -2384,8 +2384,8 @@ genX(upload_gs_state)(struct brw_context *brw)
       gen7_emit_cs_stall_flush(brw);
 #endif
 
-   if (active) {
-      brw_batch_emit(brw, GENX(3DSTATE_GS), gs) {
+   brw_batch_emit(brw, GENX(3DSTATE_GS), gs) {
+      if (active) {
          INIT_THREAD_DISPATCH_FIELDS(gs, Vertex);
 
 #if GEN_GEN >= 7
@@ -2469,13 +2469,12 @@ genX(upload_gs_state)(struct brw_context *brw)
          gs.VertexURBEntryOutputReadOffset = urb_entry_write_offset;
          gs.VertexURBEntryOutputLength = MAX2(urb_entry_output_length, 1);
 #endif
-      }
 #if GEN_GEN < 7
-   } else if (brw->ff_gs.prog_active)  {
-      /* In gen6, transform feedback for the VS stage is done with an ad-hoc GS
-       * program. This function provides the needed 3DSTATE_GS for this.
-       */
-      brw_batch_emit(brw, GENX(3DSTATE_GS), gs) {
+      } else if (brw->ff_gs.prog_active) {
+         /* In gen6, transform feedback for the VS stage is done with an
+          * ad-hoc GS program. This function provides the needed 3DSTATE_GS
+          * for this.
+          */
          gs.KernelStartPointer = KSP(brw, brw->ff_gs.prog_offset);
          gs.SingleProgramFlow = true;
          gs.VectorMaskEnable = true;
@@ -2490,10 +2489,8 @@ genX(upload_gs_state)(struct brw_context *brw)
          gs.SVBIPostIncrementValue =
             brw->ff_gs.prog_data->svbi_postincrement_value;
          gs.Enable = true;
-      }
 #endif
-   } else {
-      brw_batch_emit(brw, GENX(3DSTATE_GS), gs) {
+      } else {
          gs.StatisticsEnable = true;
 #if GEN_GEN < 7
          gs.RenderingEnabled = true;
@@ -2507,7 +2504,8 @@ genX(upload_gs_state)(struct brw_context *brw)
 #endif
       }
    }
-#if GEN_GEN < 7
+
+#if GEN_GEN == 6
    brw->gs.enabled = active;
 #endif
 }




More information about the mesa-commit mailing list