(2023-01-24, 01:54)garbear Wrote: GL shaders were disabled a while ago because, while they didn't work on GL, at least they didn't cause problems. But then on macOS the screen was entirely black, so I disabled. Recently, I tried enabling, and now they definitely cause problems even on Linux. So yeah, GL shaders need some love.
@
garbear I've just returned from family holidays with a friend who is a developer (unlike me). While our families went to sleep at night, we got an idea to hack a little bit, so we sneaked to a computer and played with the
https://github.com/garbear/xbmc/pull/114.
The good news is that it is actually not broken, as we've managed to create a Linux build (Wayland and OpenGL) from your repository (
retroplayer-20 branch) with the "reverted revert of the PR114". We added the
ShaderPresetsGLSLP.xml and the actual GLSL shaders to
game.shader.presets and we've got working shaders on Linux! Even more, while the PR description states that the live preview of the shaders is not supposed to work, it actually worked for us, see the screenshots:
However, as you can see in the second screenshot, there is a problem with overdrawing of the GUI by the shader output (the first screenshot is captured with the Bilinear set, so no issues there). Also, only some of the shaders work (many others only render black screen, even 1 pass shaders like xbr2).
Then we've tried to switch the build from Wayland with OpenGL to Wayland with GLES and we've found out that the GLES build fails on
GL_CLAMP_TO_BORDER not supported by GLES. So we've looked through the Retroarch's code to see how they are handling it and we've found these:
https://github.com/libretro/RetroArch/bl...gl2.c#L754
https://github.com/libretro/RetroArch/bl...l3.c#L2186
https://github.com/libretro/RetroArch/co...1ed495314a
We've done similar
#ifdef in
ShaderUtilsGL.cpp and we've got the code to build for both GL and GLES. Eventually, after copying some more code from
RPRendererOpenGL.cpp to
RPRendererOpenGLES.cpp, we've got shaders working under OpenGL ES with similar limitations as for OpenGL (there is even more drawing over the GUI with GLES, but I expect that the source of the problem is the same):
Unfortunately, the holidays are over now and there is no more time left for us to play with this in the foreseeable future (and I am not able to continue myself). Still, it might be useful for anyone, who is going to continue the work, so the code is here:
https://github.com/cuchac/xbmc/commits/r...20-shaders
Feel free to cherry-pick the commits, but there are probably some cosmetic issues with whitespaces etc., so maybe it would be better to do the changes manually.
The first commit is the revert of the revert (nothing interesting there).
The second adds the GLES support and fixes some minor issues.
And the last one fixes more logging issues.
EDIT: Credits go to
https://github.com/cuchac.