Added bx::Location, and removed allocator macros.

This commit is contained in:
Branimir Karadžić 2023-04-23 19:19:22 -07:00
parent 277b5f4ada
commit 290295136b
42 changed files with 314 additions and 314 deletions

View File

@ -202,7 +202,7 @@ struct BgfxCallback : public bgfx::CallbackI
m_writer = BX_NEW(entry::getAllocator(), AviWriter)(entry::getFileWriter() );
if (!m_writer->open("temp/capture.avi", _width, _height, 60, _yflip) )
{
BX_DELETE(entry::getAllocator(), m_writer);
bx::deleteObject(entry::getAllocator(), m_writer);
m_writer = NULL;
}
}
@ -212,7 +212,7 @@ struct BgfxCallback : public bgfx::CallbackI
if (NULL != m_writer)
{
m_writer->close();
BX_DELETE(entry::getAllocator(), m_writer);
bx::deleteObject(entry::getAllocator(), m_writer);
m_writer = NULL;
}
}
@ -257,7 +257,7 @@ public:
}
else
{
bx::alignedFree(this, _ptr, _align, _file, _line);
bx::alignedFree(this, _ptr, _align, bx::Location(_file, _line) );
}
}
@ -274,7 +274,7 @@ public:
return ptr;
}
return bx::alignedAlloc(this, _size, _align, _file, _line);
return bx::alignedAlloc(this, _size, _align, bx::Location(_file, _line) );
}
if (kNaturalAlignment >= _align)
@ -292,7 +292,7 @@ public:
return ptr;
}
return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line);
return bx::alignedRealloc(this, _ptr, _size, _align, bx::Location(_file, _line) );
}
void dumpStats() const

View File

@ -32,7 +32,7 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath)
if (NULL != data)
{
TrueTypeHandle handle = _fm->createTtf( (uint8_t*)data, size);
BX_FREE(entry::getAllocator(), data);
bx::free(entry::getAllocator(), data);
return handle;
}

View File

@ -26,7 +26,7 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath)
if (NULL != data)
{
TrueTypeHandle handle = _fm->createTtf( (uint8_t*)data, size);
BX_FREE(entry::getAllocator(), data);
bx::free(entry::getAllocator(), data);
return handle;
}

View File

@ -98,7 +98,7 @@ public:
if (swapChainSupported)
{
m_bindings = (InputBinding*)BX_ALLOC(entry::getAllocator(), sizeof(InputBinding)*3);
m_bindings = (InputBinding*)bx::alloc(entry::getAllocator(), sizeof(InputBinding)*3);
m_bindings[0].set(entry::Key::KeyC, entry::Modifier::None, 1, cmdCreateWindow, this);
m_bindings[1].set(entry::Key::KeyD, entry::Modifier::None, 1, cmdDestroyWindow, this);
m_bindings[2].end();
@ -160,7 +160,7 @@ public:
}
inputRemoveBindings("22-windows");
BX_FREE(entry::getAllocator(), m_bindings);
bx::free(entry::getAllocator(), m_bindings);
// Cleanup.
bgfx::destroy(m_ibh);

View File

@ -127,9 +127,9 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url)
m_terrain.m_mode = 0;
m_terrain.m_dirty = true;
m_terrain.m_vertices = (PosTexCoord0Vertex*)BX_ALLOC(entry::getAllocator(), num * sizeof(PosTexCoord0Vertex) );
m_terrain.m_indices = (uint16_t*)BX_ALLOC(entry::getAllocator(), num * sizeof(uint16_t) * 6);
m_terrain.m_heightMap = (uint8_t*)BX_ALLOC(entry::getAllocator(), num);
m_terrain.m_vertices = (PosTexCoord0Vertex*)bx::alloc(entry::getAllocator(), num * sizeof(PosTexCoord0Vertex) );
m_terrain.m_indices = (uint16_t*)bx::alloc(entry::getAllocator(), num * sizeof(uint16_t) * 6);
m_terrain.m_heightMap = (uint8_t*)bx::alloc(entry::getAllocator(), num);
bx::mtxSRT(m_terrain.m_transform, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
bx::memSet(m_terrain.m_heightMap, 0, sizeof(uint8_t) * s_terrainSize * s_terrainSize);
@ -181,9 +181,9 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url)
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);
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();

View File

@ -333,7 +333,7 @@ struct ProceduralSky
bx::AllocatorI* allocator = entry::getAllocator();
ScreenPosVertex* vertices = (ScreenPosVertex*)BX_ALLOC(allocator
ScreenPosVertex* vertices = (ScreenPosVertex*)bx::alloc(allocator
, verticalCount * horizontalCount * sizeof(ScreenPosVertex)
);
@ -347,7 +347,7 @@ struct ProceduralSky
}
}
uint16_t* indices = (uint16_t*)BX_ALLOC(allocator
uint16_t* indices = (uint16_t*)bx::alloc(allocator
, (verticalCount - 1) * (horizontalCount - 1) * 6 * sizeof(uint16_t)
);
@ -369,8 +369,8 @@ struct ProceduralSky
m_vbh = bgfx::createVertexBuffer(bgfx::copy(vertices, sizeof(ScreenPosVertex) * verticalCount * horizontalCount), ScreenPosVertex::ms_layout);
m_ibh = bgfx::createIndexBuffer(bgfx::copy(indices, sizeof(uint16_t) * k));
BX_FREE(allocator, indices);
BX_FREE(allocator, vertices);
bx::free(allocator, indices);
bx::free(allocator, vertices);
}
void shutdown()

View File

@ -296,7 +296,7 @@ Quadtree::~Quadtree()
{
if (m_children[i] != nullptr)
{
BX_DELETE(VirtualTexture::getAllocator(), m_children[i]);
bx::deleteObject(VirtualTexture::getAllocator(), m_children[i]);
}
}
}
@ -344,7 +344,7 @@ void Quadtree::remove(Page request)
if (node != nullptr)
{
BX_DELETE(VirtualTexture::getAllocator(), node->m_children[index]);
bx::deleteObject(VirtualTexture::getAllocator(), node->m_children[index]);
node->m_children[index] = nullptr;
}
}
@ -459,12 +459,12 @@ PageTable::PageTable(PageCache* _cache, VirtualTextureInfo* _info, PageIndexer*
PageTable::~PageTable()
{
BX_DELETE(VirtualTexture::getAllocator(), m_quadtree);
bx::deleteObject(VirtualTexture::getAllocator(), m_quadtree);
bgfx::destroy(m_texture);
for (int i = 0; i < (int)m_images.size(); ++i)
{
BX_DELETE(VirtualTexture::getAllocator(), m_images[i]);
bx::deleteObject(VirtualTexture::getAllocator(), m_images[i]);
}
for (int i = 0; i < (int)m_stagingTextures.size(); ++i)
@ -785,7 +785,7 @@ FeedbackBuffer::FeedbackBuffer(VirtualTextureInfo* _info, int _width, int _heigh
FeedbackBuffer::~FeedbackBuffer()
{
BX_DELETE(VirtualTexture::getAllocator(), m_indexer);
bx::deleteObject(VirtualTexture::getAllocator(), m_indexer);
bgfx::destroy(m_feedbackFrameBuffer);
}
@ -906,11 +906,11 @@ VirtualTexture::VirtualTexture(TileDataFile* _tileDataFile, VirtualTextureInfo*
VirtualTexture::~VirtualTexture()
{
// Destroy
BX_DELETE(VirtualTexture::getAllocator(), m_indexer);
BX_DELETE(VirtualTexture::getAllocator(), m_atlas);
BX_DELETE(VirtualTexture::getAllocator(), m_loader);
BX_DELETE(VirtualTexture::getAllocator(), m_cache);
BX_DELETE(VirtualTexture::getAllocator(), m_pageTable);
bx::deleteObject(VirtualTexture::getAllocator(), m_indexer);
bx::deleteObject(VirtualTexture::getAllocator(), m_atlas);
bx::deleteObject(VirtualTexture::getAllocator(), m_loader);
bx::deleteObject(VirtualTexture::getAllocator(), m_cache);
bx::deleteObject(VirtualTexture::getAllocator(), m_pageTable);
// Destroy all uniforms and textures
bgfx::destroy(u_vt_settings_1);
bgfx::destroy(u_vt_settings_2);
@ -1155,13 +1155,13 @@ TileGenerator::~TileGenerator()
bimg::imageFree(m_sourceImage);
}
BX_DELETE(VirtualTexture::getAllocator(), m_indexer);
bx::deleteObject(VirtualTexture::getAllocator(), m_indexer);
BX_DELETE(VirtualTexture::getAllocator(), m_page1Image);
BX_DELETE(VirtualTexture::getAllocator(), m_page2Image);
BX_DELETE(VirtualTexture::getAllocator(), m_2xtileImage);
BX_DELETE(VirtualTexture::getAllocator(), m_4xtileImage);
BX_DELETE(VirtualTexture::getAllocator(), m_tileImage);
bx::deleteObject(VirtualTexture::getAllocator(), m_page1Image);
bx::deleteObject(VirtualTexture::getAllocator(), m_page2Image);
bx::deleteObject(VirtualTexture::getAllocator(), m_2xtileImage);
bx::deleteObject(VirtualTexture::getAllocator(), m_4xtileImage);
bx::deleteObject(VirtualTexture::getAllocator(), m_tileImage);
}
bool TileGenerator::generate(const bx::FilePath& _filePath)
@ -1210,7 +1210,7 @@ bool TileGenerator::generate(const bx::FilePath& _filePath)
return false;
}
uint8_t* rawImage = (uint8_t*)BX_ALLOC(VirtualTexture::getAllocator(), size_t(size) );
uint8_t* rawImage = (uint8_t*)bx::alloc(VirtualTexture::getAllocator(), size_t(size) );
bx::read(&fileReader, rawImage, int32_t(size), &err);
bx::close(&fileReader);
@ -1218,12 +1218,12 @@ bool TileGenerator::generate(const bx::FilePath& _filePath)
if (!err.isOk() )
{
bx::debugPrintf("Image read failed'%s'.\n", _filePath.getCPtr() );
BX_FREE(VirtualTexture::getAllocator(), rawImage);
bx::free(VirtualTexture::getAllocator(), rawImage);
return false;
}
m_sourceImage = bimg::imageParse(VirtualTexture::getAllocator(), rawImage, uint32_t(size), bimg::TextureFormat::BGRA8, &err);
BX_FREE(VirtualTexture::getAllocator(), rawImage);
bx::free(VirtualTexture::getAllocator(), rawImage);
if (!err.isOk() )
{
@ -1267,7 +1267,7 @@ bool TileGenerator::generate(const bx::FilePath& _filePath)
// Write header
m_tileDataFile->writeInfo();
// Close tile file
BX_DELETE(VirtualTexture::getAllocator(), m_tileDataFile);
bx::deleteObject(VirtualTexture::getAllocator(), m_tileDataFile);
m_tileDataFile = nullptr;
bx::debugPrintf("Done!\n");
return true;

View File

@ -31,8 +31,8 @@ public:
if (m_cachePermutation == NULL)
{
m_cachePermutation = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) );
m_map = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) );
m_cachePermutation = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) );
m_map = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) );
// It will takes long time if there are too many vertices.
ProgressiveMesh(
@ -47,7 +47,7 @@ public:
}
// rearrange the vertex Array
char* temp = (char*)BX_ALLOC(entry::getAllocator(), numVertices * stride);
char* temp = (char*)bx::alloc(entry::getAllocator(), numVertices * stride);
bx::memCopy(temp, _vb->data, _vb->size);
for (uint32_t ii = 0; ii < numVertices; ++ii)
@ -55,7 +55,7 @@ public:
bx::memCopy(_vb->data + m_cachePermutation[ii] * stride , temp + ii * stride, stride);
}
BX_FREE(entry::getAllocator(), temp);
bx::free(entry::getAllocator(), temp);
// update the changes in the entries in the triangle Array
for (uint32_t ii = 0, num = numTriangles*3; ii < num; ++ii)
@ -107,7 +107,7 @@ public:
}
const bgfx::Memory* ib = bgfx::alloc(numIndices * sizeof(uint32_t) );
uint8_t* vbData = (uint8_t*)BX_ALLOC(entry::getAllocator(), _mesh->m_layout.getSize(numVertices) );
uint8_t* vbData = (uint8_t*)bx::alloc(entry::getAllocator(), _mesh->m_layout.getSize(numVertices) );
{
uint32_t voffset = 0;
@ -144,11 +144,11 @@ public:
cacheInvalid = true;
m_originalVertices = numVertices;
BX_FREE(entry::getAllocator(), m_cachePermutation);
bx::free(entry::getAllocator(), m_cachePermutation);
m_cachePermutation = NULL;
BX_FREE(entry::getAllocator(), m_cacheWeld);
m_cacheWeld = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) );
bx::free(entry::getAllocator(), m_cacheWeld);
m_cacheWeld = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) );
m_totalVertices = bgfx::weldVertices(m_cacheWeld, _mesh->m_layout, vbData, numVertices, true, 0.00001f);
remapIndices(m_cacheWeld, numVertices);
@ -161,7 +161,7 @@ public:
, numVertices
, m_totalVertices
);
BX_FREE(entry::getAllocator(), vbData);
bx::free(entry::getAllocator(), vbData);
{
uint32_t* ibData = (uint32_t*)ib->data;
@ -178,7 +178,7 @@ public:
saveCache();
}
m_triangle = (uint32_t*)BX_ALLOC(entry::getAllocator(), ib->size);
m_triangle = (uint32_t*)bx::alloc(entry::getAllocator(), ib->size);
bx::memCopy(m_triangle, ib->data, ib->size);
m_vb = bgfx::createVertexBuffer(vb, _mesh->m_layout);
@ -205,26 +205,26 @@ public:
{
bx::read(&reader, m_originalVertices, &err);
bx::read(&reader, m_totalVertices, &err);
m_cacheWeld = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_originalVertices * sizeof(uint32_t) );
m_cacheWeld = (uint32_t*)bx::alloc(entry::getAllocator(), m_originalVertices * sizeof(uint32_t) );
bx::read(&reader, m_cacheWeld, m_originalVertices * sizeof(uint32_t), &err);
m_cachePermutation = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) );
m_cachePermutation = (uint32_t*)bx::alloc(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) );
bx::read(&reader, m_cachePermutation, m_totalVertices * sizeof(uint32_t), &err);
m_map = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) );
m_map = (uint32_t*)bx::alloc(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) );
bx::read(&reader, m_map, m_totalVertices * sizeof(uint32_t), &err);
if (!err.isOk() )
{
// read fail
BX_FREE(entry::getAllocator(), m_cacheWeld);
bx::free(entry::getAllocator(), m_cacheWeld);
m_cacheWeld = NULL;
BX_FREE(entry::getAllocator(), m_cachePermutation);
bx::free(entry::getAllocator(), m_cachePermutation);
m_cachePermutation = NULL;
BX_FREE(entry::getAllocator(), m_map);
bx::free(entry::getAllocator(), m_map);
m_map = NULL;
}
@ -306,10 +306,10 @@ public:
bgfx::destroy(m_ib);
bgfx::destroy(u_tint);
BX_FREE(entry::getAllocator(), m_map);
BX_FREE(entry::getAllocator(), m_triangle);
BX_FREE(entry::getAllocator(), m_cacheWeld);
BX_FREE(entry::getAllocator(), m_cachePermutation);
bx::free(entry::getAllocator(), m_map);
bx::free(entry::getAllocator(), m_triangle);
bx::free(entry::getAllocator(), m_cacheWeld);
bx::free(entry::getAllocator(), m_cachePermutation);
// Shutdown bgfx.
bgfx::shutdown();

