Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Nov 9, 2023
1 parent 466e87f commit 67107e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/renderer_d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,17 +874,17 @@ namespace bgfx { namespace d3d11
}
#endif // USE_D3D11_DYNAMIC_LIB

m_device = (ID3D11Device*)g_platformData.context;

if (!m_dxgi.init(g_caps) )
{
goto error;
}

errorState = ErrorState::LoadedDXGI;

if (NULL != m_device)
if (NULL != g_platformData.context)
{
m_device = (ID3D11Device*)g_platformData.context;

m_device->AddRef();
m_device->GetImmediateContext(&m_deviceCtx);

Expand Down
22 changes: 13 additions & 9 deletions src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ namespace bgfx { namespace d3d12
}
#endif // USE_D3D12_DYNAMIC_LIB

m_device = (ID3D12Device*)g_platformData.context;

#if !BX_PLATFORM_LINUX
if (!m_dxgi.init(g_caps) )
{
Expand All @@ -817,7 +815,14 @@ namespace bgfx { namespace d3d12

HRESULT hr;

if (NULL == m_device)
if (NULL != g_platformData.context)
{
m_device = (ID3D12Device*)g_platformData.context;

m_device->AddRef();
hr = S_OK;
}
else
{
#if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
if (_init.debug
Expand Down Expand Up @@ -915,12 +920,11 @@ namespace bgfx { namespace d3d12
}
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT

if (FAILED(hr) )
{
BX_TRACE("Init error: Unable to create Direct3D12 device.");
goto error;
}

if (FAILED(hr) )
{
BX_TRACE("Init error: Unable to create Direct3D12 device.");
goto error;
}
}

#if !BX_PLATFORM_LINUX
Expand Down

0 comments on commit 67107e5

Please sign in to comment.