Mesa (master): zink: handle NULL views in zink_set_sampler_views

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 18 17:12:06 UTC 2021


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon Jan 18 17:48:27 2021 +0100

zink: handle NULL views in zink_set_sampler_views

Passing NULL for the views parameter should be the same as passing an
array of NULL, according to the documentation. So let's respect that
detail.

This fixes a crash when using GALLIUM_HUD.

Fixes: 8d46e35d16e ("zink: introduce opengl over vulkan")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8564>

---

 src/gallium/drivers/zink/zink_context.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 4e938d1c369..8e89d15ecc8 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -610,11 +610,11 @@ zink_set_sampler_views(struct pipe_context *pctx,
                        struct pipe_sampler_view **views)
 {
    struct zink_context *ctx = zink_context(pctx);
-   assert(views);
    for (unsigned i = 0; i < num_views; ++i) {
+      struct pipe_sampler_view *pview = views ? views[i] : NULL;
       pipe_sampler_view_reference(
          &ctx->image_views[shader_type][start_slot + i],
-         views[i]);
+         pview);
    }
    ctx->num_image_views[shader_type] = start_slot + num_views;
 }



More information about the mesa-commit mailing list