[Mesa-dev] [PATCH 27/70] i965: eliminate gen6_xfb_enabled field in brw_gs_prog_data

Timothy Arceri timothy.arceri at collabora.com
Tue Dec 20 10:37:37 UTC 2016


We can just get this information from shader_info instead.

Note that passing gen6_gs_visitor() gl_program via _LinkedShaders
will go away in a later patch.
---
 src/mesa/drivers/dri/i965/brw_compiler.h          | 5 -----
 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 7 +------
 src/mesa/drivers/dri/i965/gen6_gs_state.c         | 4 +---
 src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp     | 8 ++++----
 src/mesa/drivers/dri/i965/gen6_gs_visitor.h       | 7 +++++--
 5 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index a97f874..4813f20 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -711,11 +711,6 @@ struct brw_gs_prog_data
    int invocations;
 
    /**
-    * Gen6 transform feedback enabled flag.
-    */
-   bool gen6_xfb_enabled;
-
-   /**
     * Gen6: Provoking vertex convention for odd-numbered triangles
     * in tristrips.
     */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 3894a63..5c04229 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -666,12 +666,6 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
    } 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 (shader->info->has_transform_feedback_varyings)
-         prog_data->gen6_xfb_enabled = true;
-      else
-         prog_data->gen6_xfb_enabled = false;
    }
    c.control_data_header_size_bits =
       shader->info->gs.vertices_out * c.control_data_bits_per_vertex;
@@ -901,6 +895,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
                                shader_time_index);
    else
       gs = new gen6_gs_visitor(compiler, log_data, &c, prog_data, shader_prog,
+                               shader_prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
                                shader, mem_ctx, false /* no_spills */,
                                shader_time_index);
 
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
index a2520d8..e917915 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -100,8 +100,6 @@ upload_gs_state(struct brw_context *brw)
    const struct brw_stage_prog_data *prog_data = stage_state->prog_data;
    const struct brw_vue_prog_data *vue_prog_data =
       brw_vue_prog_data(stage_state->prog_data);
-   const struct brw_gs_prog_data *gs_prog_data =
-      brw_gs_prog_data(stage_state->prog_data);
 
    if (!active || stage_state->push_const_size == 0) {
       /* Disable the push constant buffers. */
@@ -164,7 +162,7 @@ upload_gs_state(struct brw_context *brw)
                 GEN6_GS_SO_STATISTICS_ENABLE |
                 GEN6_GS_RENDERING_ENABLE);
 
-      if (gs_prog_data->gen6_xfb_enabled) {
+      if (brw->geometry_program->info.has_transform_feedback_varyings) {
          /* 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
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
index 4bd3788..f2739e3 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
@@ -96,7 +96,7 @@ gen6_gs_visitor::emit_prolog()
    this->prim_count = src_reg(this, glsl_type::uint_type);
    emit(MOV(dst_reg(this->prim_count), brw_imm_ud(0u)));
 
-   if (gs_prog_data->gen6_xfb_enabled) {
+   if (prog->info.has_transform_feedback_varyings) {
       /* Create a virtual register to hold destination indices in SOL */
       this->destination_indices = src_reg(this, glsl_type::uvec4_type);
       /* Create a virtual register to hold number of written primitives */
@@ -356,7 +356,7 @@ gen6_gs_visitor::emit_thread_end()
       this->current_annotation = "gen6 thread end: ff_sync";
 
       vec4_instruction *inst;
-      if (gs_prog_data->gen6_xfb_enabled) {
+      if (prog->info.has_transform_feedback_varyings) {
          src_reg sol_temp(this, glsl_type::uvec4_type);
          emit(GS_OPCODE_FF_SYNC_SET_PRIMITIVES,
               dst_reg(this->svbi),
@@ -446,7 +446,7 @@ gen6_gs_visitor::emit_thread_end()
       }
       emit(BRW_OPCODE_WHILE);
 
-      if (gs_prog_data->gen6_xfb_enabled)
+      if (prog->info.has_transform_feedback_varyings)
          xfb_write();
    }
    emit(BRW_OPCODE_ENDIF);
@@ -468,7 +468,7 @@ gen6_gs_visitor::emit_thread_end()
     */
    this->current_annotation = "gen6 thread end: EOT";
 
-   if (gs_prog_data->gen6_xfb_enabled) {
+   if (prog->info.has_transform_feedback_varyings) {
       /* When emitting EOT, set SONumPrimsWritten Increment Value. */
       src_reg data(this, glsl_type::uint_type);
       emit(AND(dst_reg(data), this->sol_prim_written, brw_imm_ud(0xffffu)));
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
index 311cf06..556bd15 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
@@ -39,14 +39,16 @@ public:
                    void *log_data,
                    struct brw_gs_compile *c,
                    struct brw_gs_prog_data *prog_data,
-                   struct gl_shader_program *prog,
+                   struct gl_shader_program *sh_prog,
+                   struct gl_program *prog,
                    const nir_shader *shader,
                    void *mem_ctx,
                    bool no_spills,
                    int shader_time_index) :
       vec4_gs_visitor(comp, log_data, c, prog_data, shader, mem_ctx, no_spills,
                       shader_time_index),
-      shader_prog(prog)
+      shader_prog(sh_prog),
+      prog(prog)
       {
       }
 
@@ -69,6 +71,7 @@ private:
    int get_vertex_output_offset_for_varying(int vertex, int varying);
 
    const struct gl_shader_program *shader_prog;
+   const struct gl_program *prog;
 
    src_reg vertex_output;
    src_reg vertex_output_offset;
-- 
2.9.3



More information about the mesa-dev mailing list