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>
This commit is contained in:
Marek Olšák 2021-04-21 21:22:14 -04:00 committed by Marge Bot
parent e7a15973bb
commit 9ee2b8209a
1 changed files with 7 additions and 4 deletions

View File

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