Common: namespace MemoryUtil

This commit is contained in:
Lioncash
2016-08-07 13:03:07 -04:00
parent 1ab99ee22c
commit e01c143379
15 changed files with 50 additions and 40 deletions

View File

@ -106,7 +106,7 @@ void PauseAndLock(bool doLock, bool unpauseOnUnlock)
void Init()
{
// Padded so that SIMD overreads in the vertex loader are safe
s_video_buffer = (u8*)AllocateMemoryPages(FIFO_SIZE + 4);
s_video_buffer = static_cast<u8*>(Common::AllocateMemoryPages(FIFO_SIZE + 4));
ResetVideoBuffer();
if (SConfig::GetInstance().bCPUThread)
s_gpu_mainloop.Prepare();
@ -118,7 +118,7 @@ void Shutdown()
if (s_gpu_mainloop.IsRunning())
PanicAlert("Fifo shutting down while active");
FreeMemoryPages(s_video_buffer, FIFO_SIZE + 4);
Common::FreeMemoryPages(s_video_buffer, FIFO_SIZE + 4);
s_video_buffer = nullptr;
s_video_buffer_write_ptr = nullptr;
s_video_buffer_pp_read_ptr = nullptr;

View File

@ -141,7 +141,7 @@ void HiresTexture::Prefetch()
Common::SetCurrentThreadName("Prefetcher");
size_t size_sum = 0;
size_t sys_mem = MemPhysical();
size_t sys_mem = Common::MemPhysical();
size_t recommended_min_mem = 2 * size_t(1024 * 1024 * 1024);
// keep 2GB memory for system stability if system RAM is 4GB+ - use half of memory in other cases
size_t max_mem =

View File

@ -63,15 +63,15 @@ void TextureCacheBase::CheckTempSize(size_t required_size)
return;
temp_size = required_size;
FreeAlignedMemory(temp);
temp = (u8*)AllocateAlignedMemory(temp_size, 16);
Common::FreeAlignedMemory(temp);
temp = static_cast<u8*>(Common::AllocateAlignedMemory(temp_size, 16));
}
TextureCacheBase::TextureCacheBase()
{
temp_size = 2048 * 2048 * 4;
if (!temp)
temp = (u8*)AllocateAlignedMemory(temp_size, 16);
temp = static_cast<u8*>(Common::AllocateAlignedMemory(temp_size, 16));
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable,
g_ActiveConfig.bTexFmtOverlayCenter);
@ -103,7 +103,7 @@ TextureCacheBase::~TextureCacheBase()
{
HiresTexture::Shutdown();
Invalidate();
FreeAlignedMemory(temp);
Common::FreeAlignedMemory(temp);
temp = nullptr;
}