Re-enable hazard warnings for setting render targets that are currently bound as SRVs.

We can manually unset applied textures in SetRenderTargets. This should fix the spurious warnings
while still showing a warning on error cases.

TRAC #24039

Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
diff --git a/src/libGLESv2/renderer/d3d11/Renderer11.cpp b/src/libGLESv2/renderer/d3d11/Renderer11.cpp
index 938e4b4..961955b 100644
--- a/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+++ b/src/libGLESv2/renderer/d3d11/Renderer11.cpp
@@ -222,8 +222,6 @@
     {
         D3D11_MESSAGE_ID hideMessages[] =
         {
-            D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD,
-            D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD,
             D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET
         };
 
@@ -943,6 +941,25 @@
                 renderTargetFormat = colorbuffer->getActualFormat();
                 missingColorRenderTarget = false;
             }
+
+#ifdef _DEBUG
+            // Workaround for Debug SETSHADERRESOURCES_HAZARD D3D11 warnings
+            for (unsigned int vertexSerialIndex = 0; vertexSerialIndex < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; vertexSerialIndex++)
+            {
+                if (colorbuffer->getTextureSerial() != 0 && mCurVertexTextureSerials[vertexSerialIndex] == colorbuffer->getTextureSerial())
+                {
+                    setTexture(gl::SAMPLER_VERTEX, vertexSerialIndex, NULL);
+                }
+            }
+
+            for (unsigned int pixelSerialIndex = 0; pixelSerialIndex < gl::MAX_TEXTURE_IMAGE_UNITS; pixelSerialIndex++)
+            {
+                if (colorbuffer->getTextureSerial() != 0 && mCurPixelTextureSerials[pixelSerialIndex] == colorbuffer->getTextureSerial())
+                {
+                    setTexture(gl::SAMPLER_PIXEL, pixelSerialIndex, NULL);
+                }
+            }
+#endif
         }
     }