Disable two D3D11 warnings that would sometimes spam the output log for certain WebGL content.

These warnings identified when we set a render target that was bound as a shader resource, and were benign.

TRAC #22642

Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Author: Jamie Madill

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1948 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index ae63ae9..2e5821c 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -39,6 +39,12 @@
 
 #include "libEGL/Display.h"
 
+#ifdef _DEBUG
+// this flag enables suppressing some spurious warnings that pop up in certain WebGL samples
+// and conformance tests. to enable all warnings, remove this define.
+#define ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS 1
+#endif
+
 namespace rx
 {
 static const DXGI_FORMAT RenderTargetFormats[] =
@@ -203,6 +209,29 @@
         return EGL_NOT_INITIALIZED;
     }
 
+    // Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
+#if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
+    ID3D11InfoQueue *infoQueue;
+    result = mDevice->QueryInterface(__uuidof(ID3D11InfoQueue),  (void **)&infoQueue);
+
+    if (SUCCEEDED(result))
+    {
+        D3D11_MESSAGE_ID hideMessages[] =
+        {
+            D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD,
+            D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD
+        };
+
+        D3D11_INFO_QUEUE_FILTER filter = {0};
+        filter.DenyList.NumIDs = ArraySize(hideMessages);
+        filter.DenyList.pIDList = hideMessages;
+
+        infoQueue->AddStorageFilterEntries(&filter);
+
+        infoQueue->Release();
+    }
+#endif
+
     unsigned int maxSupportedSamples = 0;
     unsigned int rtFormatCount = ArraySize(RenderTargetFormats);
     unsigned int dsFormatCount = ArraySize(DepthStencilFormats);