used_outputs[comp] |= 1ull << slot;
}
NIR_PASS_V(c->s, nir_remove_unused_io_vars,
- &c->s->outputs, used_outputs, NULL); /* demotes to globals */
+ nir_var_shader_out, used_outputs, NULL); /* demotes to globals */
NIR_PASS_V(c->s, nir_lower_global_vars_to_local);
v3d_optimize_nir(c->s);
NIR_PASS_V(c->s, nir_remove_dead_variables, nir_var_shader_in, NULL);
used_outputs[comp] |= 1ull << slot;
}
NIR_PASS_V(c->s, nir_remove_unused_io_vars,
- &c->s->outputs, used_outputs, NULL); /* demotes to globals */
+ nir_var_shader_out, used_outputs, NULL); /* demotes to globals */
NIR_PASS_V(c->s, nir_lower_global_vars_to_local);
v3d_optimize_nir(c->s);
NIR_PASS_V(c->s, nir_remove_dead_variables, nir_var_shader_in, NULL);
/* Some helpers to do very simple linking */
bool nir_remove_unused_varyings(nir_shader *producer, nir_shader *consumer);
-bool nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,
+bool nir_remove_unused_io_vars(nir_shader *shader, nir_variable_mode mode,
uint64_t *used_by_other_stage,
uint64_t *used_by_other_stage_patches);
void nir_compact_varyings(nir_shader *producer, nir_shader *consumer,
*
* Example usage is:
*
- * progress = nir_remove_unused_io_vars(producer,
- * &producer->outputs,
+ * progress = nir_remove_unused_io_vars(producer, nir_var_shader_out,
* read, patches_read) ||
* progress;
*
* variable is used!
*/
bool
-nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,
+nir_remove_unused_io_vars(nir_shader *shader,
+ nir_variable_mode mode,
uint64_t *used_by_other_stage,
uint64_t *used_by_other_stage_patches)
{
bool progress = false;
uint64_t *used;
+ assert(mode == nir_var_shader_in || mode == nir_var_shader_out);
+ struct exec_list *var_list =
+ mode == nir_var_shader_in ? &shader->inputs : &shader->outputs;
+
nir_foreach_variable_safe(var, var_list) {
if (var->data.patch)
used = used_by_other_stage_patches;
tcs_add_output_reads(producer, read, patches_read);
bool progress = false;
- progress = nir_remove_unused_io_vars(producer, &producer->outputs, read,
+ progress = nir_remove_unused_io_vars(producer, nir_var_shader_out, read,
patches_read);
- progress = nir_remove_unused_io_vars(consumer, &consumer->inputs, written,
+ progress = nir_remove_unused_io_vars(consumer, nir_var_shader_in, written,
patches_written) || progress;
return progress;