Resize renderer after [re]init

Fixes crash on Android when app is brought back to the foreground
Issue #228
This commit is contained in:
Flyinghead 2021-04-22 10:59:40 +02:00
parent 5f665fb82a
commit 805dac3039
6 changed files with 17 additions and 11 deletions

View File

@ -46,6 +46,7 @@ bool dc_is_load_done();
void dc_cancel_load();
void dc_get_load_status();
bool dc_is_running();
void dc_resize_renderer();
enum class Event {
Start,

View File

@ -735,10 +735,8 @@ void SaveSettings()
#endif
}
void dc_resume()
void dc_resize_renderer()
{
SetMemoryHandlers();
settings.aica.NoBatch = config::ForceWindowsCE || config::DSPEnabled;
int hres;
int vres = config::RenderResolution;
if (config::Widescreen && !config::Rotate90)
@ -759,6 +757,13 @@ void dc_resume()
}
if (renderer != nullptr)
renderer->Resize(hres, vres);
}
void dc_resume()
{
SetMemoryHandlers();
settings.aica.NoBatch = config::ForceWindowsCE || config::DSPEnabled;
dc_resize_renderer();
EventManager::event(Event::Resume);
if (!emu_thread.thread.joinable())

View File

@ -712,15 +712,11 @@ static bool RenderFrame(int width, int height)
//setup render target first
if (is_rtt)
{
output_fbo = BindRTT(false);
if (output_fbo == 0)
return false;
}
else
{
output_fbo = init_output_framebuffer(rendering_width, rendering_height);
}
if (output_fbo == 0)
return false;
glcache.Disable(GL_SCISSOR_TEST);

View File

@ -1099,7 +1099,8 @@ bool RenderFrame(int width, int height)
}
else
{
init_output_framebuffer(width, height);
if (init_output_framebuffer(width, height) == 0)
return false;
}
bool wide_screen_on = !is_rtt && config::Widescreen && !matrices.IsClipped() && !config::Rotate90;

View File

@ -523,7 +523,8 @@ GLuint init_output_framebuffer(int width, int height)
// Check that our FBO creation was successful
GLuint uStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
verify(uStatus == GL_FRAMEBUFFER_COMPLETE);
if (uStatus != GL_FRAMEBUFFER_COMPLETE)
return 0;
glcache.Disable(GL_SCISSOR_TEST);
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);

View File

@ -24,6 +24,7 @@
#include "oslib/oslib.h"
#include "wsi/context.h"
#include "cfg/option.h"
#include "emulator.h"
bool mainui_enabled;
u32 MainFrameCount;
@ -59,6 +60,7 @@ bool mainui_rend_frame()
void mainui_init()
{
rend_init_renderer();
dc_resize_renderer();
}
void mainui_term()