06 October 2022

New Lightweight GLSL Shader around - some testing comparison

If you browse this blog, you'll see how important I deem shaders for MAME. Proper shader configuration was a bit of the start of this blog. So no wonder if I report about a promising new lightweight GLSL shader.

MAME-PSGS in action, good looking and performant

You find the new shader here: https://github.com/TheCodeTherapy/MAME-PSGS. According to the ReadMe, this shader is designed for rather low-key non-Windows devices running MAME. Clearly modern Macs run every BGFX MAME shader with ease, but let's see which performance gains a truly lightweight shader can achieve.

Configuration of MAME-PSGS:

Put the files from github into a directory called "glsl". Then edit mame.ini as follows:
#
# OpenGL-SPECIFIC OPTIONS
#
gl_forcepow2texture       0
gl_notexturerect          0
gl_vbo                    1
gl_pbo                    1
gl_glsl                   1
gl_glsl_filter            1
glsl_shader_mame0         /Users/--username--/..../mame/glsl/mame-psgs
#
# OSD VIDEO OPTIONS
#
video                     opengl
No further different configuration required. You can then easily switch between OpenGl and BGFX by changing the video line accordingly (even within the system settings of the MAME UI, you can perform this change with ease).

Shaders to test

Shader 1 - BGFX/HLSL: the heavyweight shader, very demanding and not so much of my personal taste
Shader 2 - BGFX/CRT-GEOM: still the benchmark shader for me, I prefer it over CRT-GEOM Deluxe because the glow is often too much for me
Shader 3 - GLSL/MAME-PSGS: the new guy 

Here are the three terminal commands: 
unthrottled test run for 60 seconds of game runtime, disregard mame.ini, but only execute these options

MAME BGFX HLSL

./mame -video bgfx -str 60 -noafs -bgfx_screen_chains hlsl -bgfx_backend opengl -noreadconfig -nosleep -nothrottle -lowlatency 1942


MAME BGFX CRT-GEOM

./mame -video bgfx -str 60 -noafs -bgfx_screen_chains crt-geom -bgfx_backend opengl -noreadconfig -nosleep -nothrottle -lowlatency 1942


MAME GLSL/PSGS

./mame -video opengl -str 60 -noafs -nofilter -gl_glsl -glsl_shader_mame0 /Users/stefanstockinger/Games/mame/glsl/mame-psgs -noreadconfig -nosleep -nothrottle -lowlatency 1942


The results in MAME 246, Mac Mini M1, Monterey 12.6:



Insights: While GLSL remains the performance king, BGFX could narrow the gap significantly. At the same time, the difference to the heavyweight HLSL shader is impressive. This is how much performance you can loose on a shader alone. And don't even think about testing this with the Metal backend, full throttle testing is still not working properly in MAME (while the Metal backend does not do me any troubles in gaming, where I am using it).

See yourself whether you like the layout of MAME-PSGS. It is a very valid option on lower-performing Macs if you struggle with BGFX. Compared to my favorite CRT-GEOM, it's sometimes a bit too pixelated, so CRT-GEOM provides for a more distinct appearance, in particular very old games, e.g. Galaxian.

Configuration of MAME-PSGS is clearly explained in the ReadMe on Github, and there are some nice options to play around. For example, I put Saturation on 1 for a bit more vivid colors.

Conclusion on MAME-PSGS:

+ fast and easy configuration, small download
+ you can easily switch between OpenGl and BGFX in the system settings of MAME
+ very lightweight and thus performant, could be a very good option for lower-performing Macs
+ good looking, convincing CRT simulation, color schemes are fun to try
- my personal benchmark CRT-GEOM as shipped with MAME looks a bit better and has no huge performance disadvantage
- no in-game Slider Controls as with BGFX shaders 

Recommendation: Install it and switch to OpenGl from time to time.

1 comment:

  1. You're right. BGFX with metal not faster than opengl, and not so efficient.

    ReplyDelete

Any comments are welcome!