summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-11-01 20:32:12 +1100
committerTimothy Arceri <[email protected]>2017-11-08 17:33:14 +1100
commit36be8c2fcf94f5d800aed6c3d39ef23b226fd0d5 (patch)
treefbaad3d4e165240a22939c170a63057e2b3514cc
parentc980a3aa31335b9198814f7bb98e9cde01895444 (diff)
st/glsl_to_nir: use nir_shader_gather_info()
Use the NIR helper rather than the GLSL IR helper to get in/out masks. This allows us to ignore varyings removed by NIR optimisations. Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index d59e4725844..7f4651a3ccd 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -273,16 +273,12 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
*/
_mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
- st_set_prog_affected_state_flags(prog);
-
NIR_PASS_V(nir, nir_lower_io_to_temporaries,
nir_shader_get_entrypoint(nir),
true, true);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies);
- NIR_PASS_V(nir, st_nir_lower_builtin);
- NIR_PASS_V(nir, nir_lower_atomics, shader_program);
/* fragment shaders may need : */
if (stage == MESA_SHADER_FRAGMENT) {
@@ -309,6 +305,16 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
}
}
+ NIR_PASS_V(nir, nir_lower_system_values);
+
+ nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
+ prog->info = nir->info;
+
+ st_set_prog_affected_state_flags(prog);
+
+ NIR_PASS_V(nir, st_nir_lower_builtin);
+ NIR_PASS_V(nir, nir_lower_atomics, shader_program);
+
if (st->ctx->_Shader->Flags & GLSL_DUMP) {
_mesa_log("\n");
_mesa_log("NIR IR for linked %s program %d:\n",
@@ -394,8 +400,6 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
st_nir_assign_uniform_locations(prog, shader_program,
&nir->uniforms, &nir->num_uniforms);
- NIR_PASS_V(nir, nir_lower_system_values);
-
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
NIR_PASS_V(nir, nir_lower_samplers_as_deref, shader_program);
else
@@ -416,8 +420,6 @@ st_nir_get_mesa_program(struct gl_context *ctx,
prog->Parameters = _mesa_new_parameter_list();
- do_set_program_inouts(shader->ir, prog, shader->Stage);
-
_mesa_copy_linked_program_data(shader_program, shader);
_mesa_generate_parameters_list_for_uniforms(ctx, shader_program, shader,
prog->Parameters);