From 466e87fc0e45cd8e79721be5d5f12c886357efe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Garc=C3=ADa?= <34654218+nachogarglez@users.noreply.github.com> Date: Wed, 8 Nov 2023 22:31:34 +0100 Subject: [PATCH] Fix DX12 backend ignoring Init::PlatformData::context (#3197) --- src/renderer_d3d12.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 1e8ad9abd..d98137d9b 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -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) ) { @@ -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 @@ -911,7 +914,6 @@ namespace bgfx { namespace d3d12 m_device->SetDebugErrorFilterX(0x8EC9B15C, D3D12XBOX_DEBUG_FILTER_FLAG_DISABLE_OUTPUT); } #endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT - } if (FAILED(hr) ) { @@ -919,6 +921,8 @@ namespace bgfx { namespace d3d12 goto error; } + } + #if !BX_PLATFORM_LINUX m_dxgi.update(m_device); #endif // !BX_PLATFORM_LINUX @@ -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