diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/transformfeedback.c | 50 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.h | 22 |
2 files changed, 48 insertions, 24 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 26a3a4b3d0d..f86f1911d1d 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -134,10 +134,8 @@ _mesa_validate_transform_feedback_buffers(GLcontext *ctx) void _mesa_init_transform_feedback(GLcontext *ctx) { - if (!ctx->Driver.NewTransformFeedback) { - /* this feature/extension may not be supported by the driver */ - return; - } + /* core mesa expects this, even a dummy one, to be available */ + ASSERT(ctx->Driver.NewTransformFeedback); ctx->TransformFeedback.DefaultObject = ctx->Driver.NewTransformFeedback(ctx, 0); @@ -178,10 +176,8 @@ delete_cb(GLuint key, void *data, void *userData) void _mesa_free_transform_feedback(GLcontext *ctx) { - if (!ctx->Driver.NewTransformFeedback) { - /* this feature/extension may not be supported by the driver */ - return; - } + /* core mesa expects this, even a dummy one, to be available */ + ASSERT(ctx->Driver.NewTransformFeedback); _mesa_reference_buffer_object(ctx, &ctx->TransformFeedback.CurrentBuffer, @@ -200,6 +196,40 @@ _mesa_free_transform_feedback(GLcontext *ctx) } +#else /* FEATURE_EXT_transform_feedback */ + +/* forward declarations */ +static struct gl_transform_feedback_object * +new_transform_feedback(GLcontext *ctx, GLuint name); + +static void +delete_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + +/* dummy per-context init/clean-up for transform feedback */ +void +_mesa_init_transform_feedback(GLcontext *ctx) +{ + ctx->TransformFeedback.DefaultObject = new_transform_feedback(ctx, 0); + ctx->TransformFeedback.CurrentObject = ctx->TransformFeedback.DefaultObject; + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + ctx->Shared->NullBufferObj); +} + +void +_mesa_free_transform_feedback(GLcontext *ctx) +{ + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + NULL); + ctx->TransformFeedback.CurrentObject = NULL; + delete_transform_feedback(ctx, ctx->TransformFeedback.DefaultObject); +} + +#endif /* FEATURE_EXT_transform_feedback */ + + /** Default fallback for ctx->Driver.NewTransformFeedback() */ static struct gl_transform_feedback_object * new_transform_feedback(GLcontext *ctx, GLuint name) @@ -227,6 +257,10 @@ delete_transform_feedback(GLcontext *ctx, free(obj); } + +#if FEATURE_EXT_transform_feedback + + /** Default fallback for ctx->Driver.BeginTransformFeedback() */ static void begin_transform_feedback(GLcontext *ctx, GLenum mode, diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h index b806488abdd..4d38522d6d9 100644 --- a/src/mesa/main/transformfeedback.h +++ b/src/mesa/main/transformfeedback.h @@ -28,6 +28,12 @@ #include "main/mtypes.h" +extern void +_mesa_init_transform_feedback(GLcontext *ctx); + +extern void +_mesa_free_transform_feedback(GLcontext *ctx); + #if FEATURE_EXT_transform_feedback extern GLboolean @@ -36,12 +42,6 @@ _mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode); extern GLboolean _mesa_validate_transform_feedback_buffers(GLcontext *ctx); -extern void -_mesa_init_transform_feedback(GLcontext *ctx); - -extern void -_mesa_free_transform_feedback(GLcontext *ctx); - extern void _mesa_init_transform_feedback_functions(struct dd_function_table *driver); @@ -118,16 +118,6 @@ _mesa_validate_transform_feedback_buffers(GLcontext *ctx) } static INLINE void -_mesa_init_transform_feedback(GLcontext *ctx) -{ -} - -static INLINE void -_mesa_free_transform_feedback(GLcontext *ctx) -{ -} - -static INLINE void _mesa_init_transform_feedback_functions(struct dd_function_table *driver) { } |