mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
aux/trace: use private refcounts for samplerviews
this avoids having the driver bypass the samplerview wrapper and destroying the samplerview prematurely, e.g., spec@sgis_generate_mipmap@gen-texsubimage Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12546>
This commit is contained in:
parent
1a554fd610
commit
7f5a353012
2 changed files with 11 additions and 0 deletions
|
|
@ -1022,6 +1022,8 @@ trace_context_create_sampler_view(struct pipe_context *_pipe,
|
|||
pipe_resource_reference(&tr_view->base.texture, resource);
|
||||
tr_view->base.context = _pipe;
|
||||
tr_view->sampler_view = result;
|
||||
result->reference.count += 100000000;
|
||||
tr_view->refcount = 100000000;
|
||||
result = &tr_view->base;
|
||||
|
||||
return result;
|
||||
|
|
@ -1042,6 +1044,7 @@ trace_context_sampler_view_destroy(struct pipe_context *_pipe,
|
|||
trace_dump_arg(ptr, pipe);
|
||||
trace_dump_arg(ptr, view);
|
||||
|
||||
p_atomic_add(&tr_view->sampler_view->reference.count, -tr_view->refcount);
|
||||
pipe_sampler_view_reference(&tr_view->sampler_view, NULL);
|
||||
|
||||
trace_dump_call_end();
|
||||
|
|
@ -1126,6 +1129,13 @@ trace_context_set_sampler_views(struct pipe_context *_pipe,
|
|||
|
||||
for (i = 0; i < num; ++i) {
|
||||
tr_view = trace_sampler_view(views[i]);
|
||||
if (tr_view) {
|
||||
tr_view->refcount--;
|
||||
if (!tr_view->refcount) {
|
||||
tr_view->refcount = 100000000;
|
||||
p_atomic_add(&tr_view->sampler_view->reference.count, tr_view->refcount);
|
||||
}
|
||||
}
|
||||
unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
|
||||
}
|
||||
views = unwrapped_views;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ struct trace_surface
|
|||
struct trace_sampler_view
|
||||
{
|
||||
struct pipe_sampler_view base;
|
||||
unsigned refcount;
|
||||
|
||||
struct pipe_sampler_view *sampler_view;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue