This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

offline shader compiler example?

Dear all,

I want to compare the performance of online shader compiler and offline shader compiler.

I compiled shader source with mali offline shader compiler and the output are two files named *.out.non-prerotate and *.out.prerotate.

However I have difficulties in how to use these two binary file in my opengl es program. I searched examples in mali SDK but there's no example case found.

Is there anyone who has successfully use binary shader in opengl es program? Is there any other references?

Parents
  • Hi seufanghao,

    Please have a look at the following example from Prerotate section of the Usage chapter in the  User Guide:

    vertex_shader = glCreateShader(GL_VERTEX_SHADER); 
    glShaderBinary(1, &vertex_shader, GL_MALI_SHADER_BINARY_ARM, non_prerotate_binary, length);
    error = glGetError();
    if(error == GL_INVALID_VALUE) {
         int errorlog_length;
         glGetShaderiv(vs, GL_INFO_LOG_LENGTH, &errorlog_length);
         char* errorlog = malloc(errorlog_length * sizeof(char));
         glGetShaderInfoLog(vertex_shader, errorlog_length, NULL, errorlog);
         /*
          * If the non-prerotate binary is not supported then you will see the
          * following message in the errorlog:
          * ---- "The driver is too new for the shader. Try to upgrade your
          * compiler."
          * in this case you should use the prerotate binary instead, e.g.
          * glShaderBinary(1, &vertex_shader, GL_MALI_SHADER_BINARY_ARM,
          * prerotate_binary, length);
          */
    }

    Does it answer your question?

    Jacek

Reply
  • Hi seufanghao,

    Please have a look at the following example from Prerotate section of the Usage chapter in the  User Guide:

    vertex_shader = glCreateShader(GL_VERTEX_SHADER); 
    glShaderBinary(1, &vertex_shader, GL_MALI_SHADER_BINARY_ARM, non_prerotate_binary, length);
    error = glGetError();
    if(error == GL_INVALID_VALUE) {
         int errorlog_length;
         glGetShaderiv(vs, GL_INFO_LOG_LENGTH, &errorlog_length);
         char* errorlog = malloc(errorlog_length * sizeof(char));
         glGetShaderInfoLog(vertex_shader, errorlog_length, NULL, errorlog);
         /*
          * If the non-prerotate binary is not supported then you will see the
          * following message in the errorlog:
          * ---- "The driver is too new for the shader. Try to upgrade your
          * compiler."
          * in this case you should use the prerotate binary instead, e.g.
          * glShaderBinary(1, &vertex_shader, GL_MALI_SHADER_BINARY_ARM,
          * prerotate_binary, length);
          */
    }

    Does it answer your question?

    Jacek

Children