diff options
author | Brian Paul <[email protected]> | 2019-03-06 16:20:55 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2019-03-11 20:08:16 -0600 |
commit | 187a527ed762b10e6e3156c678fea7aab0789157 (patch) | |
tree | 6bf0120e121ffb0f9f4495617e99b991adfd910c /src/mesa | |
parent | 70a2ede112acb589ee4310a0b3f7476fc1629b51 (diff) |
st/mesa: minor refactoring of texture/sampler delete code
Rename st_texture_free_sampler_views() to
st_delete_texture_sampler_views() to align with
st_DeleteTextureObject(), its only caller.
Move the call to st_texture_release_all_sampler_views() from
st_DeleteTextureObject() to st_delete_texture_sampler_views()
so all the sampler view clean-up code is in one place.
Reviewed-by: Neha Bhende <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_sampler_view.c | 11 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_sampler_view.h | 3 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 47d06122ec1..2caf61e8943 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -187,8 +187,7 @@ st_DeleteTextureObject(struct gl_context *ctx, struct st_texture_object *stObj = st_texture_object(texObj); pipe_resource_reference(&stObj->pt, NULL); - st_texture_release_all_sampler_views(st, stObj); - st_texture_free_sampler_views(stObj); + st_delete_texture_sampler_views(st, stObj); simple_mtx_destroy(&stObj->validate_mutex); _mesa_delete_texture_object(ctx, texObj); } diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c index 17c209c867f..e4eaf395950 100644 --- a/src/mesa/state_tracker/st_sampler_view.c +++ b/src/mesa/state_tracker/st_sampler_view.c @@ -231,15 +231,20 @@ st_texture_release_all_sampler_views(struct st_context *st, /* - * Free the texture's st_sampler_views objects. This should be called - * after st_texture_release_all_sampler_views(). + * Delete the texture's sampler views and st_sampler_views containers. + * This is to be called just before a texture is deleted. */ void -st_texture_free_sampler_views(struct st_texture_object *stObj) +st_delete_texture_sampler_views(struct st_context *st, + struct st_texture_object *stObj) { + st_texture_release_all_sampler_views(st, stObj); + + /* Free the container of the current per-context sampler views */ free(stObj->sampler_views); stObj->sampler_views = NULL; + /* Free old sampler view containers */ while (stObj->sampler_views_old) { struct st_sampler_views *views = stObj->sampler_views_old; stObj->sampler_views_old = views->next; diff --git a/src/mesa/state_tracker/st_sampler_view.h b/src/mesa/state_tracker/st_sampler_view.h index d7a4c0d8d60..1bd664d3ba6 100644 --- a/src/mesa/state_tracker/st_sampler_view.h +++ b/src/mesa/state_tracker/st_sampler_view.h @@ -66,7 +66,8 @@ st_texture_release_all_sampler_views(struct st_context *st, struct st_texture_object *stObj); void -st_texture_free_sampler_views(struct st_texture_object *stObj); +st_delete_texture_sampler_views(struct st_context *st, + struct st_texture_object *stObj); const struct st_sampler_view * st_texture_get_current_sampler_view(const struct st_context *st, |