Also copy shader info log on success.

Previously we only copied the GLSL shader compiler's info log on
failure. This hid any warnings or debug info from the application.

Bug chromium:845103

Change-Id: Ia1877a405db2017d327dfc68037596fbda1579fa
Reviewed-on: https://swiftshader-review.googlesource.com/19009
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/Diagnostics.cpp b/src/OpenGL/compiler/Diagnostics.cpp
index 490ecfe..f199f54 100644
--- a/src/OpenGL/compiler/Diagnostics.cpp
+++ b/src/OpenGL/compiler/Diagnostics.cpp
@@ -22,7 +22,8 @@
 	mShaderVersion(100),
 	mInfoSink(infoSink),
 	mNumErrors(0),
-	mNumWarnings(0)
+	mNumWarnings(0),
+	mNumInfos(0)
 {
 }
 
@@ -52,6 +53,10 @@
 		++mNumWarnings;
 		prefix = EPrefixWarning;
 		break;
+	case PP_INFO:
+		++mNumInfos;
+		prefix = EPrefixInfo;
+		break;
 	default:
 		UNREACHABLE(severity);
 		break;
diff --git a/src/OpenGL/compiler/Diagnostics.h b/src/OpenGL/compiler/Diagnostics.h
index 43ee573..258efad 100644
--- a/src/OpenGL/compiler/Diagnostics.h
+++ b/src/OpenGL/compiler/Diagnostics.h
@@ -30,6 +30,7 @@
 
 	int numErrors() const { return mNumErrors; }
 	int numWarnings() const { return mNumWarnings; }
+	int numInfos() const { return mNumInfos; }
 
 	void setShaderVersion(int version);
 
@@ -52,6 +53,7 @@
 	TInfoSink& mInfoSink;
 	int mNumErrors;
 	int mNumWarnings;
+	int mNumInfos;
 };
 
 #endif  // COMPILER_DIAGNOSTICS_H_
diff --git a/src/OpenGL/compiler/InfoSink.cpp b/src/OpenGL/compiler/InfoSink.cpp
index d059d05..84dd337 100644
--- a/src/OpenGL/compiler/InfoSink.cpp
+++ b/src/OpenGL/compiler/InfoSink.cpp
@@ -18,6 +18,9 @@
 	switch(message) {
 		case EPrefixNone:
 			break;
+		case EPrefixInfo:
+			sink.append("INFO: ");
+			break;
 		case EPrefixWarning:
 			sink.append("WARNING: ");
 			break;
diff --git a/src/OpenGL/compiler/InfoSink.h b/src/OpenGL/compiler/InfoSink.h
index 711e4e4..fa1070a 100644
--- a/src/OpenGL/compiler/InfoSink.h
+++ b/src/OpenGL/compiler/InfoSink.h
@@ -30,6 +30,7 @@
 //
 enum TPrefixType {
 	EPrefixNone,
+	EPrefixInfo,
 	EPrefixWarning,
 	EPrefixError,
 	EPrefixInternalError,
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index 6d4b149..cf6aa95 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -224,6 +224,14 @@
 						   srcLoc, reason, token, extraInfo);
 }
 
+void TParseContext::info(const TSourceLoc& loc,
+							const char* reason, const char* token,
+							const char* extraInfo) {
+	pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
+	mDiagnostics.writeInfo(pp::Diagnostics::PP_INFO,
+						   srcLoc, reason, token, extraInfo);
+}
+
 void TParseContext::trace(const char* str)
 {
 	mDiagnostics.writeDebug(str);
diff --git a/src/OpenGL/compiler/ParseHelper.h b/src/OpenGL/compiler/ParseHelper.h
index 07abf0f..10e1895 100644
--- a/src/OpenGL/compiler/ParseHelper.h
+++ b/src/OpenGL/compiler/ParseHelper.h
@@ -80,6 +80,8 @@
 	           const char* extraInfo="");
 	void warning(const TSourceLoc &loc, const char* reason, const char* token,
 	             const char* extraInfo="");
+	void info(const TSourceLoc &loc, const char* reason, const char* token,
+	          const char* extraInfo="");
 	void trace(const char* str);
 	void recover();
 	TIntermNode *getTreeRoot() const { return mTreeRoot; }
diff --git a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h b/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h
index 16e6881..d581d77 100644
--- a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h
+++ b/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h
@@ -30,6 +30,7 @@
 	// Severity is used to classify info log messages.
 	enum Severity
 	{
+		PP_INFO,
 		PP_WARNING,
 		PP_ERROR
 	};
diff --git a/src/OpenGL/libGLESv2/Shader.cpp b/src/OpenGL/libGLESv2/Shader.cpp
index 9cb6bd5..cbbb523 100644
--- a/src/OpenGL/libGLESv2/Shader.cpp
+++ b/src/OpenGL/libGLESv2/Shader.cpp
@@ -240,11 +240,12 @@
 		success = false;
 	}
 
+	infoLog += compiler->getInfoSink().info.c_str();
+
 	if(!success)
 	{
 		deleteShader();
 
-		infoLog += compiler->getInfoSink().info.c_str();
 		TRACE("\n%s", infoLog.c_str());
 	}