diff options
Diffstat (limited to '3rdparty/bgfx/examples/27-terrain')
-rw-r--r-- | 3rdparty/bgfx/examples/27-terrain/makefile | 3 | ||||
-rw-r--r-- | 3rdparty/bgfx/examples/27-terrain/terrain.cpp | 15 |
2 files changed, 12 insertions, 6 deletions
diff --git a/3rdparty/bgfx/examples/27-terrain/makefile b/3rdparty/bgfx/examples/27-terrain/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/27-terrain/makefile +++ b/3rdparty/bgfx/examples/27-terrain/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp index 71ab88aa128..74d88ac350d 100644 --- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp +++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp @@ -58,7 +58,7 @@ struct BrushData float m_power; }; -class Terrain : public entry::AppI +class ExampleTerrain : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -169,9 +169,14 @@ class Terrain : public entry::AppI bgfx::destroyProgram(m_terrainProgram); bgfx::destroyProgram(m_terrainHeightTextureProgram); - BX_FREE(entry::getAllocator(), m_terrain.m_vertices); - BX_FREE(entry::getAllocator(), m_terrain.m_indices); - BX_FREE(entry::getAllocator(), m_terrain.m_heightMap); + /// When data is passed to bgfx via makeRef we need to make + /// sure library is done with it before freeing memory blocks. + bgfx::frame(); + + bx::AllocatorI* allocator = entry::getAllocator(); + BX_FREE(allocator, m_terrain.m_vertices); + BX_FREE(allocator, m_terrain.m_indices); + BX_FREE(allocator, m_terrain.m_heightMap); // Shutdown bgfx. bgfx::shutdown(); @@ -526,4 +531,4 @@ class Terrain : public entry::AppI int64_t m_timeOffset; }; -ENTRY_IMPLEMENT_MAIN(Terrain); +ENTRY_IMPLEMENT_MAIN(ExampleTerrain); |