Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Shader fails to compile after upgrading to Qt Creator 4.7

Shader fails to compile after upgrading to Qt Creator 4.7

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 4.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tracymaT Offline
    tracymaT Offline
    tracyma
    wrote on last edited by tracyma
    #1

    vertex and fragment shader are used in ShaderEffect

    ShaderEffect {
        id: effect
        
        ...
        ...
    
        vertexShader: "qrc:/MainWindow/Resources/shader/" + getShaderName() + "_vs.glsl"
        fragmentShader: "qrc:/MainWindow/Resources/shader/" + getShaderName() + "_fs.glsl"
    }
    

    The error log:

    10:15:54: Starting D:\xes\futureslide\build-XESlides-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug\debug\XESlides...
    QML debugging is enabled. Only use this in a safe environment.
    QOpenGLShader::compile(Vertex): ERROR: 0:1: '
    ' : invalid version directive 
    ERROR: 0:2: 'in' : storage qualifier supported in GLSL ES 3.00 only  
    ERROR: 0:3: 'in' : storage qualifier supported in GLSL ES 3.00 only  
    ERROR: 0:4: 'out' : storage qualifier supported in GLSL ES 3.00 only  
    
    *** Problematic Vertex shader source code ***
    #version 410
    #line 1
    uniform highp mat4 qt_Matrix;
    in highp vec4 qt_Vertex;
    in highp vec2 qt_MultiTexCoord0;
    out highp vec2 coord;
    void main() {
        coord = qt_MultiTexCoord0;
        gl_Position = qt_Matrix * qt_Vertex;
    }
    
    ***
    QOpenGLShader::compile(Fragment): ERROR: 0:1: '
    ' : invalid version directive 
    ERROR: 0:1: 'in' : storage qualifier supported in GLSL ES 3.00 only  
    ERROR: 0:5: 'out' : storage qualifier supported in GLSL ES 3.00 only  
    ERROR: 0:16: 'texture' : no matching overloaded function found 
    ERROR: 0:16: '=' :  cannot convert from 'const float' to 'lowp 4-component vector of float'
    
    *** Problematic Fragment shader source code ***
    #version 410
    #line 1
    in highp vec2 coord;
    uniform highp float time;
    uniform sampler2D src;
    uniform lowp float qt_Opacity;
    out lowp vec4 outColor;
    void main() {
        lowp float modPart = mod(coord.x, 0.2);
        lowp float solidPart = time * 0.2;
    
        if ( modPart > solidPart )
        {
            outColor = vec4(1.0, 1.0, 1.0, 1.0);
        }
        else
        {
            lowp vec4 tex = texture(src, coord);
            outColor = tex * qt_Opacity;
        }
    }
    
    ***
    QQuickCustomMaterialShader: Shader compilation failed:
    "ERROR: 0:1: '\n' : invalid version directive \nERROR: 0:1: 'in' : storage qualifier supported in GLSL ES 3.00 only  \nERROR: 0:5: 'out' : storage qualifier supported in GLSL ES 3.00 only  \nERROR: 0:16: 'texture' : no matching overloaded function found \nERROR: 0:16: '=' :  cannot convert from 'const float' to 'lowp 4-component vector of float'\n"
    
    
    K 1 Reply Last reply
    0
    • tracymaT tracyma

      vertex and fragment shader are used in ShaderEffect

      ShaderEffect {
          id: effect
          
          ...
          ...
      
          vertexShader: "qrc:/MainWindow/Resources/shader/" + getShaderName() + "_vs.glsl"
          fragmentShader: "qrc:/MainWindow/Resources/shader/" + getShaderName() + "_fs.glsl"
      }
      

      The error log:

      10:15:54: Starting D:\xes\futureslide\build-XESlides-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug\debug\XESlides...
      QML debugging is enabled. Only use this in a safe environment.
      QOpenGLShader::compile(Vertex): ERROR: 0:1: '
      ' : invalid version directive 
      ERROR: 0:2: 'in' : storage qualifier supported in GLSL ES 3.00 only  
      ERROR: 0:3: 'in' : storage qualifier supported in GLSL ES 3.00 only  
      ERROR: 0:4: 'out' : storage qualifier supported in GLSL ES 3.00 only  
      
      *** Problematic Vertex shader source code ***
      #version 410
      #line 1
      uniform highp mat4 qt_Matrix;
      in highp vec4 qt_Vertex;
      in highp vec2 qt_MultiTexCoord0;
      out highp vec2 coord;
      void main() {
          coord = qt_MultiTexCoord0;
          gl_Position = qt_Matrix * qt_Vertex;
      }
      
      ***
      QOpenGLShader::compile(Fragment): ERROR: 0:1: '
      ' : invalid version directive 
      ERROR: 0:1: 'in' : storage qualifier supported in GLSL ES 3.00 only  
      ERROR: 0:5: 'out' : storage qualifier supported in GLSL ES 3.00 only  
      ERROR: 0:16: 'texture' : no matching overloaded function found 
      ERROR: 0:16: '=' :  cannot convert from 'const float' to 'lowp 4-component vector of float'
      
      *** Problematic Fragment shader source code ***
      #version 410
      #line 1
      in highp vec2 coord;
      uniform highp float time;
      uniform sampler2D src;
      uniform lowp float qt_Opacity;
      out lowp vec4 outColor;
      void main() {
          lowp float modPart = mod(coord.x, 0.2);
          lowp float solidPart = time * 0.2;
      
          if ( modPart > solidPart )
          {
              outColor = vec4(1.0, 1.0, 1.0, 1.0);
          }
          else
          {
              lowp vec4 tex = texture(src, coord);
              outColor = tex * qt_Opacity;
          }
      }
      
      ***
      QQuickCustomMaterialShader: Shader compilation failed:
      "ERROR: 0:1: '\n' : invalid version directive \nERROR: 0:1: 'in' : storage qualifier supported in GLSL ES 3.00 only  \nERROR: 0:5: 'out' : storage qualifier supported in GLSL ES 3.00 only  \nERROR: 0:16: 'texture' : no matching overloaded function found \nERROR: 0:16: '=' :  cannot convert from 'const float' to 'lowp 4-component vector of float'\n"
      
      
      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @tracyma

      Qt creator is only an IDE and supports compiling with tool chains.

      What is your compiler?
      What is the OS?
      Which version of source are you compiling?
      Fromwhere did you get this source version?

      Vote the answer(s) that helped you to solve your issue(s)

      tracymaT 1 Reply Last reply
      2
      • K koahnig

        @tracyma

        Qt creator is only an IDE and supports compiling with tool chains.

        What is your compiler?
        What is the OS?
        Which version of source are you compiling?
        Fromwhere did you get this source version?

        tracymaT Offline
        tracymaT Offline
        tracyma
        wrote on last edited by
        #3

        @koahnig

        OS: Window 10 pro Build 1803
        Compiler: vs2017
        Qt Creator was Upgraded to 4.7 with online installer

        K 1 Reply Last reply
        0
        • tracymaT tracyma

          @koahnig

          OS: Window 10 pro Build 1803
          Compiler: vs2017
          Qt Creator was Upgraded to 4.7 with online installer

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @tracyma

          As noted above, Qt creator is only an IDE supporting you in using tool chains. There is no obvious reason that your program does not compile anymore. You need to check if the update has messed up your tool chain setup.

          Go to "Tools"->"Options"->"Build&Run" and check the different tabs special warning signs.

          Also you shoulkd do a rerun qmake and a rebuild. For whatever reason,which has nothing to do with the update, your project might be mis-aligned. A complete rebuild after rerun qmake will cure.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anon723
            wrote on last edited by Anon723
            #5

            https://bugreports.qt.io/browse/QTCREATORBUG-20808
            Add "QT_OPENGL=desktop" to your global or kit environment variables as a workaround. Apparently the default value was changed to "angle" with the update, which does not support higher opengl versions.

            mrjjM 1 Reply Last reply
            3
            • A Anon723

              https://bugreports.qt.io/browse/QTCREATORBUG-20808
              Add "QT_OPENGL=desktop" to your global or kit environment variables as a workaround. Apparently the default value was changed to "angle" with the update, which does not support higher opengl versions.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Anon723
              good found !

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Galaxy88
                wrote on last edited by
                #7

                @Anon723 thank you! Also found my OpenGL wasn't working after update. Alternatively, you can also add the following:

                QApplication a(argc, argv);
                a.setAttribute(Qt::AA_UseDesktopOpenGL);
                

                to make it work again.

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved