Misc: Correctness fixes for OpenGL

GLES2 fallback should be functional again.
This commit is contained in:
Stenzek
2023-01-28 21:38:03 +10:00
parent a30bc94437
commit 14cf865905
18 changed files with 145 additions and 125 deletions

View File

@ -21,11 +21,8 @@ GPU_HW_D3D12::GPU_HW_D3D12() = default;
GPU_HW_D3D12::~GPU_HW_D3D12()
{
if (g_host_display)
{
g_host_display->ClearDisplayTexture();
ResetGraphicsAPIState();
}
g_host_display->ClearDisplayTexture();
GPU_HW_D3D12::ResetGraphicsAPIState();
DestroyResources();
}
@ -37,12 +34,6 @@ GPURenderer GPU_HW_D3D12::GetRendererType() const
bool GPU_HW_D3D12::Initialize()
{
if (!Host::AcquireHostDisplay(RenderAPI::D3D12))
{
Log_ErrorPrintf("Host render API is incompatible");
return false;
}
SetCapabilities();
if (!GPU_HW::Initialize())
@ -1193,5 +1184,15 @@ void GPU_HW_D3D12::ClearDepthBuffer()
std::unique_ptr<GPU> GPU::CreateHardwareD3D12Renderer()
{
return std::make_unique<GPU_HW_D3D12>();
if (!Host::AcquireHostDisplay(RenderAPI::D3D12))
{
Log_ErrorPrintf("Host render API is incompatible");
return nullptr;
}
std::unique_ptr<GPU_HW_D3D12> gpu(std::make_unique<GPU_HW_D3D12>());
if (!gpu->Initialize())
return nullptr;
return gpu;
}