grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mesa / src / aros / mesa3dgl / mesa3dgl_gladestroycontext.c
blob1740bb9a34e87f1f4aa595e32e24f81375e56265
1 /*
2 Copyright 2009-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
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 /*****************************************************************************
17 NAME */
19 void glADestroyContext(
21 /* SYNOPSIS */
22 GLAContext ctx)
24 /* FUNCTION
25 Destroys the GL rendering context and frees all resoureces.
27 INPUTS
28 ctx - pointer to GL rendering context. A NULL pointer will be
29 ignored.
31 RESULT
32 The GL context is destroyed. Do no use it anymore.
34 BUGS
36 INTERNALS
38 HISTORY
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));
47 if (_ctx)
49 struct st_context_iface * st_ctx = _ctx->st;
51 if (st_ctx)
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);