This commit is contained in:
Branimir Karadžić 2017-07-15 14:32:29 -07:00
parent a274c9a6c5
commit 0bbbb585d1
3 changed files with 11 additions and 7 deletions

View File

@ -240,6 +240,8 @@ struct BgfxCallback : public bgfx::CallbackI
AviWriter* m_writer;
};
const size_t kNaturalAlignment = 8;
class BgfxAllocator : public bx::AllocatorI
{
public:
@ -259,7 +261,7 @@ public:
{
if (NULL != _ptr)
{
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
bx::debugPrintf("%s(%d): FREE %p\n", _file, _line, _ptr);
::free(_ptr);
@ -275,7 +277,7 @@ public:
}
else if (NULL == _ptr)
{
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
void* ptr = ::malloc(_size);
bx::debugPrintf("%s(%d): ALLOC %p of %d byte(s)\n", _file, _line, ptr, _size);
@ -287,7 +289,7 @@ public:
return bx::alignedAlloc(this, _size, _align, _file, _line);
}
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
void* ptr = ::realloc(_ptr, _size);
bx::debugPrintf("%s(%d): REALLOC %p (old %p) of %d byte(s)\n", _file, _line, ptr, _ptr, _size);

View File

@ -148,6 +148,8 @@ namespace bgfx
# define BGFX_CONFIG_MEMORY_TRACKING (BGFX_CONFIG_DEBUG && BX_CONFIG_SUPPORTS_THREADING)
#endif // BGFX_CONFIG_MEMORY_TRACKING
const size_t kNaturalAlignment = 8;
class AllocatorStub : public bx::AllocatorI
{
public:
@ -165,7 +167,7 @@ namespace bgfx
{
if (NULL != _ptr)
{
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
#if BGFX_CONFIG_MEMORY_TRACKING
{
@ -187,7 +189,7 @@ namespace bgfx
}
else if (NULL == _ptr)
{
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
#if BGFX_CONFIG_MEMORY_TRACKING
{
@ -203,7 +205,7 @@ namespace bgfx
return bx::alignedAlloc(this, _size, _align, _file, _line);
}
if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
if (kNaturalAlignment >= _align)
{
#if BGFX_CONFIG_MEMORY_TRACKING
if (NULL == _ptr)

View File

@ -332,7 +332,7 @@ VK_IMPORT_DEVICE
return;
}
bx::alignedFree(g_allocator, _memory, BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT);
bx::alignedFree(g_allocator, _memory, 8);
}
static void VKAPI_PTR internalAllocationNotification(void* _userData, size_t _size, VkInternalAllocationType _allocationType, VkSystemAllocationScope _allocationScope)