diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-10 01:02:32 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-10 01:02:32 +0300 |
commit | 1f0ae739cb952165488f13499f141ac3d20378e0 (patch) | |
tree | 651ddff6a19f68a2d95745c2d0478511141bde0a /source/gameengine/Rasterizer/RAS_MaterialBucket.h | |
parent | 52293831b26f34547acf100603c87296deba7a60 (diff) |
BGE memleak fix: OpenGL Display Lists not deleted when switching scene
This fix also improves performance of Display List for replica objects: Display List ID caching is now enabled for replica objects which avoids a tree search on each frame and for each replica.
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_MaterialBucket.h')
-rw-r--r-- | source/gameengine/Rasterizer/RAS_MaterialBucket.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 7d875242c2e..ded6af999c4 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -69,10 +69,21 @@ public: */ class KX_ListSlot { +protected: + int m_refcount; public: - KX_ListSlot(){} - virtual ~KX_ListSlot(){} - + KX_ListSlot(){ m_refcount=1; } + virtual ~KX_ListSlot() {} + virtual int Release() { + if (--m_refcount > 0) + return m_refcount; + delete this; + return 0; + } + virtual KX_ListSlot* AddRef() { + m_refcount++; + return this; + } virtual void SetModified(bool mod)=0; }; @@ -96,7 +107,7 @@ public: m_DisplayList(0) { } - ~KX_MeshSlot(){} + ~KX_MeshSlot(); bool Less(const KX_MeshSlot& lhs) const; }; |