Mesa (staging/22.0): panfrost: Fix set_sampler_views for big GL
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 21:11:14 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: 76b498bd800fcdfc0c9b4cdd95b8e020b9d37560
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76b498bd800fcdfc0c9b4cdd95b8e020b9d37560
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon Sep 27 20:24:38 2021 -0400
panfrost: Fix set_sampler_views for big GL
Roughly use the freedreno logic to handle all the extra things that will
come up in our Piglit sooner than later.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13203>
(cherry picked from commit 304851422a4610170e870a5315fefaa5ec42917f)
---
.pick_status.json | 2 +-
src/gallium/drivers/panfrost/pan_context.c | 33 ++++++++++++++++--------------
2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index eaa4e7758bf..0bb15a74525 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
"description": "panfrost: Fix set_sampler_views for big GL",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index f7089c4cbc5..501c7ab78db 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -627,32 +627,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
More information about the mesa-commit
mailing list