Make sure not to leak any enabled vertex arrays.

When returning to EmuScreen, we need to reset any enabled vertex arrays or
we could crash in EmuScreen.  Also, when starting a frame / dirting the
shader, make sure also to toggle the vertex arrays.
This commit is contained in:
Unknown W. Brackets 2014-06-22 21:42:29 -07:00
parent b8ad665b53
commit 6d104edb5d
6 changed files with 11 additions and 1 deletions

View file

@ -454,6 +454,8 @@ void PSP_RunLoopUntil(u64 globalticks) {
} else {
mipsr4k.RunLoopUntil(globalticks);
}
gpu->CleanupBeforeUI();
}
void PSP_RunLoopFor(int cycles) {

View file

@ -2104,6 +2104,11 @@ void GLES_GPU::ClearShaderCache() {
shaderManager_->ClearCache(true);
}
void GLES_GPU::CleanupBeforeUI() {
// Clear any enabled vertex arrays.
shaderManager_->DirtyLastShader();
}
std::vector<FramebufferInfo> GLES_GPU::GetFramebufferList() {
return framebufferManager_.GetFramebufferList();
}

View file

@ -59,6 +59,7 @@ public:
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
virtual void Resized();
virtual void ClearShaderCache();
virtual void CleanupBeforeUI();
virtual bool DecodeTexture(u8* dest, GPUgstate state) {
return textureCache_.DecodeTexture(dest, state);
}

View file

@ -662,7 +662,7 @@ void ShaderManager::DirtyShader() {
// Forget the last shader ID
lastFSID_.clear();
lastVSID_.clear();
lastShader_ = 0;
DirtyLastShader();
globalDirty_ = 0xFFFFFFFF;
shaderSwitchDirty_ = 0;
}

View file

@ -118,6 +118,7 @@ public:
return std::vector<FramebufferInfo>();
}
virtual void ClearShaderCache() {}
virtual void CleanupBeforeUI() {}
protected:
// To avoid virtual calls to PreExecuteOp().

View file

@ -269,6 +269,7 @@ public:
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
virtual void Resized() = 0;
virtual void ClearShaderCache() = 0;
virtual void CleanupBeforeUI() = 0;
virtual bool FramebufferDirty() = 0;
virtual bool FramebufferReallyDirty() = 0;
virtual bool BusyDrawing() = 0;