summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/27-terrain/terrain.cpp
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
committer ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
commita026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch)
treee31573822f2359677de519f9f3b600d98e8764cd /3rdparty/bgfx/examples/27-terrain/terrain.cpp
parent477d2abd43984f076b7e45f5527591fa8fd0d241 (diff)
parentdcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff)
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to '3rdparty/bgfx/examples/27-terrain/terrain.cpp')
-rw-r--r--3rdparty/bgfx/examples/27-terrain/terrain.cpp15
1 files changed, 10 insertions, 5 deletions
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);