i965: eliminate gen6_xfb_enabled field in brw_gs_prog_data
authorTimothy Arceri <timothy.arceri@collabora.com>
Mon, 7 Nov 2016 23:05:42 +0000 (10:05 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Tue, 3 Jan 2017 01:20:10 +0000 (12:20 +1100)
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.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_compiler.h
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
src/mesa/drivers/dri/i965/gen6_gs_state.c
src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
src/mesa/drivers/dri/i965/gen6_gs_visitor.h

index a97f874c753684b3b6b7ab1e445109a5979f034b..4813f204868cb99f4db25c8105ee5b566245e175 100644 (file)
@@ -710,11 +710,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.
index 5f49db11811ea5cac324ea870cbe6a3380bbef07..657e1f07b92472c7f663880b6274f188289cd0e8 100644 (file)
@@ -665,12 +665,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;
@@ -900,6 +894,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);
 
index a2520d86314f704b26e75f051fa6c755227d6140..e9179152b32e70e23442d32fa45e5a66e6e99098 100644 (file)
@@ -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
index 4bd37889817a5fc2ccd79a08f4845f3b72961f9e..f2739e3d150919e992e7302b0ea9b60ce21cfc72 100644 (file)
@@ -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)));
index 311cf06833ca30672a0d42fd069c81414fd9db90..556bd158fde8b4a047c5870e5c1308161347c963 100644 (file)
@@ -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;