Commit 937e6a5a by Nicolas Capens Committed by Nicolas Capens

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/19009Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 4b74373a
......@@ -22,7 +22,8 @@ TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
mShaderVersion(100),
mInfoSink(infoSink),
mNumErrors(0),
mNumWarnings(0)
mNumWarnings(0),
mNumInfos(0)
{
}
......@@ -52,6 +53,10 @@ void TDiagnostics::writeInfo(Severity severity,
++mNumWarnings;
prefix = EPrefixWarning;
break;
case PP_INFO:
++mNumInfos;
prefix = EPrefixInfo;
break;
default:
UNREACHABLE(severity);
break;
......
......@@ -30,6 +30,7 @@ public:
int numErrors() const { return mNumErrors; }
int numWarnings() const { return mNumWarnings; }
int numInfos() const { return mNumInfos; }
void setShaderVersion(int version);
......@@ -52,6 +53,7 @@ private:
TInfoSink& mInfoSink;
int mNumErrors;
int mNumWarnings;
int mNumInfos;
};
#endif // COMPILER_DIAGNOSTICS_H_
......@@ -18,6 +18,9 @@ void TInfoSinkBase::prefix(TPrefixType message) {
switch(message) {
case EPrefixNone:
break;
case EPrefixInfo:
sink.append("INFO: ");
break;
case EPrefixWarning:
sink.append("WARNING: ");
break;
......
......@@ -30,6 +30,7 @@ inline float fractionalPart(float f) {
//
enum TPrefixType {
EPrefixNone,
EPrefixInfo,
EPrefixWarning,
EPrefixError,
EPrefixInternalError,
......
......@@ -224,6 +224,14 @@ void TParseContext::warning(const TSourceLoc& loc,
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);
......
......@@ -80,6 +80,8 @@ public:
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; }
......
......@@ -30,6 +30,7 @@ public:
// Severity is used to classify info log messages.
enum Severity
{
PP_INFO,
PP_WARNING,
PP_ERROR
};
......
......@@ -240,11 +240,12 @@ void Shader::compile()
success = false;
}
infoLog += compiler->getInfoSink().info.c_str();
if(!success)
{
deleteShader();
infoLog += compiler->getInfoSink().info.c_str();
TRACE("\n%s", infoLog.c_str());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment