panfrost: Handle NULL sampler views

Fixes a NULL dereference in Piglit fp-fragment-position.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13203>
This commit is contained in:
Alyssa Rosenzweig 2021-09-27 20:24:01 -04:00 committed by Marge Bot
parent 304851422a
commit 53ef20f08d
1 changed files with 10 additions and 1 deletions

View File

@ -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);