[Mesa-dev] [PATCH 2/8] i965: move update_xfb_info() call out of loop

Timothy Arceri tarceri at itsqueeze.com
Tue Nov 14 23:35:18 UTC 2017


We can just call it once. Also a following patch will also introduce
link time component packing which modifies the outputs_written
bit mask, we want to avoid calling update_xfb_info() until after
packing is completed.
---
 src/mesa/drivers/dri/i965/brw_link.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 24545d52ec..e6f93d37f0 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -304,42 +304,45 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
          struct blob writer;
          blob_init(&writer);
          nir_serialize(&writer, prog->nir);
          prog->driver_cache_blob = ralloc_size(NULL, writer.size);
          memcpy(prog->driver_cache_blob, writer.data, writer.size);
          prog->driver_cache_blob_size = writer.size;
       }
 
       infos[stage] = &prog->nir->info;
 
-      update_xfb_info(prog->sh.LinkedTransformFeedback, infos[stage]);
-
       /* Make a pass over the IR to add state references for any built-in
        * uniforms that are used.  This has to be done now (during linking).
        * Code generation doesn't happen until the first time this shader is
        * used for rendering.  Waiting until then to generate the parameters is
        * too late.  At that point, the values for the built-in uniforms won't
        * get sent to the shader.
        */
       nir_foreach_variable(var, &prog->nir->uniforms) {
          if (strncmp(var->name, "gl_", 3) == 0) {
             const nir_state_slot *const slots = var->state_slots;
             assert(var->state_slots != NULL);
 
             for (unsigned int i = 0; i < var->num_state_slots; i++) {
                _mesa_add_state_reference(prog->Parameters,
                                          (gl_state_index *)slots[i].tokens);
             }
          }
       }
    }
 
+   if (shProg->last_vert_prog) {
+      update_xfb_info(shProg->last_vert_prog->sh.LinkedTransformFeedback,
+                      &shProg->last_vert_prog->nir->info);
+   }
+
    /* The linker tries to dead code eliminate unused varying components,
     * and make sure interfaces match.  But it isn't able to do so in all
     * cases.  So, explicitly make the interfaces match by OR'ing together
     * the inputs_read/outputs_written bitfields of adjacent stages.
     */
    if (!shProg->SeparateShader)
       unify_interfaces(infos);
 
    if ((ctx->_Shader->Flags & GLSL_DUMP) && shProg->Name != 0) {
       for (unsigned i = 0; i < shProg->NumShaders; i++) {
-- 
2.14.3



More information about the mesa-dev mailing list