This commit is contained in:
Бранимир Караџић 2023-11-09 07:26:23 -08:00
parent 466e87fc0e
commit 67107e5511
2 changed files with 16 additions and 12 deletions

View File

@ -874,8 +874,6 @@ namespace bgfx { namespace d3d11
} }
#endif // USE_D3D11_DYNAMIC_LIB #endif // USE_D3D11_DYNAMIC_LIB
m_device = (ID3D11Device*)g_platformData.context;
if (!m_dxgi.init(g_caps) ) if (!m_dxgi.init(g_caps) )
{ {
goto error; goto error;
@ -883,8 +881,10 @@ namespace bgfx { namespace d3d11
errorState = ErrorState::LoadedDXGI; errorState = ErrorState::LoadedDXGI;
if (NULL != m_device) if (NULL != g_platformData.context)
{ {
m_device = (ID3D11Device*)g_platformData.context;
m_device->AddRef(); m_device->AddRef();
m_device->GetImmediateContext(&m_deviceCtx); m_device->GetImmediateContext(&m_deviceCtx);

View File

@ -804,8 +804,6 @@ namespace bgfx { namespace d3d12
} }
#endif // USE_D3D12_DYNAMIC_LIB #endif // USE_D3D12_DYNAMIC_LIB
m_device = (ID3D12Device*)g_platformData.context;
#if !BX_PLATFORM_LINUX #if !BX_PLATFORM_LINUX
if (!m_dxgi.init(g_caps) ) if (!m_dxgi.init(g_caps) )
{ {
@ -817,7 +815,14 @@ namespace bgfx { namespace d3d12
HRESULT hr; 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 BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
if (_init.debug if (_init.debug
@ -915,12 +920,11 @@ namespace bgfx { namespace d3d12
} }
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT #endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
if (FAILED(hr) ) if (FAILED(hr) )
{ {
BX_TRACE("Init error: Unable to create Direct3D12 device."); BX_TRACE("Init error: Unable to create Direct3D12 device.");
goto error; goto error;
} }
} }
#if !BX_PLATFORM_LINUX #if !BX_PLATFORM_LINUX