RetroArch [ERROR] :: [GL]: Failed to parse GLSL shader

Please forgive me if I’m missing something obvious here, but I cannot get RetroArch to load any GLSL-formatted shaders. I am using Arch Linux with the current versions of retroarch-git and libretro-shaders-git from AUR. If I do a simple “git clone” of the shaders repo I can load the CG-formatted shaders without an issue. The error is:

RetroArch [ERROR] :: [GL]: Failed to parse GLSL shader.
RetroArch [WARN] :: [GL]: Failed to set multipass shader. Falling back to stock.
RetroArch [WARN] :: [GL]: Stock GLSL shaders will be used.

My build reports the following:

$ retroarch --features

Features:
	SDL:
		SDL drivers: yes
	Threads:
		Threading support: yes
	OpenGL:
		OpenGL driver: yes
	KMS:
		KMS/EGL context support: yes
	EGL:
		EGL context support: yes
	OpenVG:
		OpenVG output support: no
	XVideo:
		XVideo output: yes
	ALSA:
		audio driver: yes
	OSS:
		audio driver: yes
	Jack:
		audio driver: yes
	RSound:
		audio driver: no
	RoarAudio:
		audio driver: no
	PulseAudio:
		audio driver: yes
	DirectSound:
		audio driver: no
	XAudio2:
		audio driver: no
	zlib:
		PNG encode/decode and .zip extraction: yes
	OpenAL:
		audio driver: yes
	External:
		External filter and plugin support: yes
	Cg:
		Cg pixel shaders: yes
	libxml2:
		libxml2 XML parsing: yes
	SDL_image:
		SDL_image image loading: yes
	FBO:
		OpenGL render-to-texture (multi-pass shaders): yes
	Dynamic:
		Dynamic run-time loading of libretro library: yes
	FFmpeg:
		On-the-fly recording of gameplay with libavcodec: yes
	FreeType:
		TTF font rendering with FreeType: yes
	Netplay:
		Peer-to-peer netplay: yes
	Python:
		Script support in shaders: yes

Any help would be much appreciated. Thanks!

hi,

you are probably using an older GLSL shader in xml format, and they are no longer supported as has been noted in this sticky : link

it also shows how to convert the older format to the new one by hand, so you could give it a try if want.

there is also the possibility to convert CG shaders to GLSL using this python script : link

Thanks for the reply. The AUR script grabs the shaders from git://github.com/libretro/common-shaders.git and then runs cg2glsl.py to convert them. The end result appears not to be compatible with the current build of RetroArch so I think there is a problem somewhere.

I just wanted to check if anyone knows the reason for this? I’m not sure if it’s a problem with cg2glsl.py or RetroArch itself. I’ll keep digging.

EDIT: I have found the root cause. The AUR package drops the GLSL files in /usr/share/libretro/shaders - owned by root - to provide the shaders to all users (fair enough). The problem is when the user tries to select a shader via RGUI, it tries to write the changes to a new file named “retroarch.glslp” in this directory to which it has no write permissions. A work-around is to create this file as root and change ownership to your user account, but this is messy.

I’ll report this to the maintainer of the AUR package. However, the file should ideally be written to “~/.config/retroarch/retroarch.glslp” rather than the shader directory. I think this is a bug in RetroArch from a multi-user environment perspective.

When I’ve encountered similar issues packaging for debian, I replace the normal executable with a launchscript that checks for the necessary user folder locations, as ~/.config/whatever, since you’re not supposed to write to user directories during installation as root (at least in debian-land; dunno if others are as picky), and then copy from the multiuser location into the single-user spot.

some of the glsl shaders don’t work but have you tried all of them. I am also on arch linux and build the retroarch-git package almost every day and just batch converted a bunch of shaders yesterday and they work fine. There are some that still don’t work like ddt, dilation and a few other random ones but most of them should work. If you’d like I can send you my glsl shaders to you since I know they work.

Make an issue about this on Github. I’ll have a look on this when I can. I thought about this case a couple of days ago as well.

Done Sir:

I’m glad to be of some help to the project, even if it’s just with my sys. admin hat on.