Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/lanczosfilter.cpp
- This file was moved from lanczosfilter.cpp.
Show All 22 Lines | |||||
23 | #include "client.h" | 23 | #include "client.h" | ||
24 | #include "deleted.h" | 24 | #include "deleted.h" | ||
25 | #include "effects.h" | 25 | #include "effects.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "unmanaged.h" | 27 | #include "unmanaged.h" | ||
28 | #include "options.h" | 28 | #include "options.h" | ||
29 | #include "workspace.h" | 29 | #include "workspace.h" | ||
30 | 30 | | |||
31 | #include <logging.h> | ||||
32 | | ||||
31 | #include <kwinglutils.h> | 33 | #include <kwinglutils.h> | ||
32 | #include <kwinglplatform.h> | 34 | #include <kwinglplatform.h> | ||
33 | 35 | | |||
34 | #include <kwineffects.h> | 36 | #include <kwineffects.h> | ||
35 | 37 | | |||
36 | #include <QFile> | 38 | #include <QFile> | ||
37 | 39 | | |||
38 | #include <qmath.h> | 40 | #include <qmath.h> | ||
Show All 21 Lines | |||||
60 | 62 | | |||
61 | void LanczosFilter::init() | 63 | void LanczosFilter::init() | ||
62 | { | 64 | { | ||
63 | if (m_inited) | 65 | if (m_inited) | ||
64 | return; | 66 | return; | ||
65 | m_inited = true; | 67 | m_inited = true; | ||
66 | const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); | 68 | const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); | ||
67 | if (force) { | 69 | if (force) { | ||
68 | qCWarning(KWIN_CORE) << "Lanczos Filter forced on by environment variable"; | 70 | qCWarning(KWIN_OPENGL) << "Lanczos Filter forced on by environment variable"; | ||
69 | } | 71 | } | ||
70 | 72 | | |||
71 | if (!force && options->glSmoothScale() != 2) | 73 | if (!force && options->glSmoothScale() != 2) | ||
72 | return; // disabled by config | 74 | return; // disabled by config | ||
73 | if (!GLRenderTarget::supported()) | 75 | if (!GLRenderTarget::supported()) | ||
74 | return; | 76 | return; | ||
75 | 77 | | |||
76 | GLPlatform *gl = GLPlatform::instance(); | 78 | GLPlatform *gl = GLPlatform::instance(); | ||
77 | if (!force) { | 79 | if (!force) { | ||
78 | // The lanczos filter is reported to be broken with the Intel driver prior SandyBridge | 80 | // The lanczos filter is reported to be broken with the Intel driver prior SandyBridge | ||
79 | if (gl->driver() == Driver_Intel && gl->chipClass() < SandyBridge) | 81 | if (gl->driver() == Driver_Intel && gl->chipClass() < SandyBridge) | ||
80 | return; | 82 | return; | ||
81 | // also radeon before R600 has trouble | 83 | // also radeon before R600 has trouble | ||
82 | if (gl->isRadeon() && gl->chipClass() < R600) | 84 | if (gl->isRadeon() && gl->chipClass() < R600) | ||
83 | return; | 85 | return; | ||
84 | // and also for software emulation (e.g. llvmpipe) | 86 | // and also for software emulation (e.g. llvmpipe) | ||
85 | if (gl->isSoftwareEmulation()) { | 87 | if (gl->isSoftwareEmulation()) { | ||
86 | return; | 88 | return; | ||
87 | } | 89 | } | ||
88 | } | 90 | } | ||
89 | QFile ff(gl->glslVersion() >= kVersionNumber(1, 40) ? | 91 | QFile ff(gl->glslVersion() >= kVersionNumber(1, 40) ? | ||
90 | QStringLiteral(":/resources/shaders/1.40/lanczos-fragment.glsl") : | 92 | QStringLiteral(":/scenes/opengl/shaders/1.40/lanczos-fragment.glsl") : | ||
91 | QStringLiteral(":/resources/shaders/1.10/lanczos-fragment.glsl")); | 93 | QStringLiteral(":/scenes/opengl/shaders/1.10/lanczos-fragment.glsl")); | ||
92 | if (!ff.open(QIODevice::ReadOnly)) { | 94 | if (!ff.open(QIODevice::ReadOnly)) { | ||
93 | qCDebug(KWIN_CORE) << "Failed to open lanczos shader"; | 95 | qCDebug(KWIN_OPENGL) << "Failed to open lanczos shader"; | ||
94 | return; | 96 | return; | ||
95 | } | 97 | } | ||
96 | m_shader.reset(ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, QByteArray(), ff.readAll())); | 98 | m_shader.reset(ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, QByteArray(), ff.readAll())); | ||
97 | if (m_shader->isValid()) { | 99 | if (m_shader->isValid()) { | ||
98 | ShaderBinder binder(m_shader.data()); | 100 | ShaderBinder binder(m_shader.data()); | ||
99 | m_uKernel = m_shader->uniformLocation("kernel"); | 101 | m_uKernel = m_shader->uniformLocation("kernel"); | ||
100 | m_uOffsets = m_shader->uniformLocation("offsets"); | 102 | m_uOffsets = m_shader->uniformLocation("offsets"); | ||
101 | } else { | 103 | } else { | ||
102 | qCDebug(KWIN_CORE) << "Shader is not valid"; | 104 | qCDebug(KWIN_OPENGL) << "Shader is not valid"; | ||
103 | m_shader.reset(); | 105 | m_shader.reset(); | ||
104 | } | 106 | } | ||
105 | } | 107 | } | ||
106 | 108 | | |||
107 | 109 | | |||
108 | void LanczosFilter::updateOffscreenSurfaces() | 110 | void LanczosFilter::updateOffscreenSurfaces() | ||
109 | { | 111 | { | ||
110 | const QSize &s = screens()->size(); | 112 | const QSize &s = screens()->size(); | ||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |