Mesa (master): panfrost: Handle disabled/empty UBOs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 20:00:12 UTC 2019
Module: Mesa
Branch: master
Commit: f28e9e868b42d3df67dba76cb363e55ec4eee424
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f28e9e868b42d3df67dba76cb363e55ec4eee424
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Thu Jun 20 16:51:08 2019 -0700
panfrost: Handle disabled/empty UBOs
Prevents an assert(0) later in this (not so edge) case. We still have to
have a dummy there.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_context.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 3c7b5bb0158..9a5e6702a92 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1311,9 +1311,21 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
/* The rest are honest-to-goodness UBOs */
for (unsigned ubo = 1; ubo < ubo_count; ++ubo) {
- mali_ptr gpu = panfrost_map_constant_buffer_gpu(ctx, buf, ubo);
size_t sz = buf->cb[ubo].buffer_size;
+ bool enabled = buf->enabled_mask & (1 << ubo);
+ bool empty = sz == 0;
+
+ if (!enabled || empty) {
+ /* Stub out disabled UBOs to catch accesses */
+
+ ubos[ubo].size = 0;
+ ubos[ubo].ptr = 0xDEAD0000;
+ continue;
+ }
+
+ mali_ptr gpu = panfrost_map_constant_buffer_gpu(ctx, buf, ubo);
+
unsigned bytes_per_field = 16;
unsigned aligned = ALIGN(sz, bytes_per_field);
unsigned fields = aligned / bytes_per_field;
More information about the mesa-commit
mailing list