Mesa (main): panfrost: Handle NULL sampler views
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 24 23:10:11 UTC 2022
Module: Mesa
Branch: main
Commit: 53ef20f08d4340c1bad0b45a2501f4daba7fb479
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53ef20f08d4340c1bad0b45a2501f4daba7fb479
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon Sep 27 20:24:01 2021 -0400
panfrost: Handle NULL sampler views
Fixes a NULL dereference in Piglit fp-fragment-position.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13203>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index e7e67830fdf..3ef83c3f4e1 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1376,6 +1376,12 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
+
+ if (!view) {
+ memset(&out[i], 0, sizeof(out[i]));
+ continue;
+ }
+
struct pipe_sampler_view *pview = &view->base;
struct panfrost_resource *rsrc = pan_resource(pview->texture);
@@ -1388,11 +1394,14 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
return T.gpu;
#else
- uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+ uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { 0 };
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
+ if (!view)
+ continue;
+
panfrost_update_sampler_view(view, &ctx->base);
trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
More information about the mesa-commit
mailing list