glsl: move gl_nir_link_opts() call out of the st code

Calling this directly in the linker code allows us to place it between
the varying linker and uniform linker calls which allows for better
optimisation/removal of uniforms.

Also in a later patch it allows us to insert a new nir based
lower_const_arrays_to_uniforms() call after the gl_nir_link_opts()
call. This is important because it allows the linking opts to
move constant arrays to later stages if possible before
lower_const_arrays_to_uniforms() turns them into uniforms.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6541

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>
This commit is contained in:
Timothy Arceri
2022-05-31 09:55:02 +10:00
committed by Marge Bot
parent a14e2733ce
commit 1805ee8d7b
3 changed files with 47 additions and 30 deletions

View File

@@ -54,8 +54,6 @@ struct gl_nir_linker_options {
void gl_nir_opts(nir_shader *nir);
void gl_nir_link_opts(nir_shader *producer, nir_shader *consumer);
bool gl_nir_link_spirv(const struct gl_constants *consts,
struct gl_shader_program *prog,
const struct gl_nir_linker_options *options);