View File

@ -28,7 +28,7 @@ void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _fi
if (bx::open(_reader, _filePath) )
{
uint32_t size = (uint32_t)bx::getSize(_reader);
void* data = BX_ALLOC(_allocator, size);
void* data = bx::alloc(_allocator, size);
bx::read(_reader, data, size, bx::ErrorAssert{});
bx::close(_reader);
if (NULL != _size)
@ -57,7 +57,7 @@ void* load(const char* _filePath, uint32_t* _size)
void unload(void* _ptr)
{
BX_FREE(entry::getAllocator(), _ptr);
bx::free(entry::getAllocator(), _ptr);
}
static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath)
@ -81,7 +81,7 @@ static void* loadMem(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const
if (bx::open(_reader, _filePath) )
{
uint32_t size = (uint32_t)bx::getSize(_reader);
void* data = BX_ALLOC(_allocator, size);
void* data = bx::alloc(_allocator, size);
bx::read(_reader, data, size, bx::ErrorAssert{});
bx::close(_reader);
@ -416,7 +416,7 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy)
if (_ramcopy)
{
group.m_vertices = (uint8_t*)BX_ALLOC(allocator, group.m_numVertices*stride);
group.m_vertices = (uint8_t*)bx::alloc(allocator, group.m_numVertices*stride);
bx::memCopy(group.m_vertices, mem->data, mem->size);
}
@ -441,16 +441,16 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy)
uint32_t compressedSize;
bx::read(_reader, compressedSize, &err);
void* compressedVertices = BX_ALLOC(allocator, compressedSize);
void* compressedVertices = bx::alloc(allocator, compressedSize);
bx::read(_reader, compressedVertices, compressedSize, &err);
meshopt_decodeVertexBuffer(mem->data, group.m_numVertices, stride, (uint8_t*)compressedVertices, compressedSize);
BX_FREE(allocator, compressedVertices);
bx::free(allocator, compressedVertices);
if (_ramcopy)
{
group.m_vertices = (uint8_t*)BX_ALLOC(allocator, group.m_numVertices*stride);
group.m_vertices = (uint8_t*)bx::alloc(allocator, group.m_numVertices*stride);
bx::memCopy(group.m_vertices, mem->data, mem->size);
}
@ -467,7 +467,7 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy)
if (_ramcopy)
{
group.m_indices = (uint16_t*)BX_ALLOC(allocator, group.m_numIndices*2);
group.m_indices = (uint16_t*)bx::alloc(allocator, group.m_numIndices*2);
bx::memCopy(group.m_indices, mem->data, mem->size);
}
@ -484,17 +484,17 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy)
uint32_t compressedSize;
bx::read(_reader, compressedSize, &err);
void* compressedIndices = BX_ALLOC(allocator, compressedSize);
void* compressedIndices = bx::alloc(allocator, compressedSize);
bx::read(_reader, compressedIndices, compressedSize, &err);
meshopt_decodeIndexBuffer(mem->data, group.m_numIndices, 2, (uint8_t*)compressedIndices, compressedSize);
BX_FREE(allocator, compressedIndices);
bx::free(allocator, compressedIndices);
if (_ramcopy)
{
group.m_indices = (uint16_t*)BX_ALLOC(allocator, group.m_numIndices*2);
group.m_indices = (uint16_t*)bx::alloc(allocator, group.m_numIndices*2);
bx::memCopy(group.m_indices, mem->data, mem->size);
}
@ -562,12 +562,12 @@ void Mesh::unload()
if (NULL != group.m_vertices)
{
BX_FREE(allocator, group.m_vertices);
bx::free(allocator, group.m_vertices);
}
if (NULL != group.m_indices)
{
BX_FREE(allocator, group.m_indices);
bx::free(allocator, group.m_indices);
}
}
m_groups.clear();
@ -683,13 +683,13 @@ void meshUnload(Mesh* _mesh)
MeshState* meshStateCreate()
{
MeshState* state = (MeshState*)BX_ALLOC(entry::getAllocator(), sizeof(MeshState) );
MeshState* state = (MeshState*)bx::alloc(entry::getAllocator(), sizeof(MeshState) );
return state;
}
void meshStateDestroy(MeshState* _meshState)
{
BX_FREE(entry::getAllocator(), _meshState);
bx::free(entry::getAllocator(), _meshState);
}
void meshSubmit(const Mesh* _mesh, bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state)

View File

@ -288,7 +288,7 @@ void cameraCreate()
void cameraDestroy()
{
BX_DELETE(entry::getAllocator(), s_camera);
bx::deleteObject(entry::getAllocator(), s_camera);
s_camera = NULL;
}

View File

