Commit 123bdb61 authored by Gert Wollny's avatar Gert Wollny Committed by Marge Bot

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

Signed-off-by: Gert Wollny's avatarGert Wollny <gert.wollny@collabora.com>
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Part-of: <!6316>
parent feb463da
Pipeline #202277 waiting for manual action with stages
......@@ -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 {
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment