Mesa (master): panfrost: Allow NULL for some binding functions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 1 03:14:24 UTC 2021


Module: Mesa
Branch: master
Commit: f3a00c351defca57f1871bf68814ade8782ed202
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3a00c351defca57f1871bf68814ade8782ed202

Author: Icecream95 <ixn at disroot.org>
Date:   Tue Dec 29 01:13:49 2020 +1300

panfrost: Allow NULL for some binding functions

Handle Clover passing NULL to bind_sampler_states and
set_sampler_views when cleaning up after launching a job.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8264>

---

 src/gallium/drivers/panfrost/pan_context.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index b4ae6609d6f..9be59505cf1 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -728,7 +728,10 @@ panfrost_bind_sampler_states(
 
         /* XXX: Should upload, not just copy? */
         ctx->sampler_count[shader] = num_sampler;
-        memcpy(ctx->samplers[shader], sampler, num_sampler * sizeof (void *));
+        if (sampler)
+                memcpy(ctx->samplers[shader], sampler, num_sampler * sizeof (void *));
+        else
+                memset(ctx->samplers[shader], 0, num_sampler * sizeof (void *));
 }
 
 static bool
@@ -1121,6 +1124,9 @@ panfrost_set_sampler_views(
 
         assert(start_slot == 0);
 
+        if (!views)
+                num_views = 0;
+
         for (i = 0; i < num_views; ++i) {
                 if (views[i])
                         new_nr = i + 1;



More information about the mesa-commit mailing list