[ZoneBuilder] Use static allocator as unreleased data is freed anyways
This commit is contained in:
parent
dd12532273
commit
53af2af8b7
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
Utils::Memory::Allocator ZoneBuilder::MemAllocator;
|
|
||||||
|
|
||||||
std::string ZoneBuilder::TraceZone;
|
std::string ZoneBuilder::TraceZone;
|
||||||
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets;
|
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets;
|
||||||
|
|
||||||
@ -727,7 +725,7 @@ namespace Components
|
|||||||
int ZoneBuilder::StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image)
|
int ZoneBuilder::StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image)
|
||||||
{
|
{
|
||||||
size_t size = 16 + (*loadDef)->resourceSize;
|
size_t size = 16 + (*loadDef)->resourceSize;
|
||||||
void* data = ZoneBuilder::MemAllocator.allocate(size);
|
void* data = Utils::Memory::GetAllocator()->allocate(size);
|
||||||
std::memcpy(data, *loadDef, size);
|
std::memcpy(data, *loadDef, size);
|
||||||
|
|
||||||
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef *>(data);
|
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef *>(data);
|
||||||
@ -739,7 +737,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (header.image && header.image->loadDef)
|
if (header.image && header.image->loadDef)
|
||||||
{
|
{
|
||||||
ZoneBuilder::MemAllocator.free(header.image->loadDef);
|
Utils::Memory::GetAllocator()->free(header.image->loadDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,10 +1520,6 @@ namespace Components
|
|||||||
|
|
||||||
ZoneBuilder::~ZoneBuilder()
|
ZoneBuilder::~ZoneBuilder()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
assert(ZoneBuilder::MemAllocator.empty());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ZoneBuilder::Terminate = true;
|
ZoneBuilder::Terminate = true;
|
||||||
if(ZoneBuilder::CommandThread.joinable())
|
if(ZoneBuilder::CommandThread.joinable())
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,6 @@ namespace Components
|
|||||||
static Game::XAssetHeader GetEmptyAssetIfCommon(Game::XAssetType type, std::string name, Zone* builder);
|
static Game::XAssetHeader GetEmptyAssetIfCommon(Game::XAssetType type, std::string name, Zone* builder);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Utils::Memory::Allocator MemAllocator;
|
|
||||||
static int StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);
|
static int StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);
|
||||||
static void ReleaseTexture(Game::XAssetHeader header);
|
static void ReleaseTexture(Game::XAssetHeader header);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user