summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2019-03-08 13:39:05 -0700
committerBrian Paul <[email protected]>2019-03-17 20:07:22 -0600
commit20de0359b53311cad322de8286448f2cbb34f475 (patch)
tree42d093401df00cd166ff71935fcd1c1689282e41
parent41c4c49463f65cd6c564b2a66634ba6572a824fb (diff)
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 <[email protected]> Reviewed-by: Neha Bhende <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-By: Jose Fonseca <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_context.c3
-rw-r--r--src/mesa/state_tracker/st_sampler_view.c6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index de2264da589..f03738452a7 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -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 */
diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
index b20a00cff7d..eb97f2bb6b7 100644
--- a/src/mesa/state_tracker/st_sampler_view.c
+++ b/src/mesa/state_tracker/st_sampler_view.c
@@ -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;
}