diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 48dcd0fe3d5..8e45025f1ca 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -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;