mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
GLES: Properly restore the pointer to the render manager in more places
This commit is contained in:
parent
79f8388e65
commit
1c17373039
@ -70,6 +70,10 @@ DepalShaderCacheGLES::~DepalShaderCacheGLES() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
void DepalShaderCacheGLES::DeviceRestore(Draw::DrawContext *draw) {
|
||||
render_ = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
}
|
||||
|
||||
bool DepalShaderCacheGLES::CreateVertexShader() {
|
||||
std::string src(useGL3_ ? depalVShader300 : depalVShader100);
|
||||
vertexShader_ = render_->CreateShader(GL_VERTEX_SHADER, src, "depal");
|
||||
|
@ -54,6 +54,11 @@ public:
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType type);
|
||||
std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType);
|
||||
|
||||
void DeviceLost() {
|
||||
Clear();
|
||||
}
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
|
||||
private:
|
||||
bool CreateVertexShader();
|
||||
|
||||
|
@ -35,6 +35,10 @@ FragmentTestCacheGLES::~FragmentTestCacheGLES() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
void FragmentTestCacheGLES::DeviceRestore(Draw::DrawContext *draw) {
|
||||
render_ = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
}
|
||||
|
||||
void FragmentTestCacheGLES::BindTestTexture(int slot) {
|
||||
if (!g_Config.bFragmentTestCache) {
|
||||
return;
|
||||
|
@ -67,6 +67,10 @@ public:
|
||||
|
||||
void BindTestTexture(int slot);
|
||||
|
||||
void DeviceLost() {
|
||||
Clear(false);
|
||||
}
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
void Clear(bool deleteThem = true);
|
||||
void Decimate();
|
||||
|
||||
|
@ -58,7 +58,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
|
||||
GLRenderManager *render = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
|
||||
shaderManagerGL_ = new ShaderManagerGLES(render);
|
||||
shaderManagerGL_ = new ShaderManagerGLES(draw);
|
||||
framebufferManagerGL_ = new FramebufferManagerGLES(draw, render);
|
||||
framebufferManager_ = framebufferManagerGL_;
|
||||
textureCacheGL_ = new TextureCacheGLES(draw);
|
||||
@ -331,11 +331,10 @@ void GPU_GLES::DeviceLost() {
|
||||
// Simply drop all caches and textures.
|
||||
// FBOs appear to survive? Or no?
|
||||
// TransformDraw has registered as a GfxResourceHolder.
|
||||
drawEngine_.ClearInputLayoutMap();
|
||||
shaderManagerGL_->ClearCache(false);
|
||||
shaderManagerGL_->DeviceLost();
|
||||
textureCacheGL_->DeviceLost();
|
||||
fragmentTestCache_.Clear(false);
|
||||
depalShaderCache_.Clear();
|
||||
fragmentTestCache_.DeviceLost();
|
||||
depalShaderCache_.DeviceLost();
|
||||
drawEngine_.DeviceLost();
|
||||
framebufferManagerGL_->DeviceLost();
|
||||
// Don't even try to access the lost device.
|
||||
@ -349,9 +348,12 @@ void GPU_GLES::DeviceRestore() {
|
||||
UpdateCmdInfo();
|
||||
UpdateVsyncInterval(true);
|
||||
|
||||
shaderManagerGL_->DeviceRestore(draw_);
|
||||
textureCacheGL_->DeviceRestore(draw_);
|
||||
framebufferManagerGL_->DeviceRestore(draw_);
|
||||
drawEngine_.DeviceRestore(draw_);
|
||||
fragmentTestCache_.DeviceRestore(draw_);
|
||||
depalShaderCache_.DeviceRestore(draw_);
|
||||
}
|
||||
|
||||
void GPU_GLES::Reinitialize() {
|
||||
|
@ -574,8 +574,9 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid) {
|
||||
}
|
||||
}
|
||||
|
||||
ShaderManagerGLES::ShaderManagerGLES(GLRenderManager *render)
|
||||
: render_(render), lastShader_(nullptr), shaderSwitchDirtyUniforms_(0), diskCacheDirty_(false), fsCache_(16), vsCache_(16) {
|
||||
ShaderManagerGLES::ShaderManagerGLES(Draw::DrawContext *draw)
|
||||
: lastShader_(nullptr), shaderSwitchDirtyUniforms_(0), diskCacheDirty_(false), fsCache_(16), vsCache_(16) {
|
||||
render_ = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
codeBuffer_ = new char[16384];
|
||||
lastFSID_.set_invalid();
|
||||
lastVSID_.set_invalid();
|
||||
@ -607,6 +608,14 @@ void ShaderManagerGLES::ClearCache(bool deleteThem) {
|
||||
Clear();
|
||||
}
|
||||
|
||||
void ShaderManagerGLES::DeviceLost() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
void ShaderManagerGLES::DeviceRestore(Draw::DrawContext *draw) {
|
||||
render_ = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
||||
}
|
||||
|
||||
void ShaderManagerGLES::DirtyShader() {
|
||||
// Forget the last shader ID
|
||||
lastFSID_.set_invalid();
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
|
||||
class ShaderManagerGLES : public ShaderManagerCommon {
|
||||
public:
|
||||
ShaderManagerGLES(GLRenderManager *render);
|
||||
ShaderManagerGLES(Draw::DrawContext *draw);
|
||||
~ShaderManagerGLES();
|
||||
|
||||
void ClearCache(bool deleteThem); // TODO: deleteThem currently not respected
|
||||
@ -162,6 +162,9 @@ public:
|
||||
Shader *ApplyVertexShader(int prim, u32 vertType, VShaderID *VSID);
|
||||
LinkedShader *ApplyFragmentShader(VShaderID VSID, Shader *vs, u32 vertType, int prim);
|
||||
|
||||
void DeviceLost();
|
||||
void DeviceRestore(Draw::DrawContext *draw);
|
||||
|
||||
void DirtyShader();
|
||||
void DirtyLastShader() override; // disables vertex arrays
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user