Mesa (master): panfrost: Fix UBO count calculation on Bifrost
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 19:12:41 UTC 2021
Module: Mesa
Branch: master
Commit: c80c68cd496cecb2c7a594e23aa074649b9de7b0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c80c68cd496cecb2c7a594e23aa074649b9de7b0
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Sun Nov 22 18:53:22 2020 +0100
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 at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8418>
---
src/gallium/drivers/panfrost/pan_assemble.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
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;
More information about the mesa-commit
mailing list