Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.13.2, 5.15.1
-
None
-
GPU: Intel HD Graphics 530
Description
As this bug describes:QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always
Intel GPU on Windows with compatibility profile always needs #version on the first line. But I found that for the opengl version 3.0 and above, Intel GPU on Windows always needs to have version in the first line even for the core profile.
I found this problem when I used DropShadow in QML and set the opengl version to 3.2 by the QSurfaceFormat.
QSurfaceFormat format;
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
format.setVersion(3, 3);
format.setProfile(QSurfaceFormat::CoreProfile);
}
QQuickView view;
view.setFormat(format);
The software will prompt the following error message.
QOpenGLShader::compile(Vertex): ERROR: 0:2: '' : syntax error: #version directive must occur in a shader before anything else
ERROR: 0:2: '' : illegal order of preprocessor directives
And the effect of DropShadow is not as expected, but instead becomes a pink border.
By making the following modification for the source code of Qt, and recompiling Qt. I walked this problem around.
// qtbase\src\gui\opengl\qopenglshaderprogram.cpp // before bool QOpenGLShader::compileSourceCode(const char *source) { ... // QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) { qDebug() << "QTBUG-55733"; const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR)); if (vendor && !strcmp(vendor, "Intel")) { static const char version110[] = "#version 110\n"; sourceChunks.append(version110); sourceChunkLengths.append(GLint(sizeof(version110)) - 1); } } ... } // after, Comment out the place to judge whether it is compatibility profile, so the #version will be always added in the first line even for the core profile bool QOpenGLShader::compileSourceCode(const char *source) { ... // QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always // if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) { qDebug() << "QTBUG-55733"; const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR)); if (vendor && !strcmp(vendor, "Intel")) { static const char version110[] = "#version 110\n"; sourceChunks.append(version110); sourceChunkLengths.append(GLint(sizeof(version110)) - 1); } // } ... }
Finally I achieve the desired shadow effect.