nir: Use a single list for all shader variables

Instead of having separate lists of variables, roughly sorted by mode,
use a single list for all shader-level NIR variables.  This makes a few
list walks a bit longer here and there but list walks aren't a very
common thing in NIR at all.  On the other hand, it makes a lot of things
like validation, printing, etc. way simpler.  Also, there are a number
of cases where we move variables from inputs/outputs to globals and this
makes it way easier because we no longer have to move them between
lists.  We only have to deal with that if moving them from the shader to
a nir_function_impl.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
This commit is contained in:
Jason Ekstrand
2020-07-20 16:30:37 -05:00
committed by Marge Bot
parent 473b0fc25d
commit d70fff99c5
30 changed files with 186 additions and 320 deletions

View File

@@ -36,7 +36,9 @@ struct gl_nir_linker_options {
};
#define nir_foreach_gl_uniform_variable(var, shader) \
nir_foreach_variable(var, &(shader)->uniforms)
nir_foreach_variable_with_modes(var, shader, nir_var_uniform | \
nir_var_mem_ubo | \
nir_var_mem_ssbo)
bool gl_nir_link_spirv(struct gl_context *ctx,
struct gl_shader_program *prog,