summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c')
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c b/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c
index d235c8db5..a1daca18f 100644
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1367,6 +1367,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);
@@ -1379,11 +1385,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);
@@ -1411,8 +1420,11 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch,
SAMPLER);
struct mali_sampler_packed *out = (struct mali_sampler_packed *) T.cpu;
- for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i)
- out[i] = ctx->samplers[stage][i]->hw;
+ for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i) {
+ struct panfrost_sampler_state *st = ctx->samplers[stage][i];
+
+ out[i] = st ? st->hw : (struct mali_sampler_packed){0};
+ }
return T.gpu;
}