GLES: Report errors for link failures.

Let's not lose reporting on this, it's often an issue...
This commit is contained in:
Unknown W. Brackets authored and Henrik Rydgård committed 2018-01-27 15:10:17 +01:00
1 parent 3380ab8705
commit e56ae322fd
2 files changed
+21 -3

No files matched your search

+20 -3
View File
@@ -101,12 +101,27 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps) {
GLint bufLength = 0;
glGetProgramiv(program->program, GL_INFO_LOG_LENGTH, &bufLength);
if (bufLength) {
char* buf = new char[bufLength];
glGetProgramInfoLog(program->program, bufLength, NULL, buf);
char *buf = new char[bufLength];
glGetProgramInfoLog(program->program, bufLength, nullptr, buf);
// TODO: Could be other than vs/fs. Also, we're assuming order here...
const char *vsDesc = step.create_program.shaders[0]->desc.c_str();
const char *fsDesc = step.create_program.num_shaders > 1 ? step.create_program.shaders[1]->desc.c_str() : nullptr;
const char *vsCode = step.create_program.shaders[0]->code.c_str();
const char *fsCode = step.create_program.num_shaders > 1 ? step.create_program.shaders[1]->code.c_str() : nullptr;
Reporting::ReportMessage("Error in shader program link: info: %s\nfs: %s\n%s\nvs: %s\n%s", buf, fsDesc, fsCode, vsDesc, vsCode);
ELOG("Could not link program:\n %s", buf);
// We've thrown out the source at this point. Might want to do something about that.
ERROR_LOG(G3D, "VS desc:\n%s", vsDesc);
ERROR_LOG(G3D, "FS desc:\n%s", fsDesc);
ERROR_LOG(G3D, "VS:\n%s\n", vsCode);
ERROR_LOG(G3D, "FS:\n%s\n", fsCode);
#ifdef _WIN32
OutputDebugStringUTF8(buf);
OutputDebugStringUTF8(vsCode);
if (fsCode)
OutputDebugStringUTF8(fsCode);
#endif
delete[] buf;
} else {
@@ -166,6 +181,8 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps) {
step.create_shader.shader->valid = false;
step.create_shader.shader->failed = true;
}
// Before we throw away the code, attach it to the shader for debugging.
step.create_shader.shader->code = code;
delete[] step.create_shader.code;
step.create_shader.shader->valid = true;
break;
+1
View File
@@ -76,6 +76,7 @@ public:
// Warning: Won't know until a future frame.
bool failed = false;
std::string desc;
std::string code;
};
class GLRProgram {