st/mesa: stop using pipe_sampler_view_release()

In all instances here we can replace pipe_sampler_view_release(pipe,
view) with pipe_sampler_view_reference(view, NULL) because the views
in question are private to the state tracker context.  So there's no
danger of freeing a sampler view with the wrong context.

Testing done: google chrome, misc GL demos, games

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul 2019-03-08 13:39:05 -07:00
parent 41c4c49463
commit 20de0359b5
2 changed files with 4 additions and 5 deletions

View File

@ -434,8 +434,7 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
st_destroy_bound_image_handles(st);
for (i = 0; i < ARRAY_SIZE(st->state.frag_sampler_views); i++) {
pipe_sampler_view_release(st->pipe,
&st->state.frag_sampler_views[i]);
pipe_sampler_view_reference(&st->state.frag_sampler_views[i], NULL);
}
/* free glReadPixels cache data */

View File

@ -74,7 +74,7 @@ st_texture_set_sampler_view(struct st_context *st,
if (sv->view) {
/* check if the context matches */
if (sv->view->context == st->pipe) {
pipe_sampler_view_release(st->pipe, &sv->view);
pipe_sampler_view_reference(&sv->view, NULL);
goto found;
}
} else {
@ -94,13 +94,13 @@ st_texture_set_sampler_view(struct st_context *st,
if (new_max < views->max ||
new_max > (UINT_MAX - sizeof(*views)) / sizeof(views->views[0])) {
pipe_sampler_view_release(st->pipe, &view);
pipe_sampler_view_reference(&view, NULL);
goto out;
}
struct st_sampler_views *new_views = malloc(new_size);
if (!new_views) {
pipe_sampler_view_release(st->pipe, &view);
pipe_sampler_view_reference(&view, NULL);
goto out;
}