diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index e36a8c4109..8b63cfc401 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -635,7 +635,7 @@ size_t hleFormatLogArgs(char *message, size_t sz, const char *argmask) { // TODO: Double? Does it ever happen? default: - _assert_msg_(HLE, false, "Invalid argmask character: %c", argmask[i]); + _dbg_assert_msg_(HLE, false, "Invalid argmask character: %c", argmask[i]); APPEND_FMT(" -- invalid arg format: %c -- %08x", argmask[i], regval); break; } @@ -673,7 +673,7 @@ void hleDoLogInternal(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u64 res, // TODO: For now, floats are just shown as bits. fmt = "%s%08x=%s(%s)%s"; } else { - _assert_msg_(HLE, false, "Invalid return format: %c", retmask); + _dbg_assert_msg_(HLE, false, "Invalid return format: %c", retmask); fmt = "%s%08llx=%s(%s)%s"; } diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 66d01f0e84..b0b2ac7eea 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -136,6 +136,8 @@ FramebufferManagerCommon::~FramebufferManagerCommon() { DestroyFramebuf(vfb); } bvfbs_.clear(); + + SetNumExtraFBOs(0); } void FramebufferManagerCommon::Init() { @@ -207,7 +209,8 @@ void FramebufferManagerCommon::SetNumExtraFBOs(int num) { extraFBOs_.push_back(fbo); } currentRenderVfb_ = 0; - draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP }); + if (num != 0) + draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP }); } // Heuristics to figure out the size of FBO to create. diff --git a/GPU/GLES/FramebufferManagerGLES.cpp b/GPU/GLES/FramebufferManagerGLES.cpp index e62cc79463..9faa2a7622 100644 --- a/GPU/GLES/FramebufferManagerGLES.cpp +++ b/GPU/GLES/FramebufferManagerGLES.cpp @@ -250,7 +250,6 @@ FramebufferManagerGLES::~FramebufferManagerGLES() { if (stencilUploadProgram_) { glsl_destroy(stencilUploadProgram_); } - SetNumExtraFBOs(0); for (auto it = tempFBOs_.begin(), end = tempFBOs_.end(); it != end; ++it) { it->second.fbo->Release(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 7667bcab39..a14699de59 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -613,12 +613,14 @@ static void UIThemeInit() { void RenderOverlays(UIContext *dc, void *userdata); -void NativeInitGraphics(GraphicsContext *graphicsContext) { +bool NativeInitGraphics(GraphicsContext *graphicsContext) { ILOG("NativeInitGraphics"); + _assert_msg_(G3D, graphicsContext, "No graphics context!"); using namespace Draw; Core_SetGraphicsContext(graphicsContext); g_draw = graphicsContext->GetDrawContext(); + _assert_msg_(G3D, g_draw, "No draw context available!"); ui_draw2d.SetAtlas(&ui_atlas); ui_draw2d_front.SetAtlas(&ui_atlas); @@ -694,6 +696,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) { g_graphicsInited = true; ILOG("NativeInitGraphics completed"); + return true; } void NativeShutdownGraphics() { diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 44c4e7cef7..22b086cc0d 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -1139,6 +1139,7 @@ retry: } delete graphicsContext; + graphicsContext = nullptr; return false; } diff --git a/ext/native/base/NativeApp.h b/ext/native/base/NativeApp.h index 0db94e68d2..a4540dd869 100644 --- a/ext/native/base/NativeApp.h +++ b/ext/native/base/NativeApp.h @@ -49,7 +49,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // Runs after NativeInit() at some point. May (and probably should) call OpenGL. // Should not initialize anything screen-size-dependent - do that in NativeResized. -void NativeInitGraphics(GraphicsContext *graphicsContext); +bool NativeInitGraphics(GraphicsContext *graphicsContext); // Signals that you need to forget all buffered OpenGL resources, // like textures, vbo etc.