kevinlekiller / kwin-effect-shaders Goto Github PK
View Code? Open in Web Editor NEWDesktop effect for KDE Plasma to apply GLSL shaders. Alternative to vkBasalt or ReShade when they are unsupported.
License: GNU General Public License v2.0
Desktop effect for KDE Plasma to apply GLSL shaders. Alternative to vkBasalt or ReShade when they are unsupported.
License: GNU General Public License v2.0
Kubuntu 22.10
Followed dependency installation correctly. Unsure of what's wrong.
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following REQUIRED packages have been found:
* ECM
-- Installing in the same prefix as Qt, adopting their path scheme.
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.98.0")
-- Found KF5GlobalAccel: /usr/lib/x86_64-linux-gnu/cmake/KF5GlobalAccel/KF5GlobalAccelConfig.cmake (found version "5.98.0")
-- Found Gettext: /usr/bin/msgmerge (found version "0.21")
-- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.98.0")
-- Found KF5: success (found suitable version "5.98.0", minimum required is "5.9.0") found components: KIO GlobalAccel I18n
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yup/Documents/kwin-effect-shaders/build
[ 20%] Automatic MOC for target kwin_effect_shaders
AutoMoc warning
---------------
"SRC:/src/plugin.cc"
includes the moc file "plugin.moc", but does not contain a Q_OBJECT, Q_GADGET, Q_NAMESPACE, Q_NAMESPACE_EXPORT, K_PLUGIN_FACTORY, K_PLUGIN_CLASS, K_PLUGIN_FACTORY_WITH_JSON or K_PLUGIN_CLASS_WITH_JSON macro.
[ 20%] Built target kwin_effect_shaders_autogen
[ 60%] Building CXX object src/CMakeFiles/kwin_effect_shaders.dir/kwin_effect_shaders_autogen/mocs_compilation.cpp.o
[ 60%] Building CXX object src/CMakeFiles/kwin_effect_shaders.dir/Shaders.cpp.o
[ 80%] Building CXX object src/CMakeFiles/kwin_effect_shaders.dir/plugin.cc.o
/home/yup/Documents/kwin-effect-shaders/src/Shaders.cpp: In member function ‘void KWin::ShadersEffect::slotGenerateShaderFromBuffers()’:
/home/yup/Documents/kwin-effect-shaders/src/Shaders.cpp:246:111: error: no match for ‘operator=’ (operand types are ‘std::unique_ptr<KWin::GLShader>’ and ‘KWin::GLShader*’)
246 | m_shader = ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, vertexBuf, fragmentBuf);
| ^
In file included from /usr/include/c++/12/memory:76,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer_impl.h:71,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer.h:48,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/qpixmap.h:48,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/qicon.h:46,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/QIcon:1,
from /usr/include/kwineffects.h:21,
from /home/yup/Documents/kwin-effect-shaders/src/Shaders.h:21,
from /home/yup/Documents/kwin-effect-shaders/src/Shaders.cpp:18:
/usr/include/c++/12/bits/unique_ptr.h:422:9: note: candidate: ‘template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = KWin::GLShader; _Dp = std::default_delete<KWin::GLShader>]’
422 | operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
| ^~~~~~~~
/usr/include/c++/12/bits/unique_ptr.h:422:9: note: template argument deduction/substitution failed:
/home/yup/Documents/kwin-effect-shaders/src/Shaders.cpp:246:111: note: mismatched types ‘std::unique_ptr<_Tp, _Dp>’ and ‘KWin::GLShader*’
246 | m_shader = ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, vertexBuf, fragmentBuf);
| ^
/usr/include/c++/12/bits/unique_ptr.h:406:19: note: candidate: ‘std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = KWin::GLShader; _Dp = std::default_delete<KWin::GLShader>]’
406 | unique_ptr& operator=(unique_ptr&&) = default;
| ^~~~~~~~
/usr/include/c++/12/bits/unique_ptr.h:406:29: note: no known conversion for argument 1 from ‘KWin::GLShader*’ to ‘std::unique_ptr<KWin::GLShader>&&’
406 | unique_ptr& operator=(unique_ptr&&) = default;
| ^~~~~~~~~~~~
/usr/include/c++/12/bits/unique_ptr.h:432:7: note: candidate: ‘std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = KWin::GLShader; _Dp = std::default_delete<KWin::GLShader>; std::nullptr_t = std::nullptr_t]’
432 | operator=(nullptr_t) noexcept
| ^~~~~~~~
/usr/include/c++/12/bits/unique_ptr.h:432:17: note: no known conversion for argument 1 from ‘KWin::GLShader*’ to ‘std::nullptr_t’
432 | operator=(nullptr_t) noexcept
| ^~~~~~~~~
make[2]: *** [src/CMakeFiles/kwin_effect_shaders.dir/build.make:104: src/CMakeFiles/kwin_effect_shaders.dir/Shaders.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:612: src/CMakeFiles/kwin_effect_shaders.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
giant error wall
/usr/include/kwineffects.h:3010:20: error: ‘std::span’ has not been declared 3010 | void copy(std::span<GLVertex2D> destination); | ^~~~ /usr/include/kwineffects.h:3010:24: error: expected ‘,’ or ‘.. ’ before ‘<’ token 3010 | void copy(std::span<GLVertex2D> destination); | ^ In file included from /home/komi/src/kwin-effect-shaders/src/Shaders.h:21, from /home/komi/src/kwin-effect-shaders/src/plugin.cc:18: /usr/include/kwineffects.h:3010:20: error: ‘std::span’ has not been declared 3010 | void copy(std::span<GLVertex2D> destination); | ^~~~ /usr/include/kwineffects.h:3010:24: error: expected ‘,’ or ‘.. ’ before ‘<’ token 3010 | void copy(std::span<GLVertex2D> destination); | ^ /usr/include/kwineffects.h:3428:10: error: ‘optional’ in namespace ‘std’ does not name a template type 3428 | std::optional<qreal> renderTargetScale() const; | ^~~~~~~~ /usr/include/kwineffects.h:3428:5: note: ‘std::optional’ is only available from C++17 onwards 3428 | std::optional<qreal> renderTargetScale() const; | ^~~ /usr/include/kwineffects.h:3428:10: error: ‘optional’ in namespace ‘std’ does not name a template type 3428 | std::optional<qreal> renderTargetScale() const; | ^~~~~~~~ /usr/include/kwineffects.h:3428:5: note: ‘std::optional’ is only available from C++17 onwards 3428 | std::optional<qreal> renderTargetScale() const; | ^~~ In file included from /home/komi/src/kwin-effect-shaders/src/Shaders.h:21, from /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:18: /usr/include/kwineffects.h:3010:20: error: ‘std::span’ has not been declared 3010 | void copy(std::span<GLVertex2D> destination); | ^~~~ /usr/include/kwineffects.h:3010:24: error: expected ‘,’ or ‘.. ’ before ‘<’ token 3010 | void copy(std::span<GLVertex2D> destination); | ^ /usr/include/kwineffects.h:3428:10: error: ‘optional’ in namespace ‘std’ does not name a template type 3428 | std::optional<qreal> renderTargetScale() const; | ^~~~~~~~ /usr/include/kwineffects.h:3428:5: note: ‘std::optional’ is only available from C++17 onwards 3428 | std::optional<qreal> renderTargetScale() const; | ^~~ /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:21: error: ‘GLShader’ was not declared in this scope 46 | std::unique_ptr<GLShader> m_shader; | ^~~~~~~~ /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:29: error: template argument 1 is invalid 46 | std::unique_ptr<GLShader> m_shader; | ^ /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:29: error: template argument 2 is invalid /home/komi/src/kwin-effect-shaders/build/src/kwin_effect_shaders_autogen/EWIEGA46WW/../../../../src/Shaders.h:46:21: error: ‘GLShader’ was not declared in this scope 46 | std::unique_ptr<GLShader> m_shader; | ^~~~~~~~ /home/komi/src/kwin-effect-shaders/build/src/kwin_effect_shaders_autogen/EWIEGA46WW/../../../../src/Shaders.h:46:29: error: template argument 1 is invalid 46 | std::unique_ptr<GLShader> m_shader; | ^ /home/komi/src/kwin-effect-shaders/build/src/kwin_effect_shaders_autogen/EWIEGA46WW/../../../../src/Shaders.h:46:29: error: template argument 2 is invalid /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:21: error: ‘GLShader’ was not declared in this scope; did you mean ‘glIsShader’? 46 | std::unique_ptr<GLShader> m_shader; | ^~~~~~~~ | glIsShader /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:29: error: template argument 1 is invalid 46 | std::unique_ptr<GLShader> m_shader; | ^ /home/komi/src/kwin-effect-shaders/src/Shaders.h:46:29: error: template argument 2 is invalid make[2]: *** [src/CMakeFiles/kwin_effect_shaders.dir/build.make:76: src/CMakeFiles/kwin_effect_shaders.dir/kwin_effect_shaders_autogen/mocs_compilation.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: *** [src/CMakeFiles/kwin_effect_shaders.dir/build.make:90: src/CMakeFiles/kwin_effect_shaders.dir/plugin.cc.o] Error 1 /home/komi/src/kwin-effect-shaders/src/Shaders.cpp: In constructor ‘KWin::ShadersEffect::ShadersEffect()’: /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:36:43: error: cannot convert ‘std::nullptr_t’ to ‘int’ in initialization 36 | ShadersEffect::ShadersEffect() : m_shader(nullptr), m_effectEnabled(false) { | ^~~~~~~ | | | std::nullptr_t /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:60:14: error: ‘class KWin::EffectsHandler’ has no member named ‘registerGlobalShortcut’; did you mean ‘registerAxisShortcut’? 60 | effects->registerGlobalShortcut(Qt::CTRL + Qt::META + Qt::Key_Z, toggleEffectShortcut); | ^~~~~~~~~~~~~~~~~~~~~~ | registerAxisShortcut /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:67:14: error: ‘class KWin::EffectsHandler’ has no member named ‘registerGlobalShortcut’; did you mean ‘registerAxisShortcut’? 67 | effects->registerGlobalShortcut(Qt::CTRL + Qt::META + Qt::Key_A, reloadShadersShortcut); | ^~~~~~~~~~~~~~~~~~~~~~ | registerAxisShortcut /home/komi/src/kwin-effect-shaders/src/Shaders.cpp: In member function ‘void KWin::ShadersEffect::slotGenerateShaderFromBuffers()’: /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:246:63: error: cannot convert ‘std::unique_ptr<KWin::GLShader>’ to ‘int’ in assignment 246 | m_shader = ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, vertexBuf, fragmentBuf); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::unique_ptr<KWin::GLShader> /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:249:18: error: base operand of ‘->’ is not a pointer 249 | if (!m_shader->isValid()) { | ^~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp: In member function ‘virtual void KWin::ShadersEffect::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&)’: /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:304:32: error: request for member ‘get’ in ‘((KWin::ShadersEffect*)this)->KWin::ShadersEffect::m_shader’, which is of non-class type ‘int’ 304 | ShaderBinder bind(m_shader.get()); | ^~~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:308:13: error: base operand of ‘->’ is not a pointer 308 | m_shader->setUniform("g_Random", (float) drand48()); | ^~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:309:13: error: base operand of ‘->’ is not a pointer 309 | m_shader->setUniform("g_TextureSize", QVector2D(effects->virtualScreenSize().width(), effects->virtualScreenSize().height())); | ^~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:310:13: error: base operand of ‘->’ is not a pointer 310 | m_shader->setUniform("modelViewProjectionMatrix", data.projectionMatrix()); | ^~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:312:10: error: ‘class KWin::WindowPaintData’ has no member named ‘shader’ 312 | data.shader = m_shader.get(); | ^~~~~~ /home/komi/src/kwin-effect-shaders/src/Shaders.cpp:312:28: error: request for member ‘get’ in ‘((KWin::ShadersEffect*)this)->KWin::ShadersEffect::m_shader’, which is of non-class type ‘int’ 312 | data.shader = m_shader.get(); |
Hi,
when I hit the hotkey to show the Ui, nothing happens.
Well, the active window loses focus, so I think the window is created, but is not visible (maybe it is offscreen?), nor it appears in the taskbar.
One time i managed to get it shown, but I can't say how.
I'm on Xorg.
With wmctrl and xprop i managed to somehow identify the window:
_NET_WM_USER_TIME(CARDINAL) = 1091844705
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MODAL
WM_TRANSIENT_FOR(WINDOW): window id # 0x1400017
_KDE_OXYGEN_BACKGROUND_GRADIENT(CARDINAL) = 1
_NET_WM_ICON_NAME(UTF8_STRING) =
_KDE_NET_WM_DESKTOP_FILE(UTF8_STRING) = "org.kde.kwin"
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Shaders Configuration UI"
_NET_WM_NAME(UTF8_STRING) = "Shaders Configuration UI — KWin"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x1400017
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
window id # of group leader: 0x1400017
WM_CLIENT_MACHINE(STRING) = "Gozer"
_NET_WM_PID(CARDINAL) = 3111908
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 20978313
WM_CLASS(STRING) = "kwin_x11", "kwin"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
user specified location: 2617, 171
user specified size: 506 by 628
program specified minimum size: 506 by 462
window gravity: Static
2617,171 should be visible as i run multihead setup with 1920x1080 spawned in horizontal.
This was from the github version
This is from the aur version
I'm unable to make it work, nor i've a clue on how to debug.
I saved the 1_settings.glsl and activated some trivial filters like grayscale.
But unfortunately, upon hotkey, hothing changes on screen.
koko@Gozer# cat /home/koko/.config/kevinlekiller/kwin_effect_shaders.conf
[General]
AutoApply=true
Blacklist=
DefaultEnabled=true
ShaderPath=/home/koko/.local/share/kwin-effect-shaders_shaders/
Whitelist=
koko@Gozer# grep "_ENABLED 1" /home/koko/.local/share/kwin-effect-shaders_shaders/1_settings.glsl
#define FILM_NOISE_ENABLED 1
#define GRAYSCALE_ENABLED 1
Am i doing something wrong? Maybe the Haswell IGP is not enough?
I'm on x11, going to switch to wayland to see if something changes.
btw, i can confirm that it access the shader file because i used strace to inspect what kwin_x11 were doing when i enable the effect via the kcm interface.
You have scratched an itch I have been having for a long time now.
Successfully got this project setup and working on a Steam Deck using Plasma 5.26.
My dream is to use the RetroArch GLSL CRT shaders for a "retro" look on the desktop.
Is it possible to use GLSL shaders as they are?
https://github.com/libretro/glsl-shaders/tree/master/crt/shaders
As mentioned in the README, the shaders are all run in 1 pass, which causes this issue.
I've been looking into and trying (unsuccesfully) to get the shaders to run individually (in pairs of frag + vert) which should solve this issue.
I see that currently CMake only depends on extra cmake modules, but I got a compile-time error about libepoxy missing, which should have been a configure-time error. Perhaps KWin provides a proper CMake config with exported targets, so we need to find_package
that, otherwise the transitive dependencies are not included.
After a few hours of trying to figure out a solution, I give up on this one for now.
I've tried storing and using the window geometry using one of the 3 QWidget available ways ( pos() + move() / rect() + setGeometry() / saveGeometry() + restoreGeometry() ).
When show() is called the first time, it works (only if it's done AFTER show(), not before, like they say to do it), subsequent times it goes back to the middle of the screen.
They mention how X11 has an issue where the window goes to the bottom right of the screen : https://doc.qt.io/qt-5/restoring-geometry.html
It's probably the same issue, but it goes to the middle on Wayland.
This is because the game takes control of the mouse cursor.
Workarounds:
Alt+Tab out and back into the game, then the UI gets control of the cursor.
Run the game in Windowed or Borderless mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.