Commit bb579f8c by Austin Kinross Committed by Geoff Lang

In WinRT, prevent too many calls to DXGIGetDebugInterface1

Change-Id: Id0ec9eb40566f7c2169b228394fb3afe9f32e6f5 Reviewed-on: https://chromium-review.googlesource.com/280551Tested-by: 's avatarAustin Kinross <aukinros@microsoft.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent e2adce1b
...@@ -59,20 +59,32 @@ void DebugAnnotator11::setMarker(const wchar_t *markerName) ...@@ -59,20 +59,32 @@ void DebugAnnotator11::setMarker(const wchar_t *markerName)
bool DebugAnnotator11::getStatus() bool DebugAnnotator11::getStatus()
{ {
// ID3DUserDefinedAnnotation::GetStatus doesn't work with the Graphics Diagnostics tools in Visual Studio 2013. // ID3DUserDefinedAnnotation::GetStatus doesn't work with the Graphics Diagnostics tools in Visual Studio 2013.
static bool underCapture = true;
#if defined(_DEBUG) && defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(_DEBUG) && defined(ANGLE_ENABLE_WINDOWS_STORE)
// In the Windows Store, we can use IDXGraphicsAnalysis. The call to GetDebugInterface1 only succeeds if the app is under capture. // In the Windows Store, we can use IDXGraphicsAnalysis. The call to GetDebugInterface1 only succeeds if the app is under capture.
// This should only be called in DEBUG mode. // This should only be called in DEBUG mode.
// If an app links against DXGIGetDebugInterface1 in release mode then it will fail Windows Store ingestion checks. // If an app links against DXGIGetDebugInterface1 in release mode then it will fail Windows Store ingestion checks.
IDXGraphicsAnalysis *graphicsAnalysis;
DXGIGetDebugInterface1(0, IID_PPV_ARGS(&graphicsAnalysis)); // Cache the result to reduce the number of calls to DXGIGetDebugInterface1
bool underCapture = (graphicsAnalysis != nullptr); static bool triedIDXGraphicsAnalysis = false;
SafeRelease(graphicsAnalysis);
return underCapture; if (!triedIDXGraphicsAnalysis)
{
IDXGraphicsAnalysis *graphicsAnalysis = nullptr;
HRESULT result = DXGIGetDebugInterface1(0, IID_PPV_ARGS(&graphicsAnalysis));
if (SUCCEEDED(result))
{
underCapture = (graphicsAnalysis != nullptr);
}
SafeRelease(graphicsAnalysis);
triedIDXGraphicsAnalysis = true;
}
#endif // _DEBUG && !ANGLE_ENABLE_WINDOWS_STORE #endif // _DEBUG && !ANGLE_ENABLE_WINDOWS_STORE
// Otherwise, we have to return true here. return underCapture;
return true;
} }
void DebugAnnotator11::initializeDevice() void DebugAnnotator11::initializeDevice()
......
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