Avoid double-initializing the Vulkan backbuffer on startup.

This commit is contained in:
Henrik Rydgård 2017-11-10 13:13:56 +01:00
parent ee768ca949
commit 1c76d28843
3 changed files with 14 additions and 2 deletions

View File

@ -172,7 +172,7 @@ bool UpdateScreenScale(int width, int height) {
dp_yres = new_dp_yres;
pixel_xres = width;
pixel_yres = height;
INFO_LOG(SYSTEM, "pixel_res: %dx%d", pixel_xres, pixel_yres);
INFO_LOG(SYSTEM, "pixel_res: %dx%d. Calling NativeResized()", pixel_xres, pixel_yres);
NativeResized();
return true;
}

View File

@ -127,6 +127,8 @@ std::unique_ptr<ManagedTexture> uiTexture;
ScreenManager *screenManager;
std::string config_filename;
bool g_graphicsInited;
#ifdef IOS
bool iosCanUseJit;
bool targetIsJailbroken;
@ -675,10 +677,13 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
#endif
g_gameInfoCache = new GameInfoCache();
g_graphicsInited = true;
ILOG("NativeInitGraphics completed");
}
void NativeShutdownGraphics() {
g_graphicsInited = false;
ILOG("NativeShutdownGraphics");
#ifdef _WIN32
@ -817,6 +822,7 @@ void NativeRender(GraphicsContext *graphicsContext) {
}
if (resized) {
ILOG("resized was set to true - resizing");
resized = false;
if (uiContext) {
@ -1072,7 +1078,11 @@ void NativeMessageReceived(const char *message, const char *value) {
void NativeResized() {
// NativeResized can come from any thread so we just set a flag, then process it later.
resized = true;
if (g_graphicsInited) {
resized = true;
} else {
ILOG("NativeResized ignored, not initialized");
}
}
void NativeSetRestarting() {

View File

@ -773,6 +773,8 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv
if (new_size) {
ILOG("Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h);
NativeResized();
} else {
ILOG("Size didn't change.");
}
}