mesa: don't count buffer references for the context that created them

See mtypes.h - it gives you the top level view of how it works, and other
code contains a lot of comments.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8606>
This commit is contained in:
Marek Olšák
2021-01-04 15:25:18 -05:00
committed by Marge Bot
parent c679e7debd
commit e014e3b6be
7 changed files with 272 additions and 10 deletions

View File

@@ -1346,7 +1346,6 @@ _mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output)
_mesa_reference_vao(ctx, &ctx->Array._DrawVAO, NULL);
_mesa_free_attrib_data(ctx);
_mesa_free_buffer_objects(ctx);
_mesa_free_eval_data( ctx );
_mesa_free_texture_data( ctx );
_mesa_free_image_textures(ctx);
@@ -1367,6 +1366,11 @@ _mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output)
_mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj, NULL);
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
/* This must be called after all buffers are unbound because global buffer
* references that this context holds will be removed.
*/
_mesa_free_buffer_objects(ctx);
/* free dispatch tables */
free(ctx->BeginEnd);
free(ctx->OutsideBeginEnd);