Add error message for link failure.

Previously, if a driver failed to link a shader but didn't set the
INFO_LOG, we would emit a trailing "Errors:" at the end with no
additional information, which looks like the report was truncated early.
Now there will be generic text under Errors to make it obvious that no
errors were reported by the driver.

Change-Id: Ib3e2336ef2387d837639bc424f9949de554c8eae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458597
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-10-12 13:01:15 -04:00 committed by SkCQ
parent 64c907c052
commit 37a6ec9e3c

View File

@ -481,14 +481,16 @@ bool GrGLProgramBuilder::checkLinkStatus(GrGLuint programID,
}
GrGLint infoLen = GR_GL_INIT_ZERO;
GL_CALL(GetProgramiv(programID, GR_GL_INFO_LOG_LENGTH, &infoLen));
SkAutoMalloc log(sizeof(char)*(infoLen+1)); // outside if for debugger
SkAutoMalloc log(infoLen+1);
if (infoLen > 0) {
// retrieve length even though we don't need it to workaround
// bug in chrome cmd buffer param validation.
GrGLsizei length = GR_GL_INIT_ZERO;
GL_CALL(GetProgramInfoLog(programID, infoLen+1, &length, (char*)log.get()));
}
errorHandler->compileError(allShaders.c_str(), infoLen > 0 ? (const char*)log.get() : "");
const char* errorMsg = (infoLen > 0) ? (const char*)log.get()
: "link failed but did not provide an info log";
errorHandler->compileError(allShaders.c_str(), errorMsg);
}
return SkToBool(linked);
}