[Mesa-dev] [PATCH 6/8] i965: enable varying component packing for BDW+
Timothy Arceri
tarceri at itsqueeze.com
Tue Nov 14 23:35:22 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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 465cab767d..e9cf88dc86 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -297,40 +297,47 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
if (shProg->_LinkedShaders[i] == NULL)
continue;
brw_nir_link_shaders(compiler,
&shProg->_LinkedShaders[i]->Program->nir,
&shProg->_LinkedShaders[next]->Program->nir);
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->ctx.Cache) {
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;
}
+ if (brw->screen->devinfo.gen >= 8 && prev != -1) {
+ nir_compact_varyings(shProg->_LinkedShaders[prev]->Program->nir,
+ prog->nir, ctx->API != API_OPENGL_COMPAT);
+ }
+ prev = stage;
+
infos[stage] = &prog->nir->info;
/* 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) {
--
2.14.3
More information about the mesa-dev
mailing list