Skip to content

Commit

Permalink
desktop-ui/presentation: Add an alternative path for loading shaders …
Browse files Browse the repository at this point in the history
…on Linux and BSD (#1738)

On some Linux and BSD distribution, Ares from the repositories may not
come with shaders preinstalled. Instead, these one may come from another
package, for example on Archlinux the package `libretro-shaders-slang`
installs the shaders in the following path:
`/usr/share/libretro/shaders/shaders_slang/` .

This will make Ares fail to load any shaders on these distro. So to fix
it, this PR adds the aforementioned location as another path to search
for, as a fallback.

I know, the two dots are a bit ugly, given that locate() normally
doesn't search for files or directories outside of those of
Ares...Ideally, locate() should be expanded to search the entire file
system, but I'm afraid the required changes may be a bit more far
reaching than expected.
  • Loading branch information
Mastergatto authored Jan 1, 2025
1 parent 8433666 commit 69795d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions desktop-ui/presentation/presentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,10 @@ auto Presentation::loadShaders() -> void {
shaders.append(none);

string location = locate("Shaders/");
#if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD)
// In some Linux or BSD distro shaders may not be bundled with ares, so try to locate them at a different path
if(not inode::exists(location)) location = locate("../libretro/shaders/shaders_slang/");
#endif

if(shaderDirectories.size() == 0) {
function<void(string)> findShaderDirectories = [&](string path) {
Expand Down

0 comments on commit 69795d5

Please sign in to comment.