glsl: implement lower_packed_varyings() as a NIR pass

This is essentially the old GLSL IR packing pass rewritten as a
NIR based pass.

Doing this packing in NIR after we have preformed NIRs
optimisation passes can give us better packing results.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15731>
This commit is contained in:
Timothy Arceri 2021-11-23 12:43:18 +11:00 committed by Marge Bot
parent c1fbd0b8ab
commit e3a45a4778
3 changed files with 1096 additions and 0 deletions

View file

@ -28,7 +28,11 @@
extern "C" {
#endif
#include <stdbool.h>
struct nir_shader;
struct gl_constants;
struct gl_linked_shader;
struct gl_shader_program;
bool gl_nir_lower_atomics(nir_shader *shader,
@ -44,6 +48,16 @@ bool gl_nir_lower_samplers_as_deref(nir_shader *shader,
bool gl_nir_lower_buffers(nir_shader *shader,
const struct gl_shader_program *shader_program);
void gl_nir_lower_packed_varyings(const struct gl_constants *consts,
struct gl_shader_program *prog,
void *mem_ctx, unsigned locations_used,
const uint8_t *components,
nir_variable_mode mode,
unsigned gs_input_vertices,
struct gl_linked_shader *linked_shader,
bool disable_varying_packing,
bool disable_xfb_packing, bool xfb_enabled);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -86,6 +86,7 @@ files_libglsl = files(
'gl_nir_lower_atomics.c',
'gl_nir_lower_images.c',
'gl_nir_lower_buffers.c',
'gl_nir_lower_packed_varyings.c',
'gl_nir_lower_samplers.c',
'gl_nir_lower_samplers_as_deref.c',
'gl_nir_link_atomics.c',