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 compiling error with Nvidia Geforce 1050, driver version 391.35

Shader compiling error with Nvidia Geforce 1050, driver version 391.35

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 1.1k 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

    shader works well when use Intel Graphics. I'm wondering how the Qt shader compiler add

    #define lowp
    #define mediump
    #define highp
    #line 1
    

    to my fragment shader which may cause the compiling failed.

    Vertex shader:

    #version 310 es
    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;
    }
    
    

    Fragment shader:

    #version 310 es
    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 )
            discard;
        else
        {
            lowp vec4 tex = texture(src, coord);
            outColor = tex * qt_Opacity;
        }
    }
    

    Error says:

    QOpenGLShader::compile(Fragment): 0(1) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(2) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(4) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(5) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(7) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(8) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    0(14) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)
    
    *** Problematic Fragment shader source code ***
    #version 310 es
    #define lowp
    #define mediump
    #define highp
    #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 )
            discard;
        else
        {
            lowp vec4 tex = texture(src, coord);
            outColor = tex * qt_Opacity;
        }
    }
    
    ***
    QQuickCustomMaterialShader: Shader compilation failed:
    "0(1) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(2) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(4) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(5) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(7) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(8) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n0(14) : error C7573: OpenGL/ES requires precision specifier on this float type (there is no default precision)\n"
    
    1 Reply Last reply
    0
    • tracymaT Offline
      tracymaT Offline
      tracyma
      wrote on last edited by
      #2

      set QT_OpenGL to angle and application attribute to Qt::AA_UseOpenGLES will fix this.

      1 Reply Last reply
      0

      • Login

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