2 Copyright © 2009-2019, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
8 #include <proto/exec.h>
9 #include <proto/gallium.h>
11 #include "mesa3dgl_support.h"
12 #include "mesa3dgl_gallium.h"
14 /*****************************************************************************
18 void glADestroyContext(
24 Destroys the GL rendering context and frees all resoureces.
27 ctx - pointer to GL rendering context. A NULL pointer will be
31 The GL context is destroyed. Do no use it anymore.
39 *****************************************************************************/
41 struct mesa3dgl_context
* _ctx
= (struct mesa3dgl_context
*)ctx
;
43 /* Destroy a MESA3DGL context */
44 D(bug("[MESA3DGL] %s(ctx @ %x)\n", __func__
, ctx
));
48 struct st_context_iface
* st_ctx
= _ctx
->st
;
52 struct st_context_iface
* cur_ctx
= glstapi
->get_current(glstapi
);
54 if (cur_ctx
== st_ctx
)
56 /* Unbind if current */
57 _ctx
->st
->flush(_ctx
->st
, 0, NULL
);
58 glstapi
->make_current(glstapi
, NULL
, NULL
, NULL
);
61 _ctx
->st
->destroy(_ctx
->st
);
62 MESA3DGLFreeFrameBuffer(_ctx
->framebuffer
);
63 MESA3DGLFreeStManager(_ctx
->driver
, _ctx
->stmanager
);
64 glstapi
->destroy(glstapi
);
65 MESA3DGLFreeContext(_ctx
);