Add error handling to RenderTarget creation.

 * RenderTarget9/11 don't create any resources themselves anymore.
 * Pass the real internal format to RenderTarget creation so that it is
   not lost by converting to D3D formats and back.

BUG=angle:520

Change-Id: If420970d42f0bf6ce392d64f9cb7efa4df0b8f8e
Reviewed-on: https://chromium-review.googlesource.com/222838
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index d49a9a9..a585127 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -3881,7 +3881,12 @@
         }
 
         gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
-        renderbuffer->setStorage(width, height, internalformat, samples);
+        gl::Error error = renderbuffer->setStorage(width, height, internalformat, samples);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }