summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/transformfeedback.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/transformfeedback.c')
-rw-r--r--src/mesa/main/transformfeedback.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 050ebf02701..f86f1911d1d 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -35,10 +35,12 @@
#include "context.h"
#include "hash.h"
#include "transformfeedback.h"
+#include "shaderapi.h"
+#include "shaderobj.h"
#include "main/dispatch.h"
-#include "shader/prog_parameter.h"
-#include "shader/shader_api.h"
+#include "program/prog_parameter.h"
+//#include "program/shader_api.h"
#if FEATURE_EXT_transform_feedback
@@ -132,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);
@@ -176,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,
@@ -187,6 +185,7 @@ _mesa_free_transform_feedback(GLcontext *ctx)
/* Delete all feedback objects */
_mesa_HashDeleteAll(ctx->TransformFeedback.Objects, delete_cb, ctx);
+ _mesa_DeleteHashTable(ctx->TransformFeedback.Objects);
/* Delete the default feedback object */
assert(ctx->Driver.DeleteTransformFeedback);
@@ -197,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)
@@ -224,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,