summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-09-12 17:45:47 +1000
committerTimothy Arceri <[email protected]>2017-09-26 22:37:02 +1000
commit833e4dd41aecf7c96bfc6bf616d14553d580b016 (patch)
tree05482b5a920283787ca8b2b96f3d52fe3d5d225d /src/mesa/drivers
parent348cf74792a394aae1efd541192d4a3c219584bb (diff)
i965: call brw_shader_gather_info() from the callers of brw_create_nir()
This will allow us to insert a nir linking step in brw_link_shader(). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp14
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c11
2 files changed, 18 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index c0fda0d4799..b7fab8d7a25 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -251,6 +251,20 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
compiler->scalar_stage[stage]);
+ }
+
+ 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;
+ nir_shader *nir = shader->Program->nir;
+ brw_shader_gather_info(nir, prog);
+
+ NIR_PASS_V(nir, nir_lower_samplers, shProg);
+ NIR_PASS_V(nir, nir_lower_atomics, shProg);
+
infos[stage] = &prog->nir->info;
update_xfb_info(prog->sh.LinkedTransformFeedback, infos[stage]);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index a1154d95e0d..094bba43db1 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -107,13 +107,6 @@ brw_create_nir(struct brw_context *brw,
NIR_PASS(progress, nir, nir_lower_system_values);
NIR_PASS_V(nir, brw_nir_lower_uniforms, is_scalar);
- brw_shader_gather_info(nir, prog);
-
- if (shader_prog) {
- NIR_PASS_V(nir, nir_lower_samplers, shader_prog);
- NIR_PASS_V(nir, nir_lower_atomics, shader_prog);
- }
-
return nir;
}
@@ -223,6 +216,8 @@ brwProgramStringNotify(struct gl_context *ctx,
prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_FRAGMENT, true);
+ brw_shader_gather_info(prog->nir, prog);
+
brw_fs_precompile(ctx, prog);
break;
}
@@ -245,6 +240,8 @@ brwProgramStringNotify(struct gl_context *ctx,
prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_VERTEX,
compiler->scalar_stage[MESA_SHADER_VERTEX]);
+ brw_shader_gather_info(prog->nir, prog);
+
brw_vs_precompile(ctx, prog);
break;
}