Use AllocateMemoryPages() for the texcache buffers.

This commit is contained in:
Unknown W. Brackets 2013-04-09 01:59:47 -07:00
parent de79941ef4
commit 74dbd2b44c
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,6 @@ u32 RoundUpToPowerOf2(u32 v)
TextureCache::TextureCache() { TextureCache::TextureCache() {
lastBoundTexture = -1; lastBoundTexture = -1;
// TODO: Switch to aligned allocations for alignment. AllocateMemoryPages would do the trick.
// This is 5MB of temporary storage. Might be possible to shrink it. // This is 5MB of temporary storage. Might be possible to shrink it.
tmpTexBuf32.resize(1024 * 512); // 2MB tmpTexBuf32.resize(1024 * 512); // 2MB
tmpTexBuf16.resize(1024 * 512); // 1MB tmpTexBuf16.resize(1024 * 512); // 1MB

View File

@ -18,6 +18,7 @@
#pragma once #pragma once
#include "../Globals.h" #include "../Globals.h"
#include "Common/MemoryUtil.h"
#include "gfx_es2/fbo.h" #include "gfx_es2/fbo.h"
#include "GPU/GPUState.h" #include "GPU/GPUState.h"
@ -108,7 +109,7 @@ private:
~SimpleBuf() { ~SimpleBuf() {
if (buf_ != NULL) { if (buf_ != NULL) {
delete [] buf_; FreeMemoryPages(buf_, size_ * sizeof(T));
} }
} }
@ -120,9 +121,9 @@ private:
void resize(size_t size) { void resize(size_t size) {
if (size_ < size) { if (size_ < size) {
if (buf_ != NULL) { if (buf_ != NULL) {
delete [] buf_; FreeMemoryPages(buf_, size_ * sizeof(T));
} }
buf_ = new T[size]; buf_ = (T *)AllocateMemoryPages(size * sizeof(T));
size_ = size; size_ = size;
} }
} }