opengl/glshadermanager: fix version check for desktop gl

Apparently mix with bvec is only supported with glsl 1.30 on desktop gl
too
This commit is contained in:
Xaver Hugl 2023-12-10 04:29:51 +01:00
parent 4decd392af
commit 19672bc82f

View file

@ -130,13 +130,13 @@ QByteArray ShaderManager::generateFragmentSource(ShaderTraits traits) const
textureLookup = glsl_es_300 ? QByteArrayLiteral("texture") : QByteArrayLiteral("texture2D");
output = glsl_es_300 ? QByteArrayLiteral("fragColor") : QByteArrayLiteral("gl_FragColor");
}
if (!gl->isGLES() || gl->glVersion() >= Version(3, 0)) {
if (gl->glslVersion() >= Version(1, 30)) {
// mix with bvec3 is only supported with glsl 1.30 and greater
stream << "\n";
stream << "vec3 doMix(vec3 left, vec3 right, bvec3 rightFactor) {\n";
stream << " return mix(left, right, rightFactor);\n";
stream << "}\n";
} else {
// GLES 2 doesn't natively support mix with bvec3
stream << "\n";
stream << "vec3 doMix(vec3 left, vec3 right, bvec3 rightFactor) {\n";
stream << " return mix(left, right, vec3(rightFactor.r ? 1.0 : 0.0, rightFactor.g ? 1.0 : 0.0, rightFactor.b ? 1.0 : 0.0));\n";