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. QOpenGLShader compile error on Haswell
Forum Updated to NodeBB v4.3 + New Features

QOpenGLShader compile error on Haswell

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.6k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    Esperantisto
    wrote on last edited by
    #1

    I get the following error when I run my app on a PC running Ubuntu 14.10 with a Haswell GPU (Intel HD 4600):

    @QOpenGLShader::compile(Vertex): 0:4(1): error: syntax error, unexpected NEW_IDENTIFIER

    *** Problematic Vertex shader source code ***
    #define lowp
    #define mediump
    #define highp
    precision highp float;

    uniform mat4 u_Matrix;

    attribute vec4 a_Vertex;
    attribute vec2 a_TexCoord;

    varying mediump vec2 v_TexCoord;

    void main(void)
    {
    gl_Position = u_Matrix * a_Vertex;
    v_TexCoord = a_TexCoord;
    }@

    Does anyone know what the problem might be ("unexpected NEW_IDENTIFIER" is not very helpful)? This code works fine on every other GPU I've tried (including phones).

    Thanks for any help.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Esperantisto
      wrote on last edited by
      #2

      It turns out that the offending line is "precision highp float;".

      1 Reply Last reply
      0
      • A Offline
        A Offline
        agocs
        wrote on last edited by
        #3

        Because it's not valid GLSL. Do not confuse with GLSL ES where it is valid. And anyway, even with ES it is not necessary to declare the float precision in vertex shaders like that because it defaults to high (unlike in fragment shaders).

        If you are only targetting desktop OpenGL, then just forget about that line. If you are targetting both OpenGL and OpenGL ES, then the portable way is to include the precision qualifiers in the source, instead of relying on the precision keyword.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Esperantisto
          wrote on last edited by
          #4

          Thanks for the reply. Once I discovered that the culprit is the "precision" keyword then I removed it and added the qualifiers in the body of the source. This is a project that is targeting mobile devices but I do most of the testing on desktop.

          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