added _mesa_share_state()
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a1e40e9..acf5cc7 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -2000,6 +2000,32 @@
}
}
+
+/**
+ * Make context 'ctx' share the display lists, textures and programs
+ * that are associated with 'ctxToShare'.
+ * Any display lists, textures or programs associated with 'ctx' will
+ * be deleted if nobody else is sharing them.
+ */
+GLboolean
+_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare)
+{
+ if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) {
+ ctx->Shared->RefCount--;
+ if (ctx->Shared->RefCount == 0) {
+ free_shared_state(ctx, ctx->Shared);
+ }
+ ctx->Shared = ctxToShare->Shared;
+ ctx->Shared->RefCount++;
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+
+
+
/**
* Get current context for the calling thread.
*