nir: Add nir_foreach_shader_in/out_variable helpers

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
This commit is contained in:
Jason Ekstrand
2020-07-18 18:24:25 -05:00
committed by Marge Bot
parent 9bf8572222
commit 2956d53400
58 changed files with 125 additions and 116 deletions

View File

@@ -1517,7 +1517,7 @@ ntq_setup_vs_inputs(struct v3d_compile *c)
* from the start of the attribute to the number of components we
* declare we need in c->vattr_sizes[].
*/
nir_foreach_variable(var, &c->s->inputs) {
nir_foreach_shader_in_variable(var, c->s) {
/* No VS attribute array support. */
assert(MAX2(glsl_get_length(var->type), 1) == 1);
@@ -1582,7 +1582,7 @@ ntq_setup_vs_inputs(struct v3d_compile *c)
static bool
program_reads_point_coord(struct v3d_compile *c)
{
nir_foreach_variable(var, &c->s->inputs) {
nir_foreach_shader_in_variable(var, c->s) {
if (util_varying_is_point_coord(var->data.location,
c->fs_key->point_sprite_mask)) {
return true;
@@ -1598,13 +1598,13 @@ get_sorted_input_variables(struct v3d_compile *c,
nir_variable ***vars)
{
*num_entries = 0;
nir_foreach_variable(var, &c->s->inputs)
nir_foreach_shader_in_variable(var, c->s)
(*num_entries)++;
*vars = ralloc_array(c, nir_variable *, *num_entries);
unsigned i = 0;
nir_foreach_variable(var, &c->s->inputs)
nir_foreach_shader_in_variable(var, c->s)
(*vars)[i++] = var;
/* Sort the variables so that we emit the input setup in
@@ -1687,7 +1687,7 @@ ntq_setup_outputs(struct v3d_compile *c)
if (c->s->info.stage != MESA_SHADER_FRAGMENT)
return;
nir_foreach_variable(var, &c->s->outputs) {
nir_foreach_shader_out_variable(var, c->s) {
unsigned array_len = MAX2(glsl_get_length(var->type), 1);
unsigned loc = var->data.driver_location * 4;