Mesa (staging/20.3): zink: handle NULL views in zink_set_sampler_views
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 19 17:49:23 UTC 2021
Module: Mesa
Branch: staging/20.3
Commit: 381a5de3eaa2083bccef456a405a2fe6d3e0d854
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=381a5de3eaa2083bccef456a405a2fe6d3e0d854
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>
(cherry picked from commit 333730405de28153f2378d498e45cb82024fc230)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_context.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index dab0ef8cfe0..6afddcf97be 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -418,7 +418,7 @@
"description": "zink: handle NULL views in zink_set_sampler_views",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "8d46e35d16e3936968958bcab86d61967a673305"
},
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 67465b862d4..b888274b18f 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -535,11 +535,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