gallium+mesa/st: lower uniforms based on compiler flag instead of packed uniforms cap

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6316>
This commit is contained in:
Gert Wollny 2020-09-13 21:31:27 +02:00 committed by Marge Bot
parent feb463da63
commit 123bdb61cc
3 changed files with 8 additions and 5 deletions

View file

@ -98,7 +98,8 @@ draw_create_vs_llvm(struct draw_context *draw,
for ir.nir & PIPE_SHADER_IR_NIR here. */
if (state->ir.nir && state->type == PIPE_SHADER_IR_NIR) {
vs->base.state.ir.nir = state->ir.nir;
if (!draw->pipe->screen->get_param(draw->pipe->screen, PIPE_CAP_PACKED_UNIFORMS))
nir_shader *nir = (nir_shader *)state->ir.nir;
if (!nir->options->lower_uniforms_to_ubo)
NIR_PASS_V(state->ir.nir, nir_lower_uniforms_to_ubo, 16);
nir_tgsi_scan_shader(state->ir.nir, &vs->base.info, true);
} else {

View file

@ -112,7 +112,6 @@ struct ttn_compile {
bool cap_face_is_sysval;
bool cap_position_is_sysval;
bool cap_point_is_sysval;
bool cap_packed_uniforms;
bool cap_samplers_as_deref;
};
@ -2371,7 +2370,6 @@ static void
ttn_read_pipe_caps(struct ttn_compile *c,
struct pipe_screen *screen)
{
c->cap_packed_uniforms = screen->get_param(screen, PIPE_CAP_PACKED_UNIFORMS);
c->cap_samplers_as_deref = screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF);
c->cap_face_is_sysval = screen->get_param(screen, PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL);
c->cap_position_is_sysval = screen->get_param(screen, PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL);
@ -2579,7 +2577,7 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
if (c->cap_packed_uniforms)
if (nir->options->lower_uniforms_to_ubo)
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 16);
if (!c->cap_samplers_as_deref)

View file

@ -917,16 +917,20 @@ st_unpacked_uniforms_type_size(const struct glsl_type *type, bool bindless)
void
st_nir_lower_uniforms(struct st_context *st, nir_shader *nir)
{
unsigned multiplier = 16;
if (st->ctx->Const.PackedDriverUniformStorage) {
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform,
st_packed_uniforms_type_size,
(nir_lower_io_options)0);
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
multiplier = 4;
} else {
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform,
st_unpacked_uniforms_type_size,
(nir_lower_io_options)0);
}
if (nir->options->lower_uniforms_to_ubo)
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, multiplier);
}
/* Last third of preparing nir from glsl, which happens after shader