mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Check for valid draw context a little earlier in boot.
This commit is contained in:
1 parent
0c70c4f9b4
commit
045368656f
1 file changed
+22
-16
+22
-16
@@ -569,18 +569,16 @@ void PSP_ForceDebugStats(bool enable) {
|
||||
_assert_(coreCollectDebugStatsCounter >= 0);
|
||||
}
|
||||
|
||||
static void InitGPU(std::string *error_string) {
|
||||
if (!gpu) { // should be!
|
||||
INFO_LOG(Log::Loader, "Starting graphics...");
|
||||
Draw::DrawContext *draw = g_CoreParameter.graphicsContext ? g_CoreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
// This set the `gpu` global.
|
||||
GPUCore gpuCore = PSP_CoreParameter().gpuCore;
|
||||
bool success = GPU_Init(gpuCore, g_CoreParameter.graphicsContext, draw);
|
||||
if (!success) {
|
||||
*error_string = "Unable to initialize rendering engine.";
|
||||
CPU_Shutdown(false);
|
||||
g_bootState = BootState::Failed;
|
||||
}
|
||||
static void InitGPU(GPUCore gpuCore, Draw::DrawContext *draw, std::string *error_string) {
|
||||
_dbg_assert_(!gpu);
|
||||
|
||||
INFO_LOG(Log::Loader, "Starting graphics...");
|
||||
// This set the `gpu` global.
|
||||
bool success = GPU_Init(gpuCore, g_CoreParameter.graphicsContext, draw);
|
||||
if (!success) {
|
||||
*error_string = "Unable to initialize rendering engine.";
|
||||
CPU_Shutdown(false);
|
||||
g_bootState = BootState::Failed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,6 +597,15 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
if (g_CoreParameter.graphicsContext == nullptr) {
|
||||
g_CoreParameter.graphicsContext = temp;
|
||||
}
|
||||
Draw::DrawContext *draw = g_CoreParameter.graphicsContext ? g_CoreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
|
||||
GPUCore gpuCore = g_CoreParameter.gpuCore;
|
||||
if (!draw && gpuCore != GPUCORE_SOFTWARE) {
|
||||
ERROR_LOG(Log::Loader, "No drawing context provided.");
|
||||
g_bootState = BootState::Failed;
|
||||
return false;
|
||||
}
|
||||
|
||||
g_CoreParameter.errorString.clear();
|
||||
|
||||
std::string *errorString = &g_CoreParameter.errorString;
|
||||
@@ -609,7 +616,7 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
|
||||
Core_NotifyLifecycle(CoreLifecycle::STARTING);
|
||||
|
||||
g_loadingThread = std::thread([errorString]() {
|
||||
g_loadingThread = std::thread([errorString, gpuCore, draw]() {
|
||||
SetCurrentThreadName("ExecLoader");
|
||||
|
||||
AndroidJNIThreadContext jniContext;
|
||||
@@ -651,9 +658,8 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
|
||||
}
|
||||
|
||||
// Initialize the GPU as far as we can here (do things like load cache files).
|
||||
_dbg_assert_(!gpu);
|
||||
#ifndef __LIBRETRO__
|
||||
InitGPU(errorString);
|
||||
InitGPU(gpuCore, draw, errorString);
|
||||
#endif
|
||||
g_bootState = BootState::Complete;
|
||||
});
|
||||
@@ -685,7 +691,7 @@ BootState PSP_InitUpdate(std::string *error_string) {
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
InitGPU(error_string);
|
||||
InitGPU(g_CoreParameter.gpuCore, g_CoreParameter.graphicsContext->GetDrawContext(), error_string);
|
||||
#endif
|
||||
|
||||
// Ok, async part of the boot completed, let's finish up things on the main thread.
|
||||
|
||||
Reference in new issue
Block a user