diff --git a/src/opengl/colormanagement.glsl b/src/opengl/colormanagement.glsl index 2e3c8bcba9..27fe6c23ad 100644 --- a/src/opengl/colormanagement.glsl +++ b/src/opengl/colormanagement.glsl @@ -37,7 +37,7 @@ vec3 srgbToLinear(vec3 color) { bvec3 isLow = lessThanEqual(color, vec3(0.04045f)); vec3 loPart = color / 12.92f; vec3 hiPart = pow((color + 0.055f) / 1.055f, vec3(12.0f / 5.0f)); -#if glslVersion >= 1.30 +#if __VERSION__ >= 130 return mix(hiPart, loPart, isLow); #else return mix(hiPart, loPart, vec3(isLow.r ? 1.0 : 0.0, isLow.g ? 1.0 : 0.0, isLow.b ? 1.0 : 0.0)); @@ -48,7 +48,7 @@ vec3 linearToSrgb(vec3 color) { bvec3 isLow = lessThanEqual(color, vec3(0.0031308f)); vec3 loPart = color * 12.92f; vec3 hiPart = pow(color, vec3(5.0f / 12.0f)) * 1.055f - 0.055f; -#if glslVersion >= 1.30 +#if __VERSION__ >= 130 return mix(hiPart, loPart, isLow); #else return mix(hiPart, loPart, vec3(isLow.r ? 1.0 : 0.0, isLow.g ? 1.0 : 0.0, isLow.b ? 1.0 : 0.0)); diff --git a/src/opengl/glshadermanager.cpp b/src/opengl/glshadermanager.cpp index 09eee9ad6e..afc9b743c0 100644 --- a/src/opengl/glshadermanager.cpp +++ b/src/opengl/glshadermanager.cpp @@ -234,43 +234,6 @@ std::optional ShaderManager::preprocess(const QByteArray &src, int r return std::nullopt; } ret.append(*processed); - } else if (line.startsWith("#if glslVersion ")) { - static constexpr ssize_t ifLength = QByteArrayView("#if glslVersion ").size(); - if (line.size() < ifLength + 3) { - qCWarning(KWIN_OPENGL, "failed parsing #if condition in line %s", qPrintable(line)); - return std::nullopt; - } - const QByteArray condition = line.mid(ifLength); - const QByteArray versionString = line.mid(ifLength + 2); - if (!condition.startsWith(">=")) { - qCWarning(KWIN_OPENGL, "unsupported comparison operator in line %s", qPrintable(line)); - return std::nullopt; - } - const Version version = Version::parseString(versionString); - if (!version.isValid()) { - qCWarning(KWIN_OPENGL, "invalid version in line %s", qPrintable(line)); - return std::nullopt; - } - const bool keep = GLPlatform::instance()->glslVersion() >= version; - for (it = it + 1; it != split.end(); it++) { - if (it->startsWith("#endif")) { - break; - } else if (it->startsWith("#else")) { - it++; - for (; it != split.end(); it++) { - if (it->startsWith("#endif")) { - break; - } else if (!keep) { - ret.append(*it); - ret.append('\n'); - } - } - break; - } else if (keep) { - ret.append(*it); - ret.append('\n'); - } - } } else { ret.append(line); ret.append('\n');