Changeset 799 for trunk/src/shader


Ignore:
Timestamp:
Aug 2, 2011, 6:09:08 PM (9 years ago)
Author:
sam
Message:

shader: check that the shader really failed to compile before outputting
the compilation log as an error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shader/shader.cpp

    r783 r799  
    8585    char buf[4096], errbuf[4096];
    8686    char const *shader = buf;
     87    GLint status;
    8788    GLsizei len;
    8889
     
    9596    glCompileShader(data->vert_id);
    9697
    97     glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf);
    98     if (len > 0)
    99     {
     98    glGetShaderiv(data->vert_id, GL_COMPILE_STATUS, &status);
     99    if (status != GL_TRUE)
     100    {
     101        glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf);
    100102        Log::Error("failed to compile vertex shader: %s", errbuf);
    101103        Log::Error("shader source:\n%s\n", buf);
     
    109111    glCompileShader(data->frag_id);
    110112
    111     glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf);
    112     if (len > 0)
    113     {
     113    glGetShaderiv(data->frag_id, GL_COMPILE_STATUS, &status);
     114    if (status != GL_TRUE)
     115    {
     116        glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf);
    114117        Log::Error("failed to compile fragment shader: %s", errbuf);
    115118        Log::Error("shader source:\n%s\n", buf);
Note: See TracChangeset for help on using the changeset viewer.