CPU: Panic process on memory alloc fail

This commit is contained in:
Stenzek 2023-11-29 01:55:54 +10:00
parent 667b11121c
commit 5ff44ebcf5
No known key found for this signature in database

View file

@ -6,6 +6,7 @@
#include "cpu_core.h" #include "cpu_core.h"
#include "settings.h" #include "settings.h"
#include "common/assert.h"
#include "common/log.h" #include "common/log.h"
#include <climits> #include <climits>
@ -276,10 +277,7 @@ void PGXP::Initialize()
{ {
Mem = static_cast<PGXP_value*>(std::calloc(PGXP_MEM_SIZE, sizeof(PGXP_value))); Mem = static_cast<PGXP_value*>(std::calloc(PGXP_MEM_SIZE, sizeof(PGXP_value)));
if (!Mem) if (!Mem)
{ Panic("Failed to allocate PGXP memory");
std::fprintf(stderr, "Failed to allocate PGXP memory\n");
std::abort();
}
} }
if (g_settings.gpu_pgxp_vertex_cache && !vertexCache) if (g_settings.gpu_pgxp_vertex_cache && !vertexCache)