Nvidia驱动程序更新后无法在Qt 5.3上编译GLSL着色器 [英] unable to compile GLSL shaders on Qt 5.3 after Nvidia driver update

查看:122
本文介绍了Nvidia驱动程序更新后无法在Qt 5.3上编译GLSL着色器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些非常基本的openGL着色器,曾经用于编译,但在Nvidia驱动程序更新后不再编译. 每个着色器均以以下行开头: #version 150核心 ....

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 ....

我曾经使用QGLShaderProgram :: addShaderFromSourceFile方法编译那些着色器

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

它在文档中有所提及( http: //doc.qt.digia.com/qt-5.1/qtgui/qopenglshaderprogram.html#writing-portable-shaders ),为了可重用,在着色器的开头添加了以下预处理器指令

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
 ....

因此,这个问题很容易理解,但是修复并不那么容易. 这是防止Qt使用#define的方法吗? 解决此问题的正确解决方案是什么(如果可能的话,无需重写我的所有着色器管理代码)

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)

推荐答案

更新后,我遇到了完全相同的问题. 我所做的是:

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

  • 在版本定义之前删除所有注释.
  • 在版本定义之前删除所有空行和空格.
  • 重建所有内容,甚至重建您的资源文件.

看起来像Qt的着色器编译器变得更加挑剔!

Looks like Qt made the shadder compiler way more picky!

这篇关于Nvidia驱动程序更新后无法在Qt 5.3上编译GLSL着色器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