View Full Version : GetShaderInfoLog and __FILE__

01-25-2013, 05:27 AM
Is there any official way to get/substitute the index of the source-string that was passed to ShaderSource(...) in the log-string that gets
returned by GetShaderInfoLog? For some time I was able to rely on that Nvidia-drivers prefixed error-messages with "%SourceIndex(%LineNumber)"and ATI with "ERROR: %SourceIndex:%LineNumber". But suddenly all Errors-messages are prefixed with 0(%LineNumber) referring to some concatenated source that never was passed to gl in that way which makes finding the Point of error unnecessary difficult.
And by the way: Do other Vendor's Drivers produce similar Output?

Alfonse Reinheart
01-25-2013, 01:30 PM
All error messages on which platform?

01-27-2013, 12:23 AM
Windows 8 64-bit using 310.90 Nvidia Drivers.

The following Fragment can be used to reproduce:

const char* sources[] = {
"#define NOT_EMPTY\n",

"#if (__FILE__ == 0 )\n"
"#error \"File\"\n"

"void main() {}\n"

char logBuffer[1000];
GLint status;
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(shader, 3, sources, 0);
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if(status != GL_TRUE) {
glGetShaderInfoLog(shader, 1000, 0, logBuffer);
printf("%s\n", logBuffer);