TINYGL: Free draw call lists in glClose.

This commit is contained in:
Vincent Pelletier 2016-07-25 01:18:11 +02:00
parent 3221146de9
commit 47a1e826e7
3 changed files with 17 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#include "graphics/tinygl/zgl.h" #include "graphics/tinygl/zgl.h"
#include "graphics/tinygl/zblit.h" #include "graphics/tinygl/zblit.h"
#include "graphics/tinygl/zdirtyrect.h"
namespace TinyGL { namespace TinyGL {
@ -243,6 +244,7 @@ void glInit(void *zbuffer1, int textureSize) {
void glClose() { void glClose() {
GLContext *c = gl_get_context(); GLContext *c = gl_get_context();
tglDisposeDrawCallLists(c);
Graphics::Internal::tglCleanupImages(); Graphics::Internal::tglCleanupImages();
specbuf_cleanup(c); specbuf_cleanup(c);

View file

@ -97,6 +97,18 @@ void tglDisposeResources(TinyGL::GLContext *c) {
Graphics::Internal::tglCleanupImages(); Graphics::Internal::tglCleanupImages();
} }
void tglDisposeDrawCallLists(TinyGL::GLContext *c) {
typedef Common::List<Graphics::DrawCall *>::const_iterator DrawCallIterator;
for (DrawCallIterator it = c->_previousFrameDrawCallsQueue.begin(); it != c->_previousFrameDrawCallsQueue.end(); ++it) {
delete *it;
}
c->_previousFrameDrawCallsQueue.clear();
for (DrawCallIterator it = c->_drawCallsQueue.begin(); it != c->_drawCallsQueue.end(); ++it) {
delete *it;
}
c->_drawCallsQueue.clear();
}
void tglPresentBufferDirtyRects(TinyGL::GLContext *c) { void tglPresentBufferDirtyRects(TinyGL::GLContext *c) {
typedef Common::List<Graphics::DrawCall *>::const_iterator DrawCallIterator; typedef Common::List<Graphics::DrawCall *>::const_iterator DrawCallIterator;
typedef Common::List<TinyGL::DirtyRectangle>::iterator RectangleIterator; typedef Common::List<TinyGL::DirtyRectangle>::iterator RectangleIterator;

View file

@ -429,6 +429,9 @@ void gl_resizeImageNoInterpolate(unsigned char *dest, int xsize_dest, int ysize_
void tglIssueDrawCall(Graphics::DrawCall *drawCall); void tglIssueDrawCall(Graphics::DrawCall *drawCall);
// zdirtyrect.cpp
void tglDisposeDrawCallLists(TinyGL::GLContext *c);
GLContext *gl_get_context(); GLContext *gl_get_context();
// specular buffer "api" // specular buffer "api"