Update Program, ProgramBinary and HLSLCompiler to use Error objects.

BUG=angle:520

Change-Id: Ibbe8c95780fecfb68f4558e99e3a761107da6aee
Reviewed-on: https://chromium-review.googlesource.com/220790
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp b/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
index ec60986..26e9640 100644
--- a/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+++ b/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
@@ -82,8 +82,8 @@
     }
 }
 
-ID3DBlob *HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string &hlsl, const std::string &profile,
-                                        const std::vector<CompileConfig> &configs) const
+gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string &hlsl, const std::string &profile,
+                                        const std::vector<CompileConfig> &configs, ID3DBlob **outCompiledBlob) const
 {
     ASSERT(mD3DCompilerModule && mD3DCompileFunc);
 
@@ -115,13 +115,15 @@
 
         if (SUCCEEDED(result))
         {
-            return binary;
+            *outCompiledBlob = binary;
+            return gl::Error(GL_NO_ERROR);
         }
         else
         {
             if (result == E_OUTOFMEMORY)
             {
-                return gl::error<ID3DBlob*>(GL_OUT_OF_MEMORY, NULL);
+                *outCompiledBlob = NULL;
+                return gl::Error(GL_OUT_OF_MEMORY, "HLSL compiler had an unexpected failure, result: 0x%X.", result);
             }
 
             infoLog.append("Warning: D3D shader compilation failed with %s flags.", configs[i].name.c_str());
@@ -133,7 +135,9 @@
         }
     }
 
-    return NULL;
+    // None of the configurations succeeded in compiling this shader but the compiler is still intact
+    *outCompiledBlob = NULL;
+    return gl::Error(GL_NO_ERROR);
 }
 
 }