GPU: Fix crash when toggling software renderer
This commit is contained in:
parent
57595c47af
commit
5fd79254bd
|
@ -186,8 +186,8 @@ public:
|
|||
float ComputeDisplayAspectRatio() const;
|
||||
float ComputeAspectRatioCorrection() const;
|
||||
|
||||
static std::unique_ptr<GPU> CreateHardwareRenderer(Error* error);
|
||||
static std::unique_ptr<GPU> CreateSoftwareRenderer(Error* error);
|
||||
static std::unique_ptr<GPU> CreateHardwareRenderer();
|
||||
static std::unique_ptr<GPU> CreateSoftwareRenderer();
|
||||
|
||||
// Converts window coordinates into horizontal ticks and scanlines. Returns false if out of range. Used for lightguns.
|
||||
void ConvertScreenCoordinatesToDisplayCoordinates(float window_x, float window_y, float* display_x,
|
||||
|
|
|
@ -4265,11 +4265,7 @@ void GPU_HW::DrawRendererStats()
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<GPU> GPU::CreateHardwareRenderer(Error* error)
|
||||
std::unique_ptr<GPU> GPU::CreateHardwareRenderer()
|
||||
{
|
||||
std::unique_ptr<GPU_HW> gpu(std::make_unique<GPU_HW>());
|
||||
if (!gpu->Initialize(error))
|
||||
gpu.reset();
|
||||
|
||||
return gpu;
|
||||
return std::make_unique<GPU_HW>();
|
||||
}
|
||||
|
|
|
@ -824,11 +824,7 @@ void GPU_SW::UpdateCLUT(GPUTexturePaletteReg reg, bool clut_is_8bit)
|
|||
m_backend.PushCommand(cmd);
|
||||
}
|
||||
|
||||
std::unique_ptr<GPU> GPU::CreateSoftwareRenderer(Error* error)
|
||||
std::unique_ptr<GPU> GPU::CreateSoftwareRenderer()
|
||||
{
|
||||
std::unique_ptr<GPU_SW> gpu(std::make_unique<GPU_SW>());
|
||||
if (!gpu->Initialize(error))
|
||||
gpu.reset();
|
||||
|
||||
return gpu;
|
||||
return std::make_unique<GPU_SW>();
|
||||
}
|
||||
|
|
|
@ -2432,11 +2432,11 @@ bool System::CreateGPU(GPURenderer renderer, bool is_switching, bool fullscreen,
|
|||
}
|
||||
|
||||
if (renderer == GPURenderer::Software)
|
||||
g_gpu = GPU::CreateSoftwareRenderer(error);
|
||||
g_gpu = GPU::CreateSoftwareRenderer();
|
||||
else
|
||||
g_gpu = GPU::CreateHardwareRenderer(error);
|
||||
g_gpu = GPU::CreateHardwareRenderer();
|
||||
|
||||
if (!g_gpu)
|
||||
if (!g_gpu->Initialize(error))
|
||||
{
|
||||
ERROR_LOG("Failed to initialize {} renderer, falling back to software renderer",
|
||||
Settings::GetRendererName(renderer));
|
||||
|
@ -2445,8 +2445,8 @@ bool System::CreateGPU(GPURenderer renderer, bool is_switching, bool fullscreen,
|
|||
Settings::GetRendererName(renderer)),
|
||||
Host::OSD_CRITICAL_ERROR_DURATION);
|
||||
g_gpu.reset();
|
||||
g_gpu = GPU::CreateSoftwareRenderer(error);
|
||||
if (!g_gpu)
|
||||
g_gpu = GPU::CreateSoftwareRenderer();
|
||||
if (!g_gpu->Initialize(error))
|
||||
{
|
||||
ERROR_LOG("Failed to create fallback software renderer.");
|
||||
if (!s_state.keep_gpu_device_on_shutdown)
|
||||
|
|
Loading…
Reference in New Issue