GPU: Move graphics API reset state to System

Stops us trying to reset state on objects which don't exist if
initialization failed (apparently some Android devices.. of course).
This commit is contained in:
Stenzek 2023-01-30 22:58:21 +10:00
parent c8e7922c1a
commit 178a659a98
5 changed files with 2 additions and 4 deletions

View File

@ -19,7 +19,6 @@ GPU_HW_D3D11::GPU_HW_D3D11(ID3D11Device* device, ID3D11DeviceContext* context) :
GPU_HW_D3D11::~GPU_HW_D3D11()
{
g_host_display->ClearDisplayTexture();
GPU_HW_D3D11::ResetGraphicsAPIState();
DestroyShaders();
DestroyStateObjects();

View File

@ -22,7 +22,6 @@ GPU_HW_D3D12::GPU_HW_D3D12() = default;
GPU_HW_D3D12::~GPU_HW_D3D12()
{
g_host_display->ClearDisplayTexture();
GPU_HW_D3D12::ResetGraphicsAPIState();
DestroyResources();
}

View File

@ -29,7 +29,6 @@ GPU_HW_OpenGL::~GPU_HW_OpenGL()
glDeleteTextures(1, &m_texture_buffer_r16ui_texture);
g_host_display->ClearDisplayTexture();
GPU_HW_OpenGL::ResetGraphicsAPIState();
// One of our programs might've been bound.
GL::Program::ResetLastProgram();

View File

@ -21,7 +21,6 @@ GPU_HW_Vulkan::GPU_HW_Vulkan() = default;
GPU_HW_Vulkan::~GPU_HW_Vulkan()
{
g_host_display->ClearDisplayTexture();
GPU_HW_Vulkan::ResetGraphicsAPIState();
DestroyResources();
}

View File

@ -1477,6 +1477,8 @@ void System::DestroySystem()
Timers::Shutdown();
Pad::Shutdown();
CDROM::Shutdown();
if (g_gpu)
g_gpu->ResetGraphicsAPIState();
g_gpu.reset();
InterruptController::Shutdown();
DMA::Shutdown();