diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_sol.c | 7 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 39 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.h | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_xformfb.c | 7 |
4 files changed, 29 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c index 1d5f26ab0c0..bda015e6cc5 100644 --- a/src/mesa/drivers/dri/i965/gen6_sol.c +++ b/src/mesa/drivers/dri/i965/gen6_sol.c @@ -211,15 +211,10 @@ brw_delete_transform_feedback(struct gl_context *ctx, struct brw_transform_feedback_object *brw_obj = (struct brw_transform_feedback_object *) obj; - for (unsigned i = 0; i < ARRAY_SIZE(obj->Buffers); i++) { - _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); - } - brw_bo_unreference(brw_obj->offset_bo); brw_bo_unreference(brw_obj->prim_count_bo); - free(obj->Label); - free(brw_obj); + _mesa_delete_transform_feedback_object(ctx, obj); } /** 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; diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h index 78a6c3377dd..063e295a2ec 100644 --- a/src/mesa/main/transformfeedback.h +++ b/src/mesa/main/transformfeedback.h @@ -108,6 +108,11 @@ extern void _mesa_init_transform_feedback_object(struct gl_transform_feedback_object *obj, GLuint name); +extern void +_mesa_delete_transform_feedback_object(struct gl_context *ctx, + struct gl_transform_feedback_object + *obj); + struct gl_transform_feedback_object * _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name); diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c index e591c58d2b7..476eb9be02b 100644 --- a/src/mesa/state_tracker/st_cb_xformfb.c +++ b/src/mesa/state_tracker/st_cb_xformfb.c @@ -96,12 +96,7 @@ st_delete_transform_feedback(struct gl_context *ctx, pipe_so_target_reference(&sobj->targets[i], NULL); } - for (i = 0; i < ARRAY_SIZE(sobj->base.Buffers); i++) { - _mesa_reference_buffer_object(ctx, &sobj->base.Buffers[i], NULL); - } - - free(obj->Label); - free(obj); + _mesa_delete_transform_feedback_object(ctx, obj); } |