Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-63537

Some OpenGL drivers cause problems with uniform value arrays

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.9.0, 5.9.1, 5.10.0 Alpha
    • Qt3D
    • None
    • Win7-64, VS2015, Qt 5.9.1, 5.10 Alpha
    •  e3e9372a353b641580f15dbbc09a488b8cb26d64

    Description

      I found out (apitrace) that there are some OpenGL drivers in the wild which return the uniform name for an array without trailing "[0]" by the glGetActiveUniform call in the GraphicsHelperGL classes (GraphicsHelperGL_32 in my case) and the programUniformsAndLocations() method. More detailed - in my material the name "penColors" will be returned for the Q_PROPERTY(QVariantList penColors READ penColors WRITE setPenColors NOTIFY penColorsChanged); instead of "penColors[0]".

      Affected by the problem are e.g. the ATI Mobility Radeon HD 4300/4500 and the ATI Radeon HD4600 Series which use the same driver which won't be upgraded by ATI anymore (verified) and the NVIDIA GeForce GT 640M with the driver 368.22 (not verify yet).

      I was able to fix the problem as following:

      QVector<ShaderUniform> GraphicsHelperGL3_2::programUniformsAndLocations(GLuint programId)
      {
        ..
          // Size is 1 for scalar and more for struct or arrays
          // Type is the GL Type
          m_funcs->glGetActiveUniform(programId, i, sizeof(uniformName) - 1, 
             &uniformNameLength, &uniform.m_size, &uniform.m_type, uniformName);
          uniformName[sizeof(uniformName) - 1] = '\0';
          uniform.m_location = m_funcs->glGetUniformLocation(programId, uniformName);
          uniform.m_name = QString::fromUtf8(uniformName, uniformNameLength);
          //>>>
          if (uniform.m_size > 1) {
            if (!uniform.m_name.endsWith(QString::fromUtf8("[0]"))) {
              uniform.m_name.append(QString::fromUtf8("[0]"));
            }
          }
          //<<<

          
      May be this needs an additional condition to avoid new problems with structs.
      Is there a better way to fix this?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lemire_p Paul Lemire
            ibdm Donald Marotzke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes