summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-04-21 21:22:14 -0400
committerMarge Bot <eric+marge@anholt.net>2021-05-05 05:17:25 +0000
commit9ee2b8209a54dd00394034ad77e4222ec6f7b590 (patch)
tree815e6b537416e1a013a610d0261f904270d9c34d
parente7a15973bbc94d3922111d2a68ce8fae93f1f19f (diff)
gallium/u_threaded: handle sampler views == NULL better
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.eric.pelloux-prayer@amd.com> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10606>
-rw-r--r--src/gallium/auxiliary/util/u_threaded_context.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 301b66627f0..f37a8a9eff1 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1040,20 +1040,23 @@ tc_set_sampler_views(struct pipe_context *_pipe,
struct threaded_context *tc = threaded_context(_pipe);
struct tc_sampler_views *p =
- tc_add_slot_based_call(tc, TC_CALL_set_sampler_views, tc_sampler_views, count);
+ tc_add_slot_based_call(tc, TC_CALL_set_sampler_views, tc_sampler_views,
+ views ? count : 0);
p->shader = shader;
p->start = start;
- p->count = count;
- p->unbind_num_trailing_slots = unbind_num_trailing_slots;
if (views) {
+ p->count = count;
+ p->unbind_num_trailing_slots = unbind_num_trailing_slots;
+
for (unsigned i = 0; i < count; i++) {
p->slot[i] = NULL;
pipe_sampler_view_reference(&p->slot[i], views[i]);
}
} else {
- memset(p->slot, 0, count * sizeof(views[0]));
+ p->count = 0;
+ p->unbind_num_trailing_slots = count + unbind_num_trailing_slots;
}
}