Skip to content

Commit

Permalink
Fix DX12 backend ignoring Init::PlatformData::context (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachogarglez authored Nov 8, 2023
1 parent c54063b commit 466e87f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,8 @@ 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 @@ -815,6 +817,7 @@ namespace bgfx { namespace d3d12

HRESULT hr;

if (NULL == m_device)
{
#if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
if (_init.debug
Expand Down Expand Up @@ -911,14 +914,15 @@ namespace bgfx { namespace d3d12
m_device->SetDebugErrorFilterX(0x8EC9B15C, D3D12XBOX_DEBUG_FILTER_FLAG_DISABLE_OUTPUT);
}
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
}

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

}

#if !BX_PLATFORM_LINUX
m_dxgi.update(m_device);
#endif // !BX_PLATFORM_LINUX
Expand Down Expand Up @@ -4241,7 +4245,7 @@ namespace bgfx { namespace d3d12
const uint16_t layoutIdx = !isValid(vb.m_layoutHandle) ? stream.m_layoutHandle.idx : vb.m_layoutHandle.idx;
const VertexLayout& layout = s_renderD3D12->m_vertexLayouts[layoutIdx];
const uint32_t stride = layout.m_stride;

_outNumVertices = bx::uint32_min(UINT32_MAX == _draw.m_numVertices
? vb.m_size/stride
: _draw.m_numVertices
Expand Down

0 comments on commit 466e87f

Please sign in to comment.