diff options
author | 2023-09-05 17:10:24 +0200 | |
---|---|---|
committer | 2023-09-06 01:10:24 +1000 | |
commit | 1c61ccfe840cdae7a9f92292946a45f3b47e2412 (patch) | |
tree | b56d4b69b96e314abcf56407da44705a602727f1 /3rdparty/bgfx/examples/common/bgfx_utils.cpp | |
parent | b2c399c61d65063ae95e8387d34b098e9516b1a9 (diff) |
Updated bgfx, bx and bimg to current upstream versions. (#11493)
* Reverted "macOS, iOS: Removed OpenGL/OpenGLES support. (commit 4693983242a698eaafed87faf4ffef1789adc8f9).
* Reverted "Fix macOS build" (commit ce2c2c13eda7d699051f75f598e740a447343a88).
* Reverted "macOS: Fixed deprecated warnings." (commit 10a8cb61f882ebc9bb376ee2341d003880b7037f).
* Added bgfx/README.mame explaining deviations from upstream.
Diffstat (limited to '3rdparty/bgfx/examples/common/bgfx_utils.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/common/bgfx_utils.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index 209e3ea7fe1..fd9cfe9ab17 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -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) |