Apple support

This commit is contained in:
Tim 2018-02-27 18:53:50 +10:00
parent c793ba342f
commit 01d1d71aef

View File

@ -1739,10 +1739,20 @@ remove them if not needed.
#include <mutex> // for std::mutex #include <mutex> // for std::mutex
#include <atomic> // for std::atomic #include <atomic> // for std::atomic
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(__APPLE__)
#include <malloc.h> // for aligned_alloc() #include <malloc.h> // for aligned_alloc()
#endif #endif
#if defined(__APPLE__)
#include <cstdlib>
void *aligned_alloc(size_t alignment, size_t size)
{
void *pointer;
posix_memalign(&pointer, alignment, size);
return pointer;
}
#endif
// Normal assert to check for programmer's errors, especially in Debug configuration. // Normal assert to check for programmer's errors, especially in Debug configuration.
#ifndef VMA_ASSERT #ifndef VMA_ASSERT
#ifdef _DEBUG #ifdef _DEBUG
@ -4964,7 +4974,7 @@ void VmaBlockMetadata::PrintDetailedMap(class VmaJsonWriter& json) const
json.WriteNumber(m_SumFreeSize); json.WriteNumber(m_SumFreeSize);
json.WriteString("Allocations"); json.WriteString("Allocations");
json.WriteNumber(m_Suballocations.size() - m_FreeCount); json.WriteNumber((uint64_t)m_Suballocations.size() - m_FreeCount);
json.WriteString("UnusedRanges"); json.WriteString("UnusedRanges");
json.WriteNumber(m_FreeCount); json.WriteNumber(m_FreeCount);
@ -6322,7 +6332,7 @@ size_t VmaBlockVector::CalcMaxBlockSize() const
size_t result = 0; size_t result = 0;
for(size_t i = m_Blocks.size(); i--; ) for(size_t i = m_Blocks.size(); i--; )
{ {
result = VMA_MAX(result, m_Blocks[i]->m_Metadata.GetSize()); result = VMA_MAX((uint64_t)result, (uint64_t)m_Blocks[i]->m_Metadata.GetSize());
if(result >= m_PreferredBlockSize) if(result >= m_PreferredBlockSize)
{ {
break; break;
@ -6408,15 +6418,15 @@ void VmaBlockVector::PrintDetailedMap(class VmaJsonWriter& json)
if(m_MinBlockCount > 0) if(m_MinBlockCount > 0)
{ {
json.WriteString("Min"); json.WriteString("Min");
json.WriteNumber(m_MinBlockCount); json.WriteNumber((uint64_t)m_MinBlockCount);
} }
if(m_MaxBlockCount < SIZE_MAX) if(m_MaxBlockCount < SIZE_MAX)
{ {
json.WriteString("Max"); json.WriteString("Max");
json.WriteNumber(m_MaxBlockCount); json.WriteNumber((uint64_t)m_MaxBlockCount);
} }
json.WriteString("Cur"); json.WriteString("Cur");
json.WriteNumber(m_Blocks.size()); json.WriteNumber((uint64_t)m_Blocks.size());
json.EndObject(); json.EndObject();
if(m_FrameInUseCount > 0) if(m_FrameInUseCount > 0)