@ -640,11 +640,11 @@ struct DebugDrawShared
const uint32_t numVertices = genSphere(tess);
const uint32_t numIndices = numVertices;
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
vertices[id] = bx::alloc(m_allocator, numVertices*stride);
bx::memSet(vertices[id], 0, numVertices*stride);
genSphere(tess, vertices[id], stride);
uint16_t* trilist = (uint16_t*)BX_ALLOC(m_allocator, numIndices*sizeof(uint16_t) );
uint16_t* trilist = (uint16_t*)bx::alloc(m_allocator, numIndices*sizeof(uint16_t) );
for (uint32_t ii = 0; ii < numIndices; ++ii)
{
trilist[ii] = uint16_t(ii);
@ -658,7 +658,7 @@ struct DebugDrawShared
, numIndices
, false
);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
uint16_t* indicesOut = indices[id];
bx::memCopy(indicesOut, trilist, numIndices*sizeof(uint16_t) );
@ -681,7 +681,7 @@ struct DebugDrawShared
startVertex += numVertices;
startIndex += numIndices + numLineListIndices;
BX_FREE(m_allocator, trilist);
bx::free(m_allocator, trilist);
}
for (uint32_t mesh = 0; mesh < 4; ++mesh)
@ -695,8 +695,8 @@ struct DebugDrawShared
const uint32_t numIndices = num*6;
const uint32_t numLineListIndices = num*4;
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
vertices[id] = bx::alloc(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
@ -756,8 +756,8 @@ struct DebugDrawShared
const uint32_t numIndices = num*12;
const uint32_t numLineListIndices = num*6;
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
vertices[id] = bx::alloc(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
@ -826,8 +826,8 @@ struct DebugDrawShared
const uint32_t numIndices = num*6;
const uint32_t numLineListIndices = num*6;
vertices[id] = BX_ALLOC(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
vertices[id] = bx::alloc(m_allocator, numVertices*stride);
indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) );
bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) );
DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id];
@ -919,8 +919,8 @@ struct DebugDrawShared
, (m_mesh[id].m_numIndices[0]+m_mesh[id].m_numIndices[1])*sizeof(uint16_t)
);
BX_FREE(m_allocator, vertices[id]);
BX_FREE(m_allocator, indices[id]);
bx::free(m_allocator, vertices[id]);
bx::free(m_allocator, indices[id]);
}
bx::memCopy(&vb->data[m_mesh[DebugMesh::Quad].m_startVertex * stride]

View File

@ -109,7 +109,7 @@ void cmdInit()
void cmdShutdown()
{
BX_DELETE(entry::getAllocator(), s_cmdContext);
bx::deleteObject(entry::getAllocator(), s_cmdContext);
}
void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData)

View File

@ -566,7 +566,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
return;
}
AppI** apps = (AppI**)BX_ALLOC(g_allocator, s_numApps*sizeof(AppI*) );
AppI** apps = (AppI**)bx::alloc(g_allocator, s_numApps*sizeof(AppI*) );
uint32_t ii = 0;
for (AppI* app = getFirstApp(); NULL != app; app = app->getNext() )
@ -589,7 +589,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
ai->m_next = NULL;
}
BX_FREE(g_allocator, apps);
bx::free(g_allocator, apps);
}
int main(int _argc, const char* const* _argv)
@ -666,10 +666,10 @@ restart:
cmdShutdown();
BX_DELETE(g_allocator, s_fileReader);
bx::deleteObject(g_allocator, s_fileReader);
s_fileReader = NULL;
BX_DELETE(g_allocator, s_fileWriter);
bx::deleteObject(g_allocator, s_fileWriter);
s_fileWriter = NULL;
return result;
@ -1010,14 +1010,14 @@ restart:
void* TinyStlAllocator::static_allocate(size_t _bytes)
{
return BX_ALLOC(getAllocator(), _bytes);
return bx::alloc(getAllocator(), _bytes);
}
void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
{
if (NULL != _ptr)
{
BX_FREE(getAllocator(), _ptr);
bx::free(getAllocator(), _ptr);
}
}

View File

@ -318,7 +318,7 @@ namespace entry
void release(const Event* _event) const
{
BX_DELETE(getAllocator(), const_cast<Event*>(_event) );
bx::deleteObject(getAllocator(), const_cast<Event*>(_event) );
}
private:

View File

@ -505,7 +505,7 @@ namespace entry
{
bx::AllocatorI* allocator = getAllocator();
uint32_t size = (uint32_t)bx::getSize(reader);
void* data = BX_ALLOC(allocator, size + 1);
void* data = bx::alloc(allocator, size + 1);
bx::read(reader, data, size, bx::ErrorAssert{});
bx::close(reader);
((char*)data)[size] = '\0';
@ -514,7 +514,7 @@ namespace entry
DBG("SDL game controller add mapping failed: %s", SDL_GetError());
}
BX_FREE(allocator, data);
bx::free(allocator, data);
}
bool exit = false;

View File

@ -292,7 +292,7 @@ void inputInit()
void inputShutdown()
{
BX_DELETE(entry::getAllocator(), s_input);
bx::deleteObject(entry::getAllocator(), s_input);
}
void inputAddBindings(const char* _name, const InputBinding* _bindings)

View File

@ -507,13 +507,13 @@ static OcornutImguiContext s_ctx;
static void* memAlloc(size_t _size, void* _userData)
{
BX_UNUSED(_userData);
return BX_ALLOC(s_ctx.m_allocator, _size);
return bx::alloc(s_ctx.m_allocator, _size);
}
static void memFree(void* _ptr, void* _userData)
{
BX_UNUSED(_userData);
BX_FREE(s_ctx.m_allocator, _ptr);
bx::free(s_ctx.m_allocator, _ptr);
}
void imguiCreate(float _fontSize, bx::AllocatorI* _allocator)

View File

@ -192,7 +192,7 @@ namespace
{
int old = gl->ctextures;
gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2;
gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures);
gl->textures = (struct GLNVGtexture*)bx::realloc(gl->allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures);
bx::memSet(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) );
if (gl->textures == NULL)
@ -847,7 +847,7 @@ _cleanup:
if (gl->ncalls+1 > gl->ccalls)
{
gl->ccalls = gl->ccalls == 0 ? 32 : gl->ccalls * 2;
gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls);
gl->calls = (struct GLNVGcall*)bx::realloc(gl->allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls);
}
ret = &gl->calls[gl->ncalls++];
bx::memSet(ret, 0, sizeof(struct GLNVGcall) );
@ -860,7 +860,7 @@ _cleanup:
if (gl->npaths + n > gl->cpaths) {
GLNVGpath* paths;
int cpaths = glnvg__maxi(gl->npaths + n, 128) + gl->cpaths / 2; // 1.5x Overallocate
paths = (GLNVGpath*)BX_REALLOC(gl->allocator, gl->paths, sizeof(GLNVGpath) * cpaths);
paths = (GLNVGpath*)bx::realloc(gl->allocator, gl->paths, sizeof(GLNVGpath) * cpaths);
if (paths == NULL) return -1;
gl->paths = paths;
gl->cpaths = cpaths;
@ -877,7 +877,7 @@ _cleanup:
{
NVGvertex* verts;
int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate
verts = (NVGvertex*)BX_REALLOC(gl->allocator, gl->verts, sizeof(NVGvertex) * cverts);
verts = (NVGvertex*)bx::realloc(gl->allocator, gl->verts, sizeof(NVGvertex) * cverts);
if (verts == NULL) return -1;
gl->verts = verts;
gl->cverts = cverts;
@ -893,7 +893,7 @@ _cleanup:
if (gl->nuniforms+n > gl->cuniforms)
{
gl->cuniforms = gl->cuniforms == 0 ? glnvg__maxi(n, 32) : gl->cuniforms * 2;
gl->uniforms = (unsigned char*)BX_REALLOC(gl->allocator, gl->uniforms, gl->cuniforms * structSize);
gl->uniforms = (unsigned char*)bx::realloc(gl->allocator, gl->uniforms, gl->cuniforms * structSize);
}
ret = gl->nuniforms * structSize;
gl->nuniforms += n;
@ -1098,12 +1098,12 @@ _cleanup:
}
}
BX_FREE(gl->allocator, gl->uniforms);
BX_FREE(gl->allocator, gl->verts);
BX_FREE(gl->allocator, gl->paths);
BX_FREE(gl->allocator, gl->calls);
BX_FREE(gl->allocator, gl->textures);
BX_FREE(gl->allocator, gl);
bx::free(gl->allocator, gl->uniforms);
bx::free(gl->allocator, gl->verts);
bx::free(gl->allocator, gl->paths);
bx::free(gl->allocator, gl->calls);
bx::free(gl->allocator, gl->textures);
bx::free(gl->allocator, gl);
}
} // namespace
@ -1118,7 +1118,7 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _al
struct NVGparams params;
struct NVGcontext* ctx = NULL;
struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) );
struct GLNVGcontext* gl = (struct GLNVGcontext*)bx::alloc(_allocator, sizeof(struct GLNVGcontext) );
if (gl == NULL)
{
goto error;
@ -1335,7 +1335,7 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* _framebuffer)
struct NVGparams* params = nvgInternalParams(_framebuffer->ctx);
struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr;
glnvg__deleteTexture(gl, _framebuffer->image);
BX_DELETE(gl->allocator, _framebuffer);
bx::deleteObject(gl->allocator, _framebuffer);
}
void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer* _framebuffer)

View File

@ -452,7 +452,7 @@ namespace ps
}
m_emitterAlloc = bx::createHandleAlloc(m_allocator, _maxEmitters);
m_emitter = (Emitter*)BX_ALLOC(m_allocator, sizeof(Emitter)*_maxEmitters);
m_emitter = (Emitter*)bx::alloc(m_allocator, sizeof(Emitter)*_maxEmitters);
PosColorTexCoord0Vertex::init();
@ -482,7 +482,7 @@ namespace ps
bgfx::destroy(s_texColor);
bx::destroyHandleAlloc(m_allocator, m_emitterAlloc);
BX_FREE(m_allocator, m_emitter);
bx::free(m_allocator, m_emitter);
m_allocator = NULL;
}
@ -554,7 +554,7 @@ namespace ps
);
PosColorTexCoord0Vertex* vertices = (PosColorTexCoord0Vertex*)tvb.data;
ParticleSort* particleSort = (ParticleSort*)BX_ALLOC(m_allocator, max*sizeof(ParticleSort) );
ParticleSort* particleSort = (ParticleSort*)bx::alloc(m_allocator, max*sizeof(ParticleSort) );
uint32_t pos = 0;
for (uint16_t ii = 0, numEmitters = m_emitterAlloc->getNumHandles(); ii < numEmitters; ++ii)
@ -595,7 +595,7 @@ namespace ps
index[5] = idx*4+0;
}
BX_FREE(m_allocator, particleSort);
bx::free(m_allocator, particleSort);
bgfx::setState(0
| BGFX_STATE_WRITE_RGB
@ -687,12 +687,12 @@ namespace ps
m_shape = _shape;
m_direction = _direction;
m_max = _maxParticles;
m_particles = (Particle*)BX_ALLOC(s_ctx.m_allocator, m_max*sizeof(Particle) );
m_particles = (Particle*)bx::alloc(s_ctx.m_allocator, m_max*sizeof(Particle) );
}
void Emitter::destroy()
{
BX_FREE(s_ctx.m_allocator, m_particles);
bx::free(s_ctx.m_allocator, m_particles);
m_particles = NULL;
}

View File

@ -54,14 +54,14 @@ namespace bgfx
#if BGFX_CONFIG_USE_TINYSTL
void* TinyStlAllocator::static_allocate(size_t _bytes)
{
return BX_ALLOC(g_allocator, _bytes);
return bx::alloc(g_allocator, _bytes);
}
void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
{
if (NULL != _ptr)
{
BX_FREE(g_allocator, _ptr);
bx::free(g_allocator, _ptr);
}
}
#endif // BGFX_CONFIG_USE_TINYSTL
@ -199,7 +199,7 @@ namespace bgfx
}
else
{
bx::alignedFree(this, _ptr, _align, _file, _line);
bx::alignedFree(this, _ptr, _align, bx::Location(_file, _line) );
}
}
@ -220,7 +220,7 @@ namespace bgfx
return ::malloc(_size);
}
return bx::alignedAlloc(this, _size, _align, _file, _line);
return bx::alignedAlloc(this, _size, _align, bx::Location(_file, _line) );
}
if (kNaturalAlignment >= _align)
@ -237,7 +237,7 @@ namespace bgfx
return ::realloc(_ptr, _size);
}
return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line);
return bx::alignedRealloc(this, _ptr, _size, _align, bx::Location(_file, _line) );
}
void checkLeaks();
@ -1970,8 +1970,8 @@ namespace bgfx
frameNoRenderWait();
m_encoderHandle = bx::createHandleAlloc(g_allocator, _init.limits.maxEncoders);
m_encoder = (EncoderImpl*)BX_ALIGNED_ALLOC(g_allocator, sizeof(EncoderImpl)*_init.limits.maxEncoders, BX_ALIGNOF(EncoderImpl) );
m_encoderStats = (EncoderStats*)BX_ALLOC(g_allocator, sizeof(EncoderStats)*_init.limits.maxEncoders);
m_encoder = (EncoderImpl*)bx::alignedAlloc(g_allocator, sizeof(EncoderImpl)*_init.limits.maxEncoders, BX_ALIGNOF(EncoderImpl) );
m_encoderStats = (EncoderStats*)bx::alloc(g_allocator, sizeof(EncoderStats)*_init.limits.maxEncoders);
for (uint32_t ii = 0, num = _init.limits.maxEncoders; ii < num; ++ii)
{
BX_PLACEMENT_NEW(&m_encoder[ii], EncoderImpl);
@ -2081,8 +2081,8 @@ namespace bgfx
m_encoder[ii].~EncoderImpl();
}
BX_ALIGNED_FREE(g_allocator, m_encoder, BX_ALIGNOF(EncoderImpl) );
BX_FREE(g_allocator, m_encoderStats);
bx::alignedFree(g_allocator, m_encoder, BX_ALIGNOF(EncoderImpl) );
bx::free(g_allocator, m_encoderStats);
m_dynVertexBufferAllocator.compact();
m_dynIndexBufferAllocator.compact();
@ -3563,21 +3563,21 @@ namespace bgfx
switch (errorState)
{
case ErrorState::ContextAllocated:
BX_ALIGNED_DELETE(g_allocator, s_ctx, Context::kAlignment);
bx::deleteObject(g_allocator, s_ctx, Context::kAlignment);
s_ctx = NULL;
BX_FALLTHROUGH;
case ErrorState::Default:
if (NULL != s_callbackStub)
{
BX_DELETE(g_allocator, s_callbackStub);
bx::deleteObject(g_allocator, s_callbackStub);
s_callbackStub = NULL;
}
if (NULL != s_allocatorStub)
{
bx::DefaultAllocator allocator;
BX_DELETE(&allocator, s_allocatorStub);
bx::deleteObject(&allocator, s_allocatorStub);
s_allocatorStub = NULL;
}
@ -3599,7 +3599,7 @@ namespace bgfx
ctx->shutdown();
BX_ASSERT(NULL == s_ctx, "bgfx is should be uninitialized here.");
BX_ALIGNED_DELETE(g_allocator, ctx, Context::kAlignment);
bx::deleteObject(g_allocator, ctx, Context::kAlignment);
BX_TRACE("Shutdown complete.");
@ -3610,14 +3610,14 @@ namespace bgfx
if (NULL != s_callbackStub)
{
BX_DELETE(g_allocator, s_callbackStub);
bx::deleteObject(g_allocator, s_callbackStub);
s_callbackStub = NULL;
}
if (NULL != s_allocatorStub)
{
bx::DefaultAllocator allocator;
BX_DELETE(&allocator, s_allocatorStub);
bx::deleteObject(&allocator, s_allocatorStub);
s_allocatorStub = NULL;
}
@ -4066,7 +4066,7 @@ namespace bgfx
const Memory* alloc(uint32_t _size)
{
BX_ASSERT(0 < _size, "Invalid memory operation. _size is 0.");
Memory* mem = (Memory*)BX_ALLOC(g_allocator, sizeof(Memory) + _size);
Memory* mem = (Memory*)bx::alloc(g_allocator, sizeof(Memory) + _size);
mem->size = _size;
mem->data = (uint8_t*)mem + sizeof(Memory);
return mem;
@ -4089,7 +4089,7 @@ namespace bgfx
const Memory* makeRef(const void* _data, uint32_t _size, ReleaseFn _releaseFn, void* _userData)
{
MemoryRef* memRef = (MemoryRef*)BX_ALLOC(g_allocator, sizeof(MemoryRef) );
MemoryRef* memRef = (MemoryRef*)bx::alloc(g_allocator, sizeof(MemoryRef) );
memRef->mem.size = _size;
memRef->mem.data = (uint8_t*)_data;
memRef->releaseFn = _releaseFn;
@ -4114,7 +4114,7 @@ namespace bgfx
memRef->releaseFn(mem->data, memRef->userData);
}
}
BX_FREE(g_allocator, mem);
bx::free(g_allocator, mem);
}
void setDebug(uint32_t _debug)

View File

@ -666,7 +666,7 @@ namespace bgfx
~TextVideoMem()
{
BX_FREE(g_allocator, m_mem);
bx::free(g_allocator, m_mem);
}
void resize(bool _small, uint32_t _width, uint32_t _height)
@ -686,7 +686,7 @@ namespace bgfx
uint32_t size = m_size;
m_size = m_width * m_height;
m_mem = (MemSlot*)BX_REALLOC(g_allocator, m_mem, m_size * sizeof(MemSlot) );
m_mem = (MemSlot*)bx::realloc(g_allocator, m_mem, m_size * sizeof(MemSlot) );
if (size < m_size)
{
@ -885,7 +885,7 @@ namespace bgfx
~CommandBuffer()
{
BX_FREE(g_allocator, m_buffer);
bx::free(g_allocator, m_buffer);
}
void init(uint32_t _minCapacity)
@ -933,7 +933,7 @@ namespace bgfx
void resize(uint32_t _capacity = 0)
{
m_capacity = bx::alignUp(bx::max(_capacity, m_minCapacity), 1024);
m_buffer = (uint8_t*)BX_REALLOC(g_allocator, m_buffer, m_capacity);
m_buffer = (uint8_t*)bx::realloc(g_allocator, m_buffer, m_capacity);
}
void write(const void* _data, uint32_t _size)
@ -1483,14 +1483,14 @@ namespace bgfx
const uint32_t structSize = sizeof(UniformBuffer)-sizeof(UniformBuffer::m_buffer);
uint32_t size = bx::alignUp(_size, 16);
void* data = BX_ALLOC(g_allocator, size+structSize);
void* data = bx::alloc(g_allocator, size+structSize);
return BX_PLACEMENT_NEW(data, UniformBuffer)(size);
}
static void destroy(UniformBuffer* _uniformBuffer)
{
_uniformBuffer->~UniformBuffer();
BX_FREE(g_allocator, _uniformBuffer);
bx::free(g_allocator, _uniformBuffer);
}
static void update(UniformBuffer** _uniformBuffer, uint32_t _threshold = 64<<10, uint32_t _grow = 1<<20)
@ -1500,7 +1500,7 @@ namespace bgfx
{
const uint32_t structSize = sizeof(UniformBuffer)-sizeof(UniformBuffer::m_buffer);
uint32_t size = bx::alignUp(uniformBuffer->m_size + _grow, 16);
void* data = BX_REALLOC(g_allocator, uniformBuffer, size+structSize);
void* data = bx::realloc(g_allocator, uniformBuffer, size+structSize);
uniformBuffer = reinterpret_cast<UniformBuffer*>(data);
uniformBuffer->m_size = size;
@ -2182,7 +2182,7 @@ namespace bgfx
{
const uint32_t num = g_caps.limits.maxEncoders;
m_uniformBuffer = (UniformBuffer**)BX_ALLOC(g_allocator, sizeof(UniformBuffer*)*num);
m_uniformBuffer = (UniformBuffer**)bx::alloc(g_allocator, sizeof(UniformBuffer*)*num);
for (uint32_t ii = 0; ii < num; ++ii)
{
@ -2202,8 +2202,8 @@ namespace bgfx
UniformBuffer::destroy(m_uniformBuffer[ii]);
}
BX_FREE(g_allocator, m_uniformBuffer);
BX_DELETE(g_allocator, m_textVideoMem);
bx::free(g_allocator, m_uniformBuffer);
bx::deleteObject(g_allocator, m_textVideoMem);
}
void reset()
@ -3909,7 +3909,7 @@ namespace bgfx
+ bx::alignUp<uint32_t>(sizeof(TransientIndexBuffer), 16)
+ bx::alignUp(_size, 16)
;
tib = (TransientIndexBuffer*)BX_ALIGNED_ALLOC(g_allocator, size, 16);
tib = (TransientIndexBuffer*)bx::alignedAlloc(g_allocator, size, 16);
tib->data = (uint8_t *)tib + bx::alignUp(sizeof(TransientIndexBuffer), 16);
tib->size = _size;
tib->handle = handle;
@ -3926,7 +3926,7 @@ namespace bgfx
cmdbuf.write(_tib->handle);
m_submit->free(_tib->handle);
BX_ALIGNED_FREE(g_allocator, _tib, 16);
bx::alignedFree(g_allocator, _tib, 16);
}
BGFX_API_FUNC(void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num, bool _index32) )
@ -3976,7 +3976,7 @@ namespace bgfx
+ bx::alignUp<uint32_t>(sizeof(TransientVertexBuffer), 16)
+ bx::alignUp(_size, 16)
;
tvb = (TransientVertexBuffer*)BX_ALIGNED_ALLOC(g_allocator, size, 16);
tvb = (TransientVertexBuffer*)bx::alignedAlloc(g_allocator, size, 16);
tvb->data = (uint8_t *)tvb + bx::alignUp(sizeof(TransientVertexBuffer), 16);
tvb->size = _size;
tvb->startVertex = 0;
@ -3996,7 +3996,7 @@ namespace bgfx
cmdbuf.write(_tvb->handle);
m_submit->free(_tvb->handle);
BX_ALIGNED_FREE(g_allocator, _tvb, 16);
bx::alignedFree(g_allocator, _tvb, 16);
}
BGFX_API_FUNC(void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, VertexLayoutHandle _layoutHandle, uint16_t _stride) )
@ -4207,7 +4207,7 @@ namespace bgfx
if (0 != sr.m_num)
{
uint32_t size = sr.m_num*sizeof(UniformHandle);
sr.m_uniforms = (UniformHandle*)BX_ALLOC(g_allocator, size);
sr.m_uniforms = (UniformHandle*)bx::alloc(g_allocator, size);
bx::memCopy(sr.m_uniforms, uniforms, size);
}
@ -4320,7 +4320,7 @@ namespace bgfx
destroyUniform(sr.m_uniforms[ii]);
}
BX_FREE(g_allocator, sr.m_uniforms);
bx::free(g_allocator, sr.m_uniforms);
sr.m_uniforms = NULL;
sr.m_num = 0;
}

View File

@ -316,7 +316,7 @@ namespace bgfx { namespace gl
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
}
void GlContext::swap(SwapChainGL* _swapChain)

View File

@ -413,7 +413,7 @@ EGL_IMPORT
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
}
void GlContext::swap(SwapChainGL* _swapChain)

View File

@ -330,7 +330,7 @@ namespace bgfx { namespace gl
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context);
}

View File

@ -31,7 +31,7 @@ namespace bgfx { namespace gl
SwapChainGL(int _context, const char* _canvas)
: m_context(_context)
{
m_canvas = (char*)BX_ALLOC(g_allocator, strlen(_canvas) + 1);
m_canvas = (char*)bx::alloc(g_allocator, strlen(_canvas) + 1);
strcpy(m_canvas, _canvas);
makeCurrent();
@ -45,7 +45,7 @@ namespace bgfx { namespace gl
~SwapChainGL()
{
EMSCRIPTEN_CHECK(emscripten_webgl_destroy_context(m_context) );
BX_FREE(g_allocator, m_canvas);
bx::free(g_allocator, m_canvas);
}
void makeCurrent()
@ -107,7 +107,7 @@ namespace bgfx { namespace gl
m_current = NULL;
}
BX_DELETE(g_allocator, m_primary);
bx::deleteObject(g_allocator, m_primary);
m_primary = NULL;
}
}
@ -171,7 +171,7 @@ namespace bgfx { namespace gl
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
}
void GlContext::swap(SwapChainGL* /* _swapChain */)

View File

@ -333,7 +333,7 @@ namespace bgfx { namespace gl
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
}
void GlContext::swap(SwapChainGL* _swapChain)

View File

@ -349,7 +349,7 @@ namespace bgfx { namespace gl
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
BX_DELETE(g_allocator, _swapChain);
bx::deleteObject(g_allocator, _swapChain);
wglMakeCurrent(m_hdc, m_context);
}

View File

@ -1963,11 +1963,11 @@ namespace bgfx { namespace d3d11
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type]*_num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -1975,7 +1975,7 @@ namespace bgfx { namespace d3d11
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -3643,7 +3643,7 @@ namespace bgfx { namespace d3d11
s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
if (!s_renderD3D11->init(_init) )
{
BX_DELETE(g_allocator, s_renderD3D11);
bx::deleteObject(g_allocator, s_renderD3D11);
s_renderD3D11 = NULL;
}
return s_renderD3D11;
@ -3652,7 +3652,7 @@ namespace bgfx { namespace d3d11
void rendererDestroy()
{
s_renderD3D11->shutdown();
BX_DELETE(g_allocator, s_renderD3D11);
bx::deleteObject(g_allocator, s_renderD3D11);
s_renderD3D11 = NULL;
}
@ -4449,7 +4449,7 @@ namespace bgfx { namespace d3d11
if (convert)
{
uint32_t srcpitch = mip.m_width*bpp/8;
temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mip.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, srcpitch*mip.m_height);
bimg::imageDecodeToBgra8(g_allocator, temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);
srd[kk].pSysMem = temp;
@ -4467,17 +4467,17 @@ namespace bgfx { namespace d3d11
switch (m_textureFormat)
{
case TextureFormat::R5G6B5:
temp = (uint8_t*)BX_ALLOC(g_allocator, srd[kk].SysMemPitch*mip.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, srd[kk].SysMemPitch*mip.m_height);
bimg::imageConvert(temp, 16, bx::packB5G6R5, mip.m_data, bx::unpackR5G6B5, srd[kk].SysMemPitch*mip.m_height);
srd[kk].pSysMem = temp;
break;
case TextureFormat::RGBA4:
temp = (uint8_t*)BX_ALLOC(g_allocator, srd[kk].SysMemPitch*mip.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, srd[kk].SysMemPitch*mip.m_height);
bimg::imageConvert(temp, 16, bx::packBgra4, mip.m_data, bx::unpackRgba4, srd[kk].SysMemPitch*mip.m_height);
srd[kk].pSysMem = temp;
break;
case TextureFormat::RGB5A1:
temp = (uint8_t*)BX_ALLOC(g_allocator, srd[kk].SysMemPitch*mip.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, srd[kk].SysMemPitch*mip.m_height);
bimg::imageConvert(temp, 16, bx::packBgr5a1, mip.m_data, bx::unpackRgb5a1, srd[kk].SysMemPitch*mip.m_height);
srd[kk].pSysMem = temp;
break;
@ -4713,7 +4713,7 @@ namespace bgfx { namespace d3d11
{
for (uint32_t lod = 0, num = ti.numMips; lod < num; ++lod)
{
BX_FREE(g_allocator, const_cast<void*>(srd[kk].pSysMem) );
bx::free(g_allocator, const_cast<void*>(srd[kk].pSysMem) );
++kk;
}
}
@ -4801,7 +4801,7 @@ namespace bgfx { namespace d3d11
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch);
temp = (uint8_t*)bx::alloc(g_allocator, slicepitch);
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
@ -4820,7 +4820,7 @@ namespace bgfx { namespace d3d11
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}

View File

@ -2010,11 +2010,11 @@ namespace bgfx { namespace d3d12
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type] * _num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -2022,7 +2022,7 @@ namespace bgfx { namespace d3d12
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -2994,7 +2994,7 @@ namespace bgfx { namespace d3d12
if (cached)
{
cachedData = BX_ALLOC(g_allocator, length);
cachedData = bx::alloc(g_allocator, length);
if (g_callback->cacheRead(hash, cachedData, length) )
{
BX_TRACE("Loading cached compute PSO (size %d).", length);
@ -3039,7 +3039,7 @@ namespace bgfx { namespace d3d12
if (NULL != cachedData)
{
BX_FREE(g_allocator, cachedData);
bx::free(g_allocator, cachedData);
}
return pso;
@ -3275,7 +3275,7 @@ namespace bgfx { namespace d3d12
if (cached)
{
cachedData = BX_ALLOC(g_allocator, length);
cachedData = bx::alloc(g_allocator, length);
if (g_callback->cacheRead(hash, cachedData, length) )
{
BX_TRACE("Loading cached graphics PSO (size %d).", length);
@ -3327,7 +3327,7 @@ namespace bgfx { namespace d3d12
if (NULL != cachedData)
{
BX_FREE(g_allocator, cachedData);
bx::free(g_allocator, cachedData);
}
return pso;
@ -3642,7 +3642,7 @@ namespace bgfx { namespace d3d12
s_renderD3D12 = BX_NEW(g_allocator, RendererContextD3D12);
if (!s_renderD3D12->init(_init) )
{
BX_DELETE(g_allocator, s_renderD3D12);
bx::deleteObject(g_allocator, s_renderD3D12);
s_renderD3D12 = NULL;
}
return s_renderD3D12;
@ -3651,7 +3651,7 @@ namespace bgfx { namespace d3d12
void rendererDestroy()
{
s_renderD3D12->shutdown();
BX_DELETE(g_allocator, s_renderD3D12);
bx::deleteObject(g_allocator, s_renderD3D12);
s_renderD3D12 = NULL;
}
@ -4174,8 +4174,8 @@ namespace bgfx { namespace d3d12
, (void**)&m_commandSignature[DrawIndexed]
) );
m_cmds[Draw ] = BX_ALLOC(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndirectCommand) );
m_cmds[DrawIndexed] = BX_ALLOC(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndexedIndirectCommand) );
m_cmds[Draw ] = bx::alloc(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndirectCommand) );
m_cmds[DrawIndexed] = bx::alloc(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndexedIndirectCommand) );
uint32_t cmdSize = bx::max<uint32_t>(sizeof(DrawIndirectCommand), sizeof(DrawIndexedIndirectCommand) );
for (uint32_t ii = 0; ii < BX_COUNTOF(m_indirect); ++ii)
@ -4191,8 +4191,8 @@ namespace bgfx { namespace d3d12
void BatchD3D12::destroy()
{
BX_FREE(g_allocator, m_cmds[0]);
BX_FREE(g_allocator, m_cmds[1]);
bx::free(g_allocator, m_cmds[0]);
bx::free(g_allocator, m_cmds[1]);
DX_RELEASE(m_commandSignature[0], 0);
DX_RELEASE(m_commandSignature[1], 0);
@ -4983,7 +4983,7 @@ namespace bgfx { namespace d3d12
uint64_t requiredSize = 0;
const size_t sizeInBytes = size_t(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(uint32_t) + sizeof(uint64_t) ) * _numSubresources;
D3D12_PLACED_SUBRESOURCE_FOOTPRINT* layouts = (D3D12_PLACED_SUBRESOURCE_FOOTPRINT*)BX_ALLOC(g_allocator, sizeInBytes);
D3D12_PLACED_SUBRESOURCE_FOOTPRINT* layouts = (D3D12_PLACED_SUBRESOURCE_FOOTPRINT*)bx::alloc(g_allocator, sizeInBytes);
uint64_t* rowSizesInBytes = (uint64_t*)(layouts + _numSubresources);
uint32_t* numRows = (uint32_t*)(rowSizesInBytes + _numSubresources);
@ -5012,7 +5012,7 @@ namespace bgfx { namespace d3d12
, _srcData
);
BX_FREE(g_allocator, layouts);
bx::free(g_allocator, layouts);
return result;
}
@ -5112,7 +5112,7 @@ namespace bgfx { namespace d3d12
const uint32_t slice = bx::strideAlign(bx::max<uint32_t>(mip.m_height, 4)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
const uint32_t size = slice*mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -5133,7 +5133,7 @@ namespace bgfx { namespace d3d12
const uint32_t slice = bx::strideAlign( (mip.m_height/blockInfo.blockHeight)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
const uint32_t size = slice*mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageCopy(temp
, mip.m_height/blockInfo.blockHeight
, (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize
@ -5151,7 +5151,7 @@ namespace bgfx { namespace d3d12
const uint32_t pitch = bx::strideAlign(mip.m_width*mip.m_bpp / 8, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
const uint32_t slice = bx::strideAlign(mip.m_height*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice*mip.m_depth);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, slice*mip.m_depth);
bimg::imageCopy(temp
, mip.m_height
, mip.m_width*mip.m_bpp/8
@ -5388,7 +5388,7 @@ namespace bgfx { namespace d3d12
{
for (uint32_t lod = 0, num = ti.numMips; lod < num; ++lod)
{
BX_FREE(g_allocator, const_cast<void*>(srd[kk].pData) );
bx::free(g_allocator, const_cast<void*>(srd[kk].pData) );
++kk;
}
}
@ -5488,7 +5488,7 @@ namespace bgfx { namespace d3d12
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch);
temp = (uint8_t*)bx::alloc(g_allocator, slicepitch);
bimg::imageDecodeToBgra8(g_allocator, temp, srcData, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat));
srcData = temp;
@ -5529,7 +5529,7 @@ namespace bgfx { namespace d3d12
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
D3D12_RANGE writeRange = { 0, numRows*rowPitch };

View File

@ -1226,11 +1226,11 @@ namespace bgfx { namespace d3d9
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type]*_num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -1238,7 +1238,7 @@ namespace bgfx { namespace d3d9
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -2281,7 +2281,7 @@ namespace bgfx { namespace d3d9
s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
if (!s_renderD3D9->init(_init) )
{
BX_DELETE(g_allocator, s_renderD3D9);
bx::deleteObject(g_allocator, s_renderD3D9);
s_renderD3D9 = NULL;
}
return s_renderD3D9;
@ -2290,7 +2290,7 @@ namespace bgfx { namespace d3d9
void rendererDestroy()
{
s_renderD3D9->shutdown();
BX_DELETE(g_allocator, s_renderD3D9);
bx::deleteObject(g_allocator, s_renderD3D9);
s_renderD3D9 = NULL;
}
@ -2306,7 +2306,7 @@ namespace bgfx { namespace d3d9
{
usage |= D3DUSAGE_DYNAMIC;
pool = D3DPOOL_DEFAULT;
m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, _size);
m_dynamic = (uint8_t*)bx::alloc(g_allocator, _size);
}
const D3DFORMAT format = 0 == (_flags & BGFX_BUFFER_INDEX32)
@ -2369,7 +2369,7 @@ namespace bgfx { namespace d3d9
{
usage |= D3DUSAGE_DYNAMIC;
pool = D3DPOOL_DEFAULT;
m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, _size);
m_dynamic = (uint8_t*)bx::alloc(g_allocator, _size);
}
DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size
@ -3029,7 +3029,7 @@ namespace bgfx { namespace d3d9
{
uint32_t srcpitch = mipWidth*bpp/8;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, srcpitch*mipHeight);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -3042,7 +3042,7 @@ namespace bgfx { namespace d3d9
bx::memCopy(bits, pitch, temp, srcpitch, pitch, height);
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
else
{
@ -3111,7 +3111,7 @@ namespace bgfx { namespace d3d9
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, rectpitch*_rect.m_height);
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
}
@ -3146,7 +3146,7 @@ namespace bgfx { namespace d3d9
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
if (0 == _mip)

View File

@ -166,7 +166,7 @@ namespace bgfx { namespace d3d9
if (NULL != m_dynamic)
{
BX_FREE(g_allocator, m_dynamic);
bx::free(g_allocator, m_dynamic);
m_dynamic = NULL;
}
}
@ -219,7 +219,7 @@ namespace bgfx { namespace d3d9
if (NULL != m_dynamic)
{
BX_FREE(g_allocator, m_dynamic);
bx::free(g_allocator, m_dynamic);
m_dynamic = NULL;
}
}

View File

@ -3530,11 +3530,11 @@ namespace bgfx { namespace gl
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
uint32_t size = g_uniformTypeSize[_type]*_num;
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -3542,7 +3542,7 @@ namespace bgfx { namespace gl
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -3564,7 +3564,7 @@ namespace bgfx { namespace gl
m_glctx.makeCurrent(swapChain);
uint32_t length = width*height*4;
uint8_t* data = (uint8_t*)BX_ALLOC(g_allocator, length);
uint8_t* data = (uint8_t*)bx::alloc(g_allocator, length);
GL_CHECK(glReadPixels(0
, 0
@ -3588,7 +3588,7 @@ namespace bgfx { namespace gl
, length
, true
);
BX_FREE(g_allocator, data);
bx::free(g_allocator, data);
}
void updateViewName(ViewId _id, const char* _name) override
@ -4292,7 +4292,7 @@ namespace bgfx { namespace gl
if (m_resolution.reset&BGFX_RESET_CAPTURE)
{
m_captureSize = m_resolution.width*m_resolution.height*4;
m_capture = BX_REALLOC(g_allocator, m_capture, m_captureSize);
m_capture = bx::realloc(g_allocator, m_capture, m_captureSize);
g_callback->captureBegin(m_resolution.width, m_resolution.height, m_resolution.width*4, TextureFormat::BGRA8, true);
}
else
@ -4335,7 +4335,7 @@ namespace bgfx { namespace gl
if (NULL != m_capture)
{
g_callback->captureEnd();
BX_FREE(g_allocator, m_capture);
bx::free(g_allocator, m_capture);
m_capture = NULL;
m_captureSize = 0;
}
@ -4354,7 +4354,7 @@ namespace bgfx { namespace gl
if (cached)
{
void* data = BX_ALLOC(g_allocator, length);
void* data = bx::alloc(g_allocator, length);
if (g_callback->cacheRead(_id, data, length) )
{
bx::Error err;
@ -4366,7 +4366,7 @@ namespace bgfx { namespace gl
GL_CHECK(glProgramBinary(programId, format, reader.getDataPtr(), (GLsizei)reader.remaining() ) );
}
BX_FREE(g_allocator, data);
bx::free(g_allocator, data);
}
#if BGFX_CONFIG_RENDERER_OPENGL
@ -4390,13 +4390,13 @@ namespace bgfx { namespace gl
if (0 < programLength)
{
uint32_t length = programLength + 4;
uint8_t* data = (uint8_t*)BX_ALLOC(g_allocator, length);
uint8_t* data = (uint8_t*)bx::alloc(g_allocator, length);
GL_CHECK(glGetProgramBinary(programId, programLength, NULL, &format, &data[4]) );
*(uint32_t*)data = format;
g_callback->cacheWrite(_id, data, length);
BX_FREE(g_allocator, data);
bx::free(g_allocator, data);
}
}
}
@ -4830,7 +4830,7 @@ namespace bgfx { namespace gl
s_renderGL = BX_NEW(g_allocator, RendererContextGL);
if (!s_renderGL->init(_init) )
{
BX_DELETE(g_allocator, s_renderGL);
bx::deleteObject(g_allocator, s_renderGL);
s_renderGL = NULL;
}
return s_renderGL;
@ -4839,7 +4839,7 @@ namespace bgfx { namespace gl
void rendererDestroy()
{
s_renderGL->shutdown();
BX_DELETE(g_allocator, s_renderGL);
bx::deleteObject(g_allocator, s_renderGL);
s_renderGL = NULL;
}
@ -5786,7 +5786,7 @@ namespace bgfx { namespace gl
uint8_t* temp = NULL;
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, ti.width*ti.height*4);
temp = (uint8_t*)bx::alloc(g_allocator, ti.width*ti.height*4);
}
const uint16_t numSides = ti.numLayers * (imageContainer.m_cubeMap ? 6 : 1);
@ -5922,7 +5922,7 @@ namespace bgfx { namespace gl
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}
@ -5994,7 +5994,7 @@ namespace bgfx { namespace gl
if (convert
|| !unpackRowLength)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*height);
temp = (uint8_t*)bx::alloc(g_allocator, rectpitch*height);
}
else if (unpackRowLength)
{
@ -6069,7 +6069,7 @@ namespace bgfx { namespace gl
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}

View File

@ -805,7 +805,7 @@ namespace bgfx { namespace mtl
if (NULL != m_dynamic)
{
BX_DELETE(g_allocator, m_dynamic);
bx::deleteObject(g_allocator, m_dynamic);
m_dynamic = NULL;
}
}
@ -940,7 +940,7 @@ namespace bgfx { namespace mtl
void release(PipelineStateMtl* _ptr)
{
BX_DELETE(g_allocator, _ptr);
bx::deleteObject(g_allocator, _ptr);
}
struct TextureMtl

View File

@ -1095,11 +1095,11 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type]*_num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -1107,7 +1107,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -1134,7 +1134,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
uint32_t width = m_screenshotTarget.width();
uint32_t height = m_screenshotTarget.height();
uint32_t length = width*height*4;
uint8_t* data = (uint8_t*)BX_ALLOC(g_allocator, length);
uint8_t* data = (uint8_t*)bx::alloc(g_allocator, length);
MTLRegion region = { { 0, 0, 0 }, { width, height, 1 } };
@ -1150,7 +1150,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
, false
);
BX_FREE(g_allocator, data);
bx::free(g_allocator, data);
m_commandBuffer = m_cmd.alloc();
}
@ -1433,7 +1433,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (m_resolution.reset&BGFX_RESET_CAPTURE)
{
m_captureSize = m_resolution.width*m_resolution.height*4;
m_capture = BX_REALLOC(g_allocator, m_capture, m_captureSize);
m_capture = bx::realloc(g_allocator, m_capture, m_captureSize);
g_callback->captureBegin(m_resolution.width, m_resolution.height, m_resolution.width*4, TextureFormat::BGRA8, false);
}
else
@ -1525,7 +1525,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (NULL != m_capture)
{
g_callback->captureEnd();
BX_FREE(g_allocator, m_capture);
bx::free(g_allocator, m_capture);
m_capture = NULL;
m_captureSize = 0;
}
@ -2558,7 +2558,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
s_renderMtl = BX_NEW(g_allocator, RendererContextMtl);
if (!s_renderMtl->init(_init) )
{
BX_DELETE(g_allocator, s_renderMtl);
bx::deleteObject(g_allocator, s_renderMtl);
s_renderMtl = NULL;
}
return s_renderMtl;
@ -2567,7 +2567,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
void rendererDestroy()
{
s_renderMtl->shutdown();
BX_DELETE(g_allocator, s_renderMtl);
bx::deleteObject(g_allocator, s_renderMtl);
s_renderMtl = NULL;
}
@ -2731,7 +2731,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
m_fsh = NULL;
if (NULL != m_computePS)
{
BX_DELETE(g_allocator, m_computePS);
bx::deleteObject(g_allocator, m_computePS);
m_computePS = NULL;
}
}
@ -2763,7 +2763,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
{
if (NULL == m_dynamic)
{
m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, m_size);
m_dynamic = (uint8_t*)bx::alloc(g_allocator, m_size);
}
bx::memCopy(m_dynamic + _offset, _data, _size);
@ -2961,7 +2961,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
uint8_t* temp = NULL;
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, ti.width*ti.height*4);
temp = (uint8_t*)bx::alloc(g_allocator, ti.width*ti.height*4);
}
for (uint16_t side = 0; side < numSides; ++side)
@ -3037,7 +3037,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}
}
@ -3070,7 +3070,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, rectpitch*_rect.m_height);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -3134,7 +3134,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}
@ -3551,7 +3551,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
{
if (NULL != m_swapChain)
{
BX_DELETE(g_allocator, m_swapChain);
bx::deleteObject(g_allocator, m_swapChain);
m_swapChain = NULL;
}

View File

@ -280,7 +280,7 @@ namespace bgfx { namespace noop
void rendererDestroy()
{
BX_DELETE(g_allocator, s_renderNOOP);
bx::deleteObject(g_allocator, s_renderNOOP);
s_renderNOOP = NULL;
}
} /* namespace noop */ } // namespace bgfx

View File

@ -530,13 +530,13 @@ VK_IMPORT_DEVICE
static void* VKAPI_PTR allocationFunction(void* _userData, size_t _size, size_t _alignment, VkSystemAllocationScope _allocationScope)
{
BX_UNUSED(_userData, _allocationScope);
return bx::alignedAlloc(g_allocator, _size, _alignment, s_allocScopeName[_allocationScope]);
return bx::alignedAlloc(g_allocator, _size, _alignment, bx::Location(s_allocScopeName[_allocationScope], 0) );
}
static void* VKAPI_PTR reallocationFunction(void* _userData, void* _original, size_t _size, size_t _alignment, VkSystemAllocationScope _allocationScope)
{
BX_UNUSED(_userData, _allocationScope);
return bx::alignedRealloc(g_allocator, _original, _size, _alignment, s_allocScopeName[_allocationScope]);
return bx::alignedRealloc(g_allocator, _original, _size, _alignment, bx::Location(s_allocScopeName[_allocationScope], 0) );
}
static void VKAPI_PTR freeFunction(void* _userData, void* _memory)
@ -699,7 +699,7 @@ VK_IMPORT_DEVICE
if (VK_SUCCESS == result
&& 0 < numExtensionProperties)
{
VkExtensionProperties* extensionProperties = (VkExtensionProperties*)BX_ALLOC(g_allocator, numExtensionProperties * sizeof(VkExtensionProperties) );
VkExtensionProperties* extensionProperties = (VkExtensionProperties*)bx::alloc(g_allocator, numExtensionProperties * sizeof(VkExtensionProperties) );
result = enumerateExtensionProperties(_physicalDevice
, NULL
, &numExtensionProperties
@ -728,7 +728,7 @@ VK_IMPORT_DEVICE
BX_UNUSED(supported);
}
BX_FREE(g_allocator, extensionProperties);
bx::free(g_allocator, extensionProperties);
}
}
@ -739,7 +739,7 @@ VK_IMPORT_DEVICE
if (VK_SUCCESS == result
&& 0 < numLayerProperties)
{
VkLayerProperties* layerProperties = (VkLayerProperties*)BX_ALLOC(g_allocator, numLayerProperties * sizeof(VkLayerProperties) );
VkLayerProperties* layerProperties = (VkLayerProperties*)bx::alloc(g_allocator, numLayerProperties * sizeof(VkLayerProperties) );
result = enumerateLayerProperties(_physicalDevice, &numLayerProperties, layerProperties);
char indent = VK_NULL_HANDLE == _physicalDevice ? '\0' : '\t';
@ -774,7 +774,7 @@ VK_IMPORT_DEVICE
if (VK_SUCCESS == result
&& 0 < numExtensionProperties)
{
VkExtensionProperties* extensionProperties = (VkExtensionProperties*)BX_ALLOC(g_allocator, numExtensionProperties * sizeof(VkExtensionProperties) );
VkExtensionProperties* extensionProperties = (VkExtensionProperties*)bx::alloc(g_allocator, numExtensionProperties * sizeof(VkExtensionProperties) );
result = enumerateExtensionProperties(_physicalDevice
, layerProperties[layer].layerName
, &numExtensionProperties
@ -800,11 +800,11 @@ VK_IMPORT_DEVICE
BX_UNUSED(supported);
}
BX_FREE(g_allocator, extensionProperties);
bx::free(g_allocator, extensionProperties);
}
}
BX_FREE(g_allocator, layerProperties);
bx::free(g_allocator, layerProperties);
}
}
@ -1722,7 +1722,7 @@ VK_IMPORT_INSTANCE
, NULL
);
VkQueueFamilyProperties* queueFamilyPropertices = (VkQueueFamilyProperties*)BX_ALLOC(g_allocator, queueFamilyPropertyCount * sizeof(VkQueueFamilyProperties) );
VkQueueFamilyProperties* queueFamilyPropertices = (VkQueueFamilyProperties*)bx::alloc(g_allocator, queueFamilyPropertyCount * sizeof(VkQueueFamilyProperties) );
vkGetPhysicalDeviceQueueFamilyProperties(
m_physicalDevice
, &queueFamilyPropertyCount
@ -1752,7 +1752,7 @@ VK_IMPORT_INSTANCE
}
}
BX_FREE(g_allocator, queueFamilyPropertices);
bx::free(g_allocator, queueFamilyPropertices);
if (UINT32_MAX == m_globalQueueFamily)
{
@ -2419,11 +2419,11 @@ VK_IMPORT_DEVICE
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type] * _num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -2431,7 +2431,7 @@ VK_IMPORT_DEVICE
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
}
@ -3728,7 +3728,7 @@ VK_IMPORT_DEVICE
if (cached)
{
cachedData = BX_ALLOC(g_allocator, length);
cachedData = bx::alloc(g_allocator, length);
if (g_callback->cacheRead(hash, cachedData, length) )
{
BX_TRACE("Loading cached pipeline state (size %d).", length);
@ -3759,7 +3759,7 @@ VK_IMPORT_DEVICE
{
if (length < dataSize)
{
cachedData = BX_REALLOC(g_allocator, cachedData, dataSize);
cachedData = bx::realloc(g_allocator, cachedData, dataSize);
}
VK_CHECK(vkGetPipelineCacheData(m_device, cache, &dataSize, cachedData) );
@ -3771,7 +3771,7 @@ VK_IMPORT_DEVICE
if (NULL != cachedData)
{
BX_FREE(g_allocator, cachedData);
bx::free(g_allocator, cachedData);
}
return pipeline;
@ -4052,13 +4052,13 @@ VK_IMPORT_DEVICE
const uint32_t dstPitch = width * dstBpp / 8;
const uint32_t dstSize = height * dstPitch;
void* dst = BX_ALLOC(g_allocator, dstSize);
void* dst = bx::alloc(g_allocator, dstSize);
bimg::imageConvert(g_allocator, dst, bimg::TextureFormat::BGRA8, src, bimg::TextureFormat::Enum(_swapChain.m_colorFormat), width, height, 1);
_func(dst, width, height, dstPitch, _userData);
BX_FREE(g_allocator, dst);
bx::free(g_allocator, dst);
}
vkUnmapMemory(m_device, _memory);
@ -4494,7 +4494,7 @@ VK_IMPORT_DEVICE
s_renderVK = BX_NEW(g_allocator, RendererContextVK);
if (!s_renderVK->init(_init) )
{
BX_DELETE(g_allocator, s_renderVK);
bx::deleteObject(g_allocator, s_renderVK);
s_renderVK = NULL;
}
return s_renderVK;
@ -4503,7 +4503,7 @@ VK_IMPORT_DEVICE
void rendererDestroy()
{
s_renderVK->shutdown();
BX_DELETE(g_allocator, s_renderVK);
bx::deleteObject(g_allocator, s_renderVK);
s_renderVK = NULL;
}
@ -5964,7 +5964,7 @@ VK_DESTROY
uint32_t layer;
};
ImageInfo* imageInfos = (ImageInfo*)BX_ALLOC(g_allocator, sizeof(ImageInfo) * numSrd);
ImageInfo* imageInfos = (ImageInfo*)bx::alloc(g_allocator, sizeof(ImageInfo) * numSrd);
bx::memSet(imageInfos, 0, sizeof(ImageInfo) * numSrd);
uint32_t alignment = 1; // tightly aligned buffer
@ -5982,7 +5982,7 @@ VK_DESTROY
const uint32_t slice = bx::strideAlign(bx::max<uint32_t>(mip.m_height, 4) * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -6009,7 +6009,7 @@ VK_DESTROY
const uint32_t slice = bx::strideAlign( (mip.m_height / blockInfo.blockHeight) * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageCopy(
temp
, mip.m_height / blockInfo.blockHeight
@ -6035,7 +6035,7 @@ VK_DESTROY
const uint32_t slice = bx::strideAlign(mip.m_height * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageCopy(
temp
, mip.m_height
@ -6061,7 +6061,7 @@ VK_DESTROY
}
uint32_t totalMemSize = 0;
VkBufferImageCopy* bufferCopyInfo = (VkBufferImageCopy*)BX_ALLOC(g_allocator, sizeof(VkBufferImageCopy) * numSrd);
VkBufferImageCopy* bufferCopyInfo = (VkBufferImageCopy*)bx::alloc(g_allocator, sizeof(VkBufferImageCopy) * numSrd);
for (uint32_t ii = 0; ii < numSrd; ++ii)
{
@ -6116,14 +6116,14 @@ VK_DESTROY
setImageMemoryBarrier(_commandBuffer, m_sampledLayout);
}
BX_FREE(g_allocator, bufferCopyInfo);
bx::free(g_allocator, bufferCopyInfo);
for (uint32_t ii = 0; ii < numSrd; ++ii)
{
BX_FREE(g_allocator, imageInfos[ii].data);
bx::free(g_allocator, imageInfos[ii].data);
}
BX_FREE(g_allocator, imageInfos);
bx::free(g_allocator, imageInfos);
m_readback.create(m_textureImage, m_width, m_height, TextureFormat::Enum(m_textureFormat) );
}
@ -6182,7 +6182,7 @@ VK_DESTROY
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch);
temp = (uint8_t*)bx::alloc(g_allocator, slicepitch);
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat));
data = temp;
@ -6219,7 +6219,7 @@ VK_DESTROY
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}
@ -7294,13 +7294,13 @@ VK_DESTROY
return selectedFormat;
}
VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)BX_ALLOC(g_allocator, numSurfaceFormats * sizeof(VkSurfaceFormatKHR) );
VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)bx::alloc(g_allocator, numSurfaceFormats * sizeof(VkSurfaceFormatKHR) );
result = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &numSurfaceFormats, surfaceFormats);
if (VK_SUCCESS != result)
{
BX_TRACE("findSurfaceFormat error: vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) );
BX_FREE(g_allocator, surfaceFormats);
bx::free(g_allocator, surfaceFormats);
return selectedFormat;
}
@ -7340,7 +7340,7 @@ VK_DESTROY
}
}
BX_FREE(g_allocator, surfaceFormats);
bx::free(g_allocator, surfaceFormats);
if (TextureFormat::Count == selectedFormat)
{

View File

@ -1023,11 +1023,11 @@ namespace bgfx { namespace webgpu
{
if (NULL != m_uniforms[_handle.idx])
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
uint32_t size = bx::alignUp(g_uniformTypeSize[_type]*_num, 16);
void* data = BX_ALLOC(g_allocator, size);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
@ -1035,7 +1035,7 @@ namespace bgfx { namespace webgpu
void destroyUniform(UniformHandle _handle) override
{
BX_FREE(g_allocator, m_uniforms[_handle.idx]);
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
m_uniformReg.remove(_handle);
}
@ -2459,7 +2459,7 @@ namespace bgfx { namespace webgpu
s_renderWgpu = BX_NEW(g_allocator, RendererContextWgpu);
if (!s_renderWgpu->init(_init) )
{
BX_DELETE(g_allocator, s_renderWgpu);
bx::deleteObject(g_allocator, s_renderWgpu);
s_renderWgpu = NULL;
}
return s_renderWgpu;
@ -2468,7 +2468,7 @@ namespace bgfx { namespace webgpu
void rendererDestroy()
{
s_renderWgpu->shutdown();
BX_DELETE(g_allocator, s_renderWgpu);
bx::deleteObject(g_allocator, s_renderWgpu);
s_renderWgpu = NULL;
}
@ -2717,7 +2717,7 @@ namespace bgfx { namespace webgpu
const uint32_t* code = (const uint32_t*)reader.getDataPtr();
bx::skip(&reader, shaderSize+1);
m_code = (uint32_t*)BX_ALLOC(g_allocator, shaderSize);
m_code = (uint32_t*)bx::alloc(g_allocator, shaderSize);
m_codeSize = shaderSize;
bx::memCopy(m_code, code, shaderSize);
@ -2938,7 +2938,7 @@ namespace bgfx { namespace webgpu
m_fsh = NULL;
if ( NULL != m_computePS )
{
BX_DELETE(g_allocator, m_computePS);
bx::deleteObject(g_allocator, m_computePS);
m_computePS = NULL;
}
}
@ -2981,7 +2981,7 @@ namespace bgfx { namespace webgpu
{
if ( m_dynamic == NULL )
{
m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, m_size);
m_dynamic = (uint8_t*)bx::alloc(g_allocator, m_size);
}
bx::memCopy(m_dynamic + _offset, _data, _size);
@ -3202,7 +3202,7 @@ namespace bgfx { namespace webgpu
uint8_t layer;
};
ImageInfo* imageInfos = (ImageInfo*)BX_ALLOC(g_allocator, sizeof(ImageInfo) * numSrd);
ImageInfo* imageInfos = (ImageInfo*)bx::alloc(g_allocator, sizeof(ImageInfo) * numSrd);
bx::memSet(imageInfos, 0, sizeof(ImageInfo) * numSrd);
uint32_t alignment = 1; // tightly aligned buffer
@ -3221,7 +3221,7 @@ namespace bgfx { namespace webgpu
const uint32_t slice = bx::strideAlign(bx::max<uint32_t>(mip.m_height, 4) * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -3248,7 +3248,7 @@ namespace bgfx { namespace webgpu
const uint32_t slice = bx::strideAlign((mip.m_height / blockInfo.blockHeight) * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageCopy(
temp
, mip.m_height / blockInfo.blockHeight
@ -3274,7 +3274,7 @@ namespace bgfx { namespace webgpu
const uint32_t slice = bx::strideAlign(mip.m_height * pitch, alignment);
const uint32_t size = slice * mip.m_depth;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, size);
bimg::imageCopy(temp
, mip.m_height
, mip.m_width * mip.m_bpp / 8
@ -3338,9 +3338,9 @@ namespace bgfx { namespace webgpu
stagingBuffer.Unmap();
}
wgpu::ImageCopyBuffer* imageCopyBuffer = (wgpu::ImageCopyBuffer*)BX_ALLOC(g_allocator, sizeof(wgpu::ImageCopyBuffer) * numSrd);
wgpu::ImageCopyTexture* imageCopyTexture = (wgpu::ImageCopyTexture*)BX_ALLOC(g_allocator, sizeof(wgpu::ImageCopyTexture) * numSrd);
wgpu::Extent3D* textureCopySize = (wgpu::Extent3D*)BX_ALLOC(g_allocator, sizeof(wgpu::Extent3D) * numSrd);
wgpu::ImageCopyBuffer* imageCopyBuffer = (wgpu::ImageCopyBuffer*)bx::alloc(g_allocator, sizeof(wgpu::ImageCopyBuffer) * numSrd);
wgpu::ImageCopyTexture* imageCopyTexture = (wgpu::ImageCopyTexture*)bx::alloc(g_allocator, sizeof(wgpu::ImageCopyTexture) * numSrd);
wgpu::Extent3D* textureCopySize = (wgpu::Extent3D*)bx::alloc(g_allocator, sizeof(wgpu::Extent3D) * numSrd);
uint64_t offset = 0;
@ -3392,14 +3392,14 @@ namespace bgfx { namespace webgpu
//vkFreeMemory(device, stagingDeviceMem, allocatorCb);
//vkDestroy(stagingBuffer);
BX_FREE(g_allocator, imageCopyBuffer);
BX_FREE(g_allocator, imageCopyTexture);
BX_FREE(g_allocator, textureCopySize);
bx::free(g_allocator, imageCopyBuffer);
bx::free(g_allocator, imageCopyTexture);
bx::free(g_allocator, textureCopySize);
for (uint32_t ii = 0; ii < numSrd; ++ii)
{
BX_FREE(g_allocator, imageInfos[ii].data);
bx::free(g_allocator, imageInfos[ii].data);
}
BX_FREE(g_allocator, imageInfos);
bx::free(g_allocator, imageInfos);
}
}
@ -3418,7 +3418,7 @@ namespace bgfx { namespace webgpu
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
temp = (uint8_t*)bx::alloc(g_allocator, rectpitch*_rect.m_height);
bimg::imageDecodeToBgra8(
g_allocator
, temp
@ -3478,7 +3478,7 @@ namespace bgfx { namespace webgpu
if (NULL != temp)
{
BX_FREE(g_allocator, temp);
bx::free(g_allocator, temp);
}
}
@ -3860,7 +3860,7 @@ namespace bgfx { namespace webgpu
{
if (NULL != m_swapChain)
{
BX_DELETE(g_allocator, m_swapChain);
bx::deleteObject(g_allocator, m_swapChain);
m_swapChain = NULL;
}

View File

@ -98,7 +98,7 @@ namespace bgfx { namespace webgpu
if(NULL != m_dynamic)
{
BX_DELETE(g_allocator, m_dynamic);
bx::deleteObject(g_allocator, m_dynamic);
m_dynamic = NULL;
}
}
@ -278,12 +278,12 @@ namespace bgfx { namespace webgpu
void release(RenderPassStateWgpu* _ptr)
{
BX_DELETE(g_allocator, _ptr);
bx::deleteObject(g_allocator, _ptr);
}
void release(PipelineStateWgpu* _ptr)
{
BX_DELETE(g_allocator, _ptr);
bx::deleteObject(g_allocator, _ptr);
}
class StagingBufferWgpu
@ -413,7 +413,7 @@ namespace bgfx { namespace webgpu
void release(SamplerStateWgpu* _ptr)
{
BX_DELETE(g_allocator, _ptr);
bx::deleteObject(g_allocator, _ptr);
}
struct FrameBufferWgpu;

View File

@ -250,7 +250,7 @@ namespace bgfx
if (!_err->isOk() ) { return; }
uint8_t* shaderCode = (uint8_t*)BX_ALLOC(g_allocator, shaderSize);
uint8_t* shaderCode = (uint8_t*)bx::alloc(g_allocator, shaderSize);
bx::read(_reader, shaderCode, shaderSize, _err);
bx::MemoryReader reader(shaderCode, shaderSize);
@ -258,7 +258,7 @@ namespace bgfx
bx::write(_writer, '\0', _err);
BX_FREE(g_allocator, shaderCode);
bx::free(g_allocator, shaderCode);
}
else
{

View File

@ -143,10 +143,10 @@ namespace bgfx
template<typename IndexT, typename SortT>
static uint32_t topologyConvertTriListToLineList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices, bx::AllocatorI* _allocator)
{
IndexT* temp = (IndexT*)BX_ALLOC(_allocator, _numIndices*2*sizeof(IndexT)*2);
IndexT* temp = (IndexT*)bx::alloc(_allocator, _numIndices*2*sizeof(IndexT)*2);
SortT* tempSort = (SortT*)&temp[_numIndices*2];
uint32_t num = topologyConvertTriListToLineList(_dst, _dstSize, _indices, _numIndices, temp, tempSort);
BX_FREE(_allocator, temp);
bx::free(_allocator, temp);
return num;
}
@ -397,7 +397,7 @@ namespace bgfx
: sizeof(uint16_t)
;
uint32_t num = bx::uint32_min(_numIndices*indexSize, _dstSize)/(indexSize*3);
uint32_t* temp = (uint32_t*)BX_ALLOC(_allocator, sizeof(uint32_t)*num*4);
uint32_t* temp = (uint32_t*)bx::alloc(_allocator, sizeof(uint32_t)*num*4);
uint32_t* keys = &temp[num*0];
uint32_t* values = &temp[num*1];
@ -439,7 +439,7 @@ namespace bgfx
);
}
BX_FREE(_allocator, temp);
bx::free(_allocator, temp);
}
} //namespace bgfx

View File

@ -777,7 +777,7 @@ namespace bgfx
uint32_t numVertices = 0;
const uint32_t size = sizeof(IndexT)*(hashSize + _num);
IndexT* hashTable = (IndexT*)BX_ALLOC(_allocator, size);
IndexT* hashTable = (IndexT*)bx::alloc(_allocator, size);
bx::memSet(hashTable, 0xff, size);
IndexT* next = hashTable + hashSize;
@ -810,7 +810,7 @@ namespace bgfx
}
}
BX_FREE(_allocator, hashTable);
bx::free(_allocator, hashTable);
return IndexT(numVertices);
}

View File

@ -37,14 +37,14 @@ namespace bgfx
void* TinyStlAllocator::static_allocate(size_t _bytes)
{
return BX_ALLOC(g_allocator, _bytes);
return bx::alloc(g_allocator, _bytes);
}
void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
{
if (NULL != _ptr)
{
BX_FREE(g_allocator, _ptr);
bx::free(g_allocator, _ptr);
}
}
} // namespace bgfx