panfrost: Fix UBO count calculation on Bifrost

The Bifrost compiler relies on nir_lower_uniforms_to_ubo() to lower
uniforms to UBOs, and s->info.num_ubos is already incremented when a
UBO #0 is created.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8418>
This commit is contained in:
Boris Brezillon 2020-11-22 18:53:22 +01:00 committed by Marge Bot
parent 67de6356f8
commit c80c68cd49

View file

@ -380,7 +380,17 @@ panfrost_shader_compile(struct panfrost_context *ctx,
/* Needed for linkage */
state->attribute_count = attribute_count;
state->varying_count = varying_count;
state->ubo_count = s->info.num_ubos + 1; /* off-by-one for uniforms */
/* off-by-one for uniforms. Not needed on Bifrost since uniforms
* have been lowered to UBOs using nir_lower_uniforms_to_ubo() which
* already increments s->info.num_ubos. We do have to account for the
* "no uniform, no UBO" case though, otherwise sysval passed through
* uniforms won't work correctly.
*/
if (dev->quirks & IS_BIFROST)
state->ubo_count = MAX2(s->info.num_ubos, 1);
else
state->ubo_count = s->info.num_ubos + 1;
/* Prepare the descriptors at compile-time */
state->shader.shader = shader;