diff options
Diffstat (limited to 'lib/mesa/src/gallium/drivers/panfrost/pan_context.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/panfrost/pan_context.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_context.c b/lib/mesa/src/gallium/drivers/panfrost/pan_context.c index 69bbc43f8..81722f05c 100644 --- a/lib/mesa/src/gallium/drivers/panfrost/pan_context.c +++ b/lib/mesa/src/gallium/drivers/panfrost/pan_context.c @@ -628,32 +628,35 @@ panfrost_set_sampler_views( struct panfrost_context *ctx = pan_context(pctx); ctx->dirty_shader[shader] |= PAN_DIRTY_STAGE_TEXTURE; - unsigned new_nr = 0; unsigned i; - assert(start_slot == 0); - - if (!views) - num_views = 0; - for (i = 0; i < num_views; ++i) { - if (views[i]) - new_nr = i + 1; + struct pipe_sampler_view *view = views ? views[i] : NULL; + unsigned p = i + start_slot; + if (take_ownership) { - pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][i], + pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][p], NULL); - ctx->sampler_views[shader][i] = (struct panfrost_sampler_view *)views[i]; + ctx->sampler_views[shader][i] = (struct panfrost_sampler_view *)view; } else { - pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][i], - views[i]); + pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][p], + view); } } - for (; i < ctx->sampler_view_count[shader]; i++) { - pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][i], + for (; i < num_views + unbind_num_trailing_slots; i++) { + unsigned p = i + start_slot; + pipe_sampler_view_reference((struct pipe_sampler_view **)&ctx->sampler_views[shader][p], NULL); } - ctx->sampler_view_count[shader] = new_nr; + + /* Recalculate sampler view count */ + ctx->sampler_view_count[shader] = 0; + + for (i = 0; i < ARRAY_SIZE(ctx->sampler_views[shader]); ++i) { + if (ctx->sampler_views[shader][i]) + ctx->sampler_view_count[shader] = i + 1; + } } static void @@ -668,6 +671,8 @@ panfrost_set_shader_buffers( util_set_shader_buffers_mask(ctx->ssbo[shader], &ctx->ssbo_mask[shader], buffers, start, count); + + ctx->dirty_shader[shader] |= PAN_DIRTY_STAGE_SSBO; } static void |