From 6494db75e9ace2eea576a3feeb4dc074db23ae32 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 13 Jan 2022 13:20:10 +0200 Subject: [PATCH] scenes/opengl: Port lanczos filter to ShaderManager::generateShaderFromFile() --- src/scenes/opengl/lanczosfilter.cpp | 10 ++-------- src/scenes/opengl/lanczosresources.qrc | 4 ++-- .../{1.10/lanczos-fragment.glsl => lanczos.frag} | 0 .../{1.40/lanczos-fragment.glsl => lanczos_core.frag} | 0 4 files changed, 4 insertions(+), 10 deletions(-) rename src/scenes/opengl/shaders/{1.10/lanczos-fragment.glsl => lanczos.frag} (100%) rename src/scenes/opengl/shaders/{1.40/lanczos-fragment.glsl => lanczos_core.frag} (100%) diff --git a/src/scenes/opengl/lanczosfilter.cpp b/src/scenes/opengl/lanczosfilter.cpp index 919b950a95..d275e65aaf 100644 --- a/src/scenes/opengl/lanczosfilter.cpp +++ b/src/scenes/opengl/lanczosfilter.cpp @@ -76,14 +76,8 @@ void LanczosFilter::init() return; } } - QFile ff(gl->glslVersion() >= kVersionNumber(1, 40) ? - QStringLiteral(":/scenes/opengl/shaders/1.40/lanczos-fragment.glsl") : - QStringLiteral(":/scenes/opengl/shaders/1.10/lanczos-fragment.glsl")); - if (!ff.open(QIODevice::ReadOnly)) { - qCDebug(KWIN_OPENGL) << "Failed to open lanczos shader"; - return; - } - m_shader.reset(ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, QByteArray(), ff.readAll())); + + m_shader.reset(ShaderManager::instance()->generateShaderFromFile(ShaderTrait::MapTexture, QString(), QStringLiteral(":/scenes/opengl/shaders/lanczos.frag"))); if (m_shader->isValid()) { ShaderBinder binder(m_shader.data()); m_uKernel = m_shader->uniformLocation("kernel"); diff --git a/src/scenes/opengl/lanczosresources.qrc b/src/scenes/opengl/lanczosresources.qrc index 8fbd27d16a..4f3b85e087 100644 --- a/src/scenes/opengl/lanczosresources.qrc +++ b/src/scenes/opengl/lanczosresources.qrc @@ -1,6 +1,6 @@ - shaders/1.10/lanczos-fragment.glsl - shaders/1.40/lanczos-fragment.glsl + shaders/lanczos.frag + shaders/lanczos_core.frag diff --git a/src/scenes/opengl/shaders/1.10/lanczos-fragment.glsl b/src/scenes/opengl/shaders/lanczos.frag similarity index 100% rename from src/scenes/opengl/shaders/1.10/lanczos-fragment.glsl rename to src/scenes/opengl/shaders/lanczos.frag diff --git a/src/scenes/opengl/shaders/1.40/lanczos-fragment.glsl b/src/scenes/opengl/shaders/lanczos_core.frag similarity index 100% rename from src/scenes/opengl/shaders/1.40/lanczos-fragment.glsl rename to src/scenes/opengl/shaders/lanczos_core.frag