Commit 7c253fca by Michael Yu Committed by Angle LUCI CQ

D3D11 additional context-loss logging

This makes logging more consistent when we encounter context loss. In Renderer11::testDeviceLost, note DXGI_ERROR_INVALID_CALL is a valid GetDeviceRemovedReason, but was not detected prior. SwapChain11::resize and SwapChain11::reset added more logging, likewise with Context11::handleResult. This covers everywhere d3d11::isDeviceLostError is invoked, though that might not be exhaustive of all cases we detect device loss. Bug: b/188291915 Test: Manually trigger conditions to test logging. Change-Id: Idd57363101b53bc2d3c4c306ee78a42012a1a320 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935696Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarDoug Horn <doughorn@google.com> Commit-Queue: Michael Yu <warty@google.com>
parent df977aaf
......@@ -991,15 +991,19 @@ void Context11::handleResult(HRESULT hr,
{
ASSERT(FAILED(hr));
GLenum glErrorCode = DefaultGLErrorCode(hr);
std::stringstream errorStream;
errorStream << "Internal D3D11 error: " << gl::FmtHR(hr);
if (d3d11::isDeviceLostError(hr))
{
HRESULT removalReason = mRenderer->getDevice()->GetDeviceRemovedReason();
errorStream << " (removal reason: " << gl::FmtHR(removalReason) << ")";
mRenderer->notifyDeviceLost();
}
GLenum glErrorCode = DefaultGLErrorCode(hr);
std::stringstream errorStream;
errorStream << "Internal D3D11 error: " << gl::FmtHR(hr) << ": " << message;
errorStream << ": " << message;
mErrors->handleError(glErrorCode, errorStream.str().c_str(), file, function, line);
}
......
......@@ -2127,8 +2127,6 @@ void Renderer11::releaseDeviceResources()
// set notify to true to broadcast a message to all contexts of the device loss
bool Renderer11::testDeviceLost()
{
bool isLost = false;
if (!mDevice)
{
return true;
......@@ -2136,7 +2134,7 @@ bool Renderer11::testDeviceLost()
// GetRemovedReason is used to test if the device is removed
HRESULT result = mDevice->GetDeviceRemovedReason();
isLost = d3d11::isDeviceLostError(result);
bool isLost = FAILED(result);
if (isLost)
{
......
......@@ -512,6 +512,9 @@ EGLint SwapChain11::resize(DisplayD3D *displayD3D, EGLint backbufferWidth, EGLin
if (d3d11::isDeviceLostError(hr))
{
HRESULT reason = device->GetDeviceRemovedReason();
ERR() << "Device lost in SwapChain11::resize " << gl::FmtHR(hr)
<< ", reason: " << gl::FmtHR(reason);
return EGL_CONTEXT_LOST;
}
else
......@@ -630,6 +633,9 @@ EGLint SwapChain11::reset(DisplayD3D *displayD3D,
if (d3d11::isDeviceLostError(hr))
{
HRESULT reason = device->GetDeviceRemovedReason();
ERR() << "Device lost in SwapChain11::reset " << gl::FmtHR(hr)
<< ", reason: " << gl::FmtHR(reason);
return EGL_CONTEXT_LOST;
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment