if (ss->DefaultFragmentProgram)
ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram);
#endif
+#if FEATURE_ARB_vertex_buffer_object
if (ss->BufferObjects)
_mesa_DeleteHashTable(ss->BufferObjects);
+#endif
if (ss->Default1D)
(*ctx->Driver.DeleteTexture)(ctx, ss->Default1D);
/* Free texture objects */
ASSERT(ctx->Driver.DeleteTexture);
+ /* the default textures */
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap);
+ (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect);
+ /* all other textures */
while (1) {
GLuint texName = _mesa_HashFirstEntry(ss->TexObjects);
if (texName) {
}
_mesa_DeleteHashTable(ss->Programs);
#endif
+#if FEATURE_ARB_vertex_program
+ _mesa_delete_program(ctx, ss->DefaultVertexProgram);
+#endif
+#if FEATURE_ARB_fragment_program
+ _mesa_delete_program(ctx, ss->DefaultFragmentProgram);
+#endif
+#if FEATURE_ARB_vertex_buffer_object
_mesa_DeleteHashTable(ss->BufferObjects);
-
+#endif
_glthread_DESTROY_MUTEX(ss->Mutex);
FREE(ss);
_mesa_free_matrix_data( ctx );
_mesa_free_viewport_data( ctx );
_mesa_free_colortables_data( ctx );
-#if FEATURE_NV_vertex_program
- if (ctx->VertexProgram.Current) {
- ctx->VertexProgram.Current->Base.RefCount--;
- if (ctx->VertexProgram.Current->Base.RefCount <= 0)
- ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base));
- }
-#endif
-#if FEATURE_NV_fragment_program
- if (ctx->FragmentProgram.Current) {
- ctx->FragmentProgram.Current->Base.RefCount--;
- if (ctx->FragmentProgram.Current->Base.RefCount <= 0)
- ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base));
- }
+ _mesa_free_program_data(ctx);
+ _mesa_free_occlude_data(ctx);
+
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj);
#endif
/* Shared context state (display lists, textures, etc) */
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ctx->DepthMaxF = (GLfloat) ctx->DepthMax;
}
ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */
-
-#if FEATURE_ARB_occlusion_query
- ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
-#endif
- ctx->OcclusionResult = GL_FALSE;
- ctx->OcclusionResultSaved = GL_FALSE;
}
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.0.2
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
};
-
-void
-_mesa_init_occlude(GLcontext *ctx)
-{
-#if FEATURE_ARB_occlusion_query
- ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
-#endif
-
- ctx->OcclusionResult = GL_FALSE;
- ctx->OcclusionResultSaved = GL_FALSE;
-}
-
-
-
/**
* Allocate a new occlusion query object.
* \param target - must be GL_SAMPLES_PASSED_ARB at this time
return;
}
}
+
+
+
+/**
+ * Allocate/init the context state related to occlusion query objects.
+ */
+void
+_mesa_init_occlude(GLcontext *ctx)
+{
+#if FEATURE_ARB_occlusion_query
+ ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
+#endif
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+}
+
+
+/**
+ * Free the context state related to occlusion query objects.
+ */
+void
+_mesa_free_occlude_data(GLcontext *ctx)
+{
+ while (1) {
+ GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects);
+ if (query) {
+ struct occlusion_query *q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, query);
+ ASSERT(q);
+ delete_query_object(q);
+ _mesa_HashRemove(ctx->Occlusion.QueryObjects, query);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects);
+}
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.0.2
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
extern void
_mesa_init_occlude(GLcontext *ctx);
+extern void
+_mesa_free_occlude_data(GLcontext *ctx);
+
extern void GLAPIENTRY
_mesa_GenQueriesARB(GLsizei n, GLuint *ids);
/**
- * Init context's program state
+ * Init context's vertex/fragment program state
*/
void
_mesa_init_program(GLcontext *ctx)
}
+/**
+ * Free a context's vertex/fragment program state
+ */
+void
+_mesa_free_program_data(GLcontext *ctx)
+{
+#if FEATURE_NV_vertex_program
+ if (ctx->VertexProgram.Current) {
+ ctx->VertexProgram.Current->Base.RefCount--;
+ if (ctx->VertexProgram.Current->Base.RefCount <= 0)
+ ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base));
+ }
+#endif
+#if FEATURE_NV_fragment_program
+ if (ctx->FragmentProgram.Current) {
+ ctx->FragmentProgram.Current->Base.RefCount--;
+ if (ctx->FragmentProgram.Current->Base.RefCount <= 0)
+ ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base));
+ }
+#endif
+ _mesa_free((void *) ctx->Program.ErrorString);
+}
+
+
+
+
/**
* Set the vertex/fragment program error state (position and error string).
* This is generally called from within the parsers.
struct vertex_program *vprog = (struct vertex_program *) prog;
if (vprog->Instructions)
_mesa_free(vprog->Instructions);
+ if (vprog->Parameters)
+ _mesa_free_parameter_list(vprog->Parameters);
}
else if (prog->Target == GL_FRAGMENT_PROGRAM_NV ||
prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
struct fragment_program *fprog = (struct fragment_program *) prog;
if (fprog->Instructions)
_mesa_free(fprog->Instructions);
- if (fprog->Parameters) {
+ if (fprog->Parameters)
_mesa_free_parameter_list(fprog->Parameters);
- }
}
_mesa_free(prog);
}
extern void
_mesa_init_program(GLcontext *ctx);
+extern void
+_mesa_free_program_data(GLcontext *ctx);
+
extern void
_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string);