tgsi_to_nir: Emit load_ubo_vec4 instead of load_ubo on non-integer HW.

Otherwise, we get an ishl that the HW can't support, and a ushr if the NIR
ends up being lowered to ubo_vec4, which may not get constant-folded if
the offset was non-constant.

This matches what mesa/st uses for this arg to uniform lowering.

Fixes: #5971
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14883>
This commit is contained in:
Emma Anholt 2022-02-04 11:29:27 -08:00 committed by Marge Bot
parent 535f0b9391
commit 09fd1e94fd

View file

@ -93,6 +93,7 @@ struct ttn_compile {
bool cap_position_is_sysval;
bool cap_point_is_sysval;
bool cap_samplers_as_deref;
bool cap_integers;
};
#define ttn_swizzle(b, src, x, y, z, w) \
@ -2276,6 +2277,7 @@ ttn_read_pipe_caps(struct ttn_compile *c,
c->cap_face_is_sysval = screen->get_param(screen, PIPE_CAP_FS_FACE_IS_INTEGER_SYSVAL);
c->cap_position_is_sysval = screen->get_param(screen, PIPE_CAP_FS_POSITION_IS_SYSVAL);
c->cap_point_is_sysval = screen->get_param(screen, PIPE_CAP_FS_POINT_IS_SYSVAL);
c->cap_integers = screen->get_shader_param(screen, c->scan->processor, PIPE_SHADER_CAP_INTEGERS);
}
/**
@ -2481,7 +2483,7 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
}
if (nir->options->lower_uniforms_to_ubo)
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, false, false);
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, false, !c->cap_integers);
if (!c->cap_samplers_as_deref)
NIR_PASS_V(nir, nir_lower_samplers);