Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: GetShaderInfoLog and __FILE__

  1. #1
    Junior Member Regular Contributor
    Join Date
    Nov 2012
    Location
    Bremen, Germany
    Posts
    167

    GetShaderInfoLog and __FILE__

    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?

  2. #2

  3. #3
    Junior Member Regular Contributor
    Join Date
    Nov 2012
    Location
    Bremen, Germany
    Posts
    167
    Windows 8 64-bit using 310.90 Nvidia Drivers.

    The following Fragment can be used to reproduce:

    Code :
    const char* sources[] = {
        "#define NOT_EMPTY\n",
     
        "#if (__FILE__ == 0 )\n"
        "#error \"File\"\n"
        "#endif\n",
     
        "void main() {}\n"
        };
     
        char logBuffer[1000];
        GLint status;
        GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
        glShaderSource(shader, 3, sources, 0);
        glCompileShader(shader);
        glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
        if(status != GL_TRUE) {
            glGetShaderInfoLog(shader, 1000, 0, logBuffer);
            printf("%s\n", logBuffer);
        }
    Last edited by hlewin; 01-27-2013 at 12:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •