[Mesa-dev] [PATCH 3/7] i965: enable varying component packing for BDW+
Timothy Arceri
tarceri at itsqueeze.com
Mon Oct 23 00:10:44 UTC 2017
shader-db results BDW:
total instructions in shared programs: 13192895 -> 13182437 (-0.08%)
instructions in affected programs: 827145 -> 816687 (-1.26%)
helped: 5199
HURT: 116
total cycles in shared programs: 539249342 -> 539156566 (-0.02%)
cycles in affected programs: 21894552 -> 21801776 (-0.42%)
helped: 10667
HURT: 7196
LOST: 0
GAINED: 17
---
src/mesa/drivers/dri/i965/brw_link.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index e4b642f49d..73dec88478 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -320,31 +320,45 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
consumer = brw_nir_optimize(consumer, compiler, c_is_scalar);
}
shProg->_LinkedShaders[i]->Program->nir = producer;
shProg->_LinkedShaders[next]->Program->nir = consumer;
next = i;
}
}
+ int prev = -1;
for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
if (!shader)
continue;
struct gl_program *prog = shader->Program;
brw_shader_gather_info(prog->nir, prog);
NIR_PASS_V(prog->nir, nir_lower_samplers, shProg);
NIR_PASS_V(prog->nir, nir_lower_atomics, shProg);
+ if (brw->screen->devinfo.gen >= 8 && prev != -1) {
+ nir_compact_varyings(shProg->_LinkedShaders[prev]->Program->nir,
+ prog->nir, ctx->API != API_OPENGL_COMPAT);
+
+ /* TODO: In future nir_compact_varyings() should update the varying
+ * input/output mask to reflect the packing it has just done. However
+ * until we have an array/matrix splitting pass we would just be
+ * duplicating the complex partial marking code in nir_gather_info().
+ */
+ brw_shader_gather_info(prog->nir, prog);
+ }
+ prev = stage;
+
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.
--
2.13.6
More information about the mesa-dev
mailing list