2 Copyright 2009-2015, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include <proto/gallium.h>
12 #include "mesa3dgl_support.h"
13 #include "mesa3dgl_gallium.h"
15 /*****************************************************************************
19 void glADestroyContext(
25 Destroys the GL rendering context and frees all resoureces.
28 ctx - pointer to GL rendering context. A NULL pointer will be
32 The GL context is destroyed. Do no use it anymore.
40 *****************************************************************************/
42 struct mesa3dgl_context
* _ctx
= (struct mesa3dgl_context
*)ctx
;
44 /* Destroy a MESA3DGL context */
45 D(bug("[MESA3DGL] %s(ctx @ %x)\n", __PRETTY_FUNCTION__
, ctx
));
49 struct st_context_iface
* st_ctx
= _ctx
->st
;
53 struct st_context_iface
* cur_ctx
= glstapi
->get_current(glstapi
);
55 if (cur_ctx
== st_ctx
)
57 /* Unbind if current */
58 _ctx
->st
->flush(_ctx
->st
, 0, NULL
);
59 glstapi
->make_current(glstapi
, NULL
, NULL
, NULL
);
62 _ctx
->st
->destroy(_ctx
->st
);
63 MESA3DGLFreeFrameBuffer(_ctx
->framebuffer
);
64 MESA3DGLFreeStManager(_ctx
->stmanager
);
65 glstapi
->destroy(glstapi
);
66 MESA3DGLFreeContext(_ctx
);