mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-13 07:55:47 -04:00
GPU/HW: Don't crash when switching to incompatible renderer
This commit is contained in:
@ -20,17 +20,17 @@ GPU_HW_D3D11::~GPU_HW_D3D11()
|
||||
bool GPU_HW_D3D11::Initialize(HostDisplay* host_display, System* system, DMA* dma,
|
||||
InterruptController* interrupt_controller, Timers* timers)
|
||||
{
|
||||
SetCapabilities();
|
||||
|
||||
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
||||
return false;
|
||||
|
||||
if (host_display->GetRenderAPI() != HostDisplay::RenderAPI::D3D11)
|
||||
{
|
||||
Log_ErrorPrintf("Host render API is incompatible");
|
||||
return false;
|
||||
}
|
||||
|
||||
SetCapabilities();
|
||||
|
||||
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
||||
return false;
|
||||
|
||||
m_device = static_cast<ID3D11Device*>(host_display->GetHostRenderDevice());
|
||||
m_context = static_cast<ID3D11DeviceContext*>(host_display->GetHostRenderContext());
|
||||
if (!m_device || !m_context)
|
||||
|
@ -19,17 +19,17 @@ GPU_HW_OpenGL::~GPU_HW_OpenGL()
|
||||
bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display, System* system, DMA* dma,
|
||||
InterruptController* interrupt_controller, Timers* timers)
|
||||
{
|
||||
SetCapabilities();
|
||||
|
||||
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
||||
return false;
|
||||
|
||||
if (m_host_display->GetRenderAPI() != HostDisplay::RenderAPI::OpenGL)
|
||||
if (host_display->GetRenderAPI() != HostDisplay::RenderAPI::OpenGL)
|
||||
{
|
||||
Log_ErrorPrintf("Host render API type is incompatible");
|
||||
return false;
|
||||
}
|
||||
|
||||
SetCapabilities();
|
||||
|
||||
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
||||
return false;
|
||||
|
||||
CreateFramebuffer();
|
||||
CreateVertexBuffer();
|
||||
CreateUniformBuffer();
|
||||
|
@ -113,9 +113,11 @@ bool System::CreateGPU()
|
||||
m_gpu = GPU::CreateHardwareOpenGLRenderer();
|
||||
break;
|
||||
|
||||
#ifdef WIN32
|
||||
case Settings::GPURenderer::HardwareD3D11:
|
||||
m_gpu = GPU::CreateHardwareD3D11Renderer();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Settings::GPURenderer::Software:
|
||||
default:
|
||||
|
Reference in New Issue
Block a user