mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-19 08:50:25 +01:00
llvmpipe: fix sampler/image binding for clover.
Clover uses these APIs a bit different, avoid crashes Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069>
This commit is contained in:
parent
874371876e
commit
cda192dc15
1 changed files with 13 additions and 5 deletions
|
|
@ -82,7 +82,11 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe,
|
|||
|
||||
/* set the new samplers */
|
||||
for (i = 0; i < num; i++) {
|
||||
llvmpipe->samplers[shader][start + i] = samplers[i];
|
||||
void *sampler = NULL;
|
||||
|
||||
if (samplers && samplers[i])
|
||||
sampler = samplers[i];
|
||||
llvmpipe->samplers[shader][start + i] = sampler;
|
||||
}
|
||||
|
||||
/* find highest non-null samplers[] entry */
|
||||
|
|
@ -129,20 +133,24 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
|
|||
|
||||
/* set the new sampler views */
|
||||
for (i = 0; i < num; i++) {
|
||||
struct pipe_sampler_view *view = NULL;
|
||||
|
||||
if (views && views[i])
|
||||
view = views[i];
|
||||
/*
|
||||
* Warn if someone tries to set a view created in a different context
|
||||
* (which is why we need the hack above in the first place).
|
||||
* An assert would be better but st/mesa relies on it...
|
||||
*/
|
||||
if (views[i] && views[i]->context != pipe) {
|
||||
if (view && view->context != pipe) {
|
||||
debug_printf("Illegal setting of sampler_view %d created in another "
|
||||
"context\n", i);
|
||||
}
|
||||
|
||||
if (views[i])
|
||||
llvmpipe_flush_resource(pipe, views[i]->texture, 0, true, false, false, "sampler_view");
|
||||
if (view)
|
||||
llvmpipe_flush_resource(pipe, view->texture, 0, true, false, false, "sampler_view");
|
||||
pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i],
|
||||
views[i]);
|
||||
view);
|
||||
}
|
||||
|
||||
/* find highest non-null sampler_views[] entry */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue