HLSL: Change the final syntax-error printf to go to the infoLog.

Fixes issue #510.
This commit is contained in:
John Kessenich 2016-09-19 14:56:55 -06:00
parent 28b28140bb
commit 142785f324
3 changed files with 15 additions and 11 deletions

View file

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1494" #define GLSLANG_REVISION "Overload400-PrecQual.1495"
#define GLSLANG_DATE "19-Sep-2016" #define GLSLANG_DATE "19-Sep-2016"

View file

@ -38,11 +38,15 @@
namespace glslang { namespace glslang {
void TInfoSinkBase::append(const char* s) void TInfoSinkBase::append(const char* s)
{ {
if (outputStream & EString) { if (outputStream & EString) {
checkMem(strlen(s)); if (s == nullptr)
sink.append(s); sink.append("(null)");
else {
checkMem(strlen(s));
sink.append(s);
}
} }
//#ifdef _WIN32 //#ifdef _WIN32
@ -54,10 +58,10 @@ void TInfoSinkBase::append(const char* s)
fprintf(stdout, "%s", s); fprintf(stdout, "%s", s);
} }
void TInfoSinkBase::append(int count, char c) void TInfoSinkBase::append(int count, char c)
{ {
if (outputStream & EString) { if (outputStream & EString) {
checkMem(count); checkMem(count);
sink.append(count, c); sink.append(count, c);
} }
@ -74,10 +78,10 @@ void TInfoSinkBase::append(int count, char c)
fprintf(stdout, "%c", c); fprintf(stdout, "%c", c);
} }
void TInfoSinkBase::append(const TPersistString& t) void TInfoSinkBase::append(const TPersistString& t)
{ {
if (outputStream & EString) { if (outputStream & EString) {
checkMem(t.size()); checkMem(t.size());
sink.append(t); sink.append(t);
} }
@ -93,7 +97,7 @@ void TInfoSinkBase::append(const TPersistString& t)
void TInfoSinkBase::append(const TString& t) void TInfoSinkBase::append(const TString& t)
{ {
if (outputStream & EString) { if (outputStream & EString) {
checkMem(t.size()); checkMem(t.size());
sink.append(t.c_str()); sink.append(t.c_str());
} }

View file

@ -124,8 +124,8 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner&
// Print a message formated such that if you click on the message it will take you right to // Print a message formated such that if you click on the message it will take you right to
// the line through most UIs. // the line through most UIs.
const glslang::TSourceLoc& sourceLoc = input.getSourceLoc(); const glslang::TSourceLoc& sourceLoc = input.getSourceLoc();
printf("\n%s(%i): error at column %i, HLSL translation failed.\n", sourceLoc.name, sourceLoc.line, infoSink.info << sourceLoc.name << "(" << sourceLoc.line << "): error at column " << sourceLoc.column << ", HLSL parsing failed.\n";
sourceLoc.column); ++numErrors;
return false; return false;
} }