Clear must ignore buffers that are not present.

TRAC #12643

IDirect3DDevice9::Clear will fail if asked to clear a buffer that is not present, so we have to be careful what we pass to it.

Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch

Author:    Andrew Lewycky

git-svn-id: https://angleproject.googlecode.com/svn/trunk@341 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index fb6a69e..ca8cfae 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2283,13 +2283,17 @@
     if (mask & GL_COLOR_BUFFER_BIT)
     {
         mask &= ~GL_COLOR_BUFFER_BIT;
-        flags |= D3DCLEAR_TARGET;
+
+        if (framebufferObject->getColorbufferType() != GL_NONE)
+        {
+            flags |= D3DCLEAR_TARGET;
+        }
     }
 
     if (mask & GL_DEPTH_BUFFER_BIT)
     {
         mask &= ~GL_DEPTH_BUFFER_BIT;
-        if (mState.depthMask)
+        if (mState.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
         {
             flags |= D3DCLEAR_ZBUFFER;
         }