2

I have some very basic openGL shader that used to compile but are not compiling anymore after a Nvidia driver update. Every shader begins with following line: #version 150 core ....

I used to compile those shaders using QGLShaderProgram::addShaderFromSourceFile method

it is mentionned in documentation (http://doc.qt.digia.com/qt-5.1/qtgui/qopenglshaderprogram.html#writing-portable-shaders) that for reusability purpose, following preprocessor directive are added at the beginning of the shader

#define highp
#define mediump
#define lowp

However, since the driver update, I have a compilation error:

error C0204: version directive must be first statement and may not be repeated

and my shader source has become

#define highp
#define mediump
#define lowp
#version 150 core
 ....

So the issue is pretty simple to understand, however the fix is not so easy. Is it a way to prevent Qt to had the #define? What is the proper solution to deal with this issue (if possible without rewriting all my shader management code)

genpfault
  • 51,148
  • 11
  • 85
  • 139
Zed
  • 105
  • 1
  • 10
  • Can you please add the exact shader you're using, and the exact error log reported by `log()`, as well as anything printed on the console? – peppe Feb 09 '15 at 23:15
  • possible duplicate of [Serious rendering issues with OpenGL 4.1 and Qt 5](http://stackoverflow.com/questions/25858868/serious-rendering-issues-with-opengl-4-1-and-qt-5) – Reto Koradi Feb 10 '15 at 03:23
  • Thank you guys. Yes it is a duplicate of the issue you mention. – Zed Feb 10 '15 at 11:35

2 Answers2

3

I had the exact same issue after my update. Things I did were:

  • remove all comment BEFORE the version definition.
  • remove all empty lines AND space before version definition.
  • Rebuilt everything, even your resources file.

Looks like Qt made the shadder compiler way more picky!

Nox
  • 932
  • 1
  • 9
  • 27
  • It indeed seem to work if I remove the comments before the #version directive. Thank you for you help! – Zed Feb 10 '15 at 11:36
0

It's a bug of Qt 5.3.0, 5.3.1, 5.3.2, 5.4.0 5.4.1 5.4.2 for NVIDIA drivers 347+ , It will fix in Qt5.5. See the link QTBUG 44968

FeizCNU
  • 73
  • 7