Quellcode durchsuchen

Fix DX12 backend ignoring Init::PlatformData::context (#3197)

Nacho García vor 2 Jahren
Ursprung
Commit
466e87fc0e
1 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 6 2
      src/renderer_d3d12.cpp

+ 6 - 2
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