Shader compiling error with Nvidia Geforce 1050, driver version 391.35



  • 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"
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.