scenes/opengl: Port lanczos filter to ShaderManager::generateShaderFromFile()

This commit is contained in:
Vlad Zahorodnii 2022-01-13 13:20:10 +02:00
parent 35e0abb089
commit 6494db75e9
4 changed files with 4 additions and 10 deletions

View file

@ -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");

View file

@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/scenes/opengl">
<file>shaders/1.10/lanczos-fragment.glsl</file>
<file>shaders/1.40/lanczos-fragment.glsl</file>
<file>shaders/lanczos.frag</file>
<file>shaders/lanczos_core.frag</file>
</qresource>
</RCC>