Permalink
Browse files

Fix crash if D3D11 device context is used before a swapchain and ther…

…efore runtime instance was created
  • Loading branch information...
crosire committed May 7, 2018
1 parent d65ea5e commit d0c9c33e9492f4b2b06a14fbad10e9da83c5f7c7
Showing with 17 additions and 9 deletions.
  1. +17 −9 source/d3d11/d3d11_device_context.cpp
@@ -65,23 +65,31 @@ static inline com_ptr<ID3D11Texture2D> copy_texture(D3D11DeviceContext *deviceco
void D3D11DeviceContext::track_active_depthstencil(ID3D11DepthStencilView *pDepthStencilView)
{
assert(!_device->_runtimes.empty());
if (pDepthStencilView == _active_depthstencil)
{
return;
}
_active_depthstencil = pDepthStencilView;
if (pDepthStencilView != _active_depthstencil)
if (_device->_runtimes.empty())
{
_active_depthstencil = pDepthStencilView;
return;
}
const auto runtime = _device->_runtimes.front();
const auto runtime = _device->_runtimes.front();
if (pDepthStencilView != nullptr && !runtime->_depth_buffer_before_clear)
{
_draw_call_tracker.track_depthstencil(pDepthStencilView);
}
if (pDepthStencilView != nullptr && !runtime->_depth_buffer_before_clear)
{
_draw_call_tracker.track_depthstencil(pDepthStencilView);
}
}
void D3D11DeviceContext::track_cleared_depthstencil(ID3D11DepthStencilView *pDepthStencilView)
{
assert(!_device->_runtimes.empty());
if (_device->_runtimes.empty())
{
return;
}
const auto runtime = _device->_runtimes.front();

0 comments on commit d0c9c33

Please sign in to comment.