From 0325860e90f928b7022edfe2d0355cbf0c496463 Mon Sep 17 00:00:00 2001 From: Yevhenii Kolesnikov Date: Thu, 1 Aug 2019 16:05:29 +0300 Subject: mesa: Use _mesa_delete_transform_feedback_object in drivers Function _mesa_delete_transform_feedback_object called from within drivers once driver-specific clean-up has been done. Brings into conformity with how other GL objects are handled. CC: Eric Anholt CC: Kenneth Graunke Signed-off-by: Yevhenii Kolesnikov Reviewed-by: Eric Anholt Reviewed-by: Lionel Landwerlin --- src/mesa/main/transformfeedback.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src/mesa/main/transformfeedback.c') diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 8eccdc20b76..06719b1ce82 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -198,6 +198,27 @@ _mesa_init_transform_feedback_object(struct gl_transform_feedback_object *obj, obj->EverBound = GL_FALSE; } +/** + * Delete a transform feedback object. Called via + * ctx->Driver->DeleteTransformFeedback, if not overwritten by driver. In + * the latter case, called from the driver after all driver-specific clean-up + * has been done. + * + * \param ctx GL context to wich transform feedback object belongs. + * \param obj Transform feedback object due to be deleted. + */ +void +_mesa_delete_transform_feedback_object(struct gl_context *ctx, + struct gl_transform_feedback_object + *obj) +{ + for (unsigned i = 0; i < ARRAY_SIZE(obj->Buffers); i++) { + _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); + } + + free(obj->Label); + free(obj); +} /** Default fallback for ctx->Driver.NewTransformFeedback() */ static struct gl_transform_feedback_object * @@ -213,22 +234,6 @@ new_transform_feedback_fallback(struct gl_context *ctx, GLuint name) return obj; } -/** Default fallback for ctx->Driver.DeleteTransformFeedback() */ -static void -delete_transform_feedback_fallback(struct gl_context *ctx, - struct gl_transform_feedback_object *obj) -{ - GLuint i; - - for (i = 0; i < ARRAY_SIZE(obj->Buffers); i++) { - _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); - } - - free(obj->Label); - free(obj); -} - - /** Default fallback for ctx->Driver.BeginTransformFeedback() */ static void begin_transform_feedback_fallback(struct gl_context *ctx, GLenum mode, @@ -270,7 +275,7 @@ void _mesa_init_transform_feedback_functions(struct dd_function_table *driver) { driver->NewTransformFeedback = new_transform_feedback_fallback; - driver->DeleteTransformFeedback = delete_transform_feedback_fallback; + driver->DeleteTransformFeedback = _mesa_delete_transform_feedback_object; driver->BeginTransformFeedback = begin_transform_feedback_fallback; driver->EndTransformFeedback = end_transform_feedback_fallback; driver->PauseTransformFeedback = pause_transform_feedback_fallback; -- cgit v1.2.3