mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GLES: Free localMemory later.
It was still in use sometimes as of MapDevice(), so this is safer.
This commit is contained in:
parent
edcd2f966a
commit
7179e408da
1 changed files with 9 additions and 4 deletions
|
@ -611,6 +611,14 @@ void GLPushBuffer::NextBuffer(size_t minSize) {
|
|||
|
||||
void GLPushBuffer::Defragment() {
|
||||
if (buffers_.size() <= 1) {
|
||||
// Let's take this chance to jetison localMemory we don't need.
|
||||
for (auto &info : buffers_) {
|
||||
if (info.deviceMemory) {
|
||||
delete[] info.localMemory;
|
||||
info.localMemory = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -642,10 +650,7 @@ void GLPushBuffer::MapDevice() {
|
|||
// TODO: Can we use GL_WRITE_ONLY?
|
||||
info.deviceMemory = (uint8_t *)info.buffer->Map(GL_READ_WRITE, GL_MAP_WRITE_BIT);
|
||||
|
||||
if (info.deviceMemory) {
|
||||
delete[] info.localMemory;
|
||||
info.localMemory = nullptr;
|
||||
} else if (!info.localMemory) {
|
||||
if (!info.deviceMemory && !info.localMemory) {
|
||||
// Somehow it failed, let's dodge crashing.
|
||||
info.localMemory = new uint8_t[info.buffer->size_];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue