mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 15:30:35 +00:00
More GL shutdown fixes. Partially fixes #10868
This commit is contained in:
parent
fea97f2bc8
commit
1d6263d5eb
@ -118,8 +118,10 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
|
||||
GPU_GLES::~GPU_GLES() {
|
||||
GLRenderManager *render = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
render->Wipe();
|
||||
if (draw_) {
|
||||
GLRenderManager *render = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
render->Wipe();
|
||||
}
|
||||
|
||||
// If we're here during app shutdown (exiting the Windows app in-game, for example)
|
||||
// everything should already be cleared since DeviceLost has been run.
|
||||
@ -135,9 +137,6 @@ GPU_GLES::~GPU_GLES() {
|
||||
shaderManagerGL_ = nullptr;
|
||||
delete framebufferManagerGL_;
|
||||
delete textureCacheGL_;
|
||||
#ifdef _WIN32
|
||||
gfxCtx_->SwapInterval(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static constexpr int MakeIntelSimpleVer(int v1, int v2, int v3) {
|
||||
@ -332,11 +331,13 @@ void GPU_GLES::DeviceLost() {
|
||||
// TransformDraw has registered as a GfxResourceHolder.
|
||||
drawEngine_.ClearInputLayoutMap();
|
||||
shaderManagerGL_->ClearCache(false);
|
||||
textureCacheGL_->Clear(false);
|
||||
textureCacheGL_->DeviceLost();
|
||||
fragmentTestCache_.Clear(false);
|
||||
depalShaderCache_.Clear();
|
||||
drawEngine_.DeviceLost();
|
||||
framebufferManagerGL_->DeviceLost();
|
||||
// Don't even try to access the lost device.
|
||||
draw_ = nullptr;
|
||||
}
|
||||
|
||||
void GPU_GLES::DeviceRestore() {
|
||||
|
@ -53,6 +53,7 @@ TextureCacheGLES::TextureCacheGLES(Draw::DrawContext *draw)
|
||||
SetupTextureDecoder();
|
||||
|
||||
nextTexture_ = nullptr;
|
||||
|
||||
std::vector<GLRInputLayout::Entry> entries;
|
||||
entries.push_back({ 0, 3, GL_FLOAT, GL_FALSE, 20, 0 });
|
||||
entries.push_back({ 1, 2, GL_FLOAT, GL_FALSE, 20, 12 });
|
||||
@ -60,7 +61,9 @@ TextureCacheGLES::TextureCacheGLES(Draw::DrawContext *draw)
|
||||
}
|
||||
|
||||
TextureCacheGLES::~TextureCacheGLES() {
|
||||
render_->DeleteInputLayout(shadeInputLayout_);
|
||||
if (shadeInputLayout_) {
|
||||
render_->DeleteInputLayout(shadeInputLayout_);
|
||||
}
|
||||
Clear(true);
|
||||
}
|
||||
|
||||
@ -839,6 +842,22 @@ bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level)
|
||||
#endif
|
||||
}
|
||||
|
||||
void TextureCacheGLES::DeviceLost() {
|
||||
if (shadeInputLayout_) {
|
||||
render_->DeleteInputLayout(shadeInputLayout_);
|
||||
shadeInputLayout_ = nullptr;
|
||||
}
|
||||
Clear(false);
|
||||
draw_ = nullptr;
|
||||
render_ = nullptr;
|
||||
}
|
||||
|
||||
void TextureCacheGLES::DeviceRestore(Draw::DrawContext *draw) {
|
||||
draw_ = draw;
|
||||
if (!shadeInputLayout_) {
|
||||
std::vector<GLRInputLayout::Entry> entries;
|
||||
entries.push_back({ 0, 3, GL_FLOAT, GL_FALSE, 20, 0 });
|
||||
entries.push_back({ 1, 2, GL_FLOAT, GL_FALSE, 20, 12 });
|
||||
shadeInputLayout_ = render_->CreateInputLayout(entries);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight);
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override;
|
||||
|
||||
void DeviceLost();
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
|
||||
protected:
|
||||
@ -95,7 +96,7 @@ private:
|
||||
ShaderManagerGLES *shaderManager_;
|
||||
DrawEngineGLES *drawEngine_;
|
||||
|
||||
GLRInputLayout *shadeInputLayout_;
|
||||
GLRInputLayout *shadeInputLayout_ = nullptr;
|
||||
|
||||
enum { INVALID_TEX = -1 };
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user