SnowflakePowered / librashader

RetroArch Shaders for All
Mozilla Public License 2.0
77 stars 7 forks source link

Metal Shader Compatibility Report (via ares emulator) #75

Open jcm93 opened 3 months ago

jcm93 commented 3 months ago

Native Metal support was recently added to ares to complement its librashader support. I've started to do some testing with a bunch of shaders and wanted to start reporting preliminary findings from the .slangp shader library it bundles.

Overall impressions are great. Most things seem to be working correctly and performing well.

I don't have a reference for how these shaders behave on other platforms, so I can mostly only point out things that seem 'obviously broken,' or else obvious things like compiler failures.

With that said, here's a preliminary list so far. I expect to eventually test everything, this is just from my first round of tests, to start getting stuff out there.

Loads fine, blank output

crt/crt-geom-deluxe.slangp crt/crt-slangtest-cubic.slangp crt/crt-slangtest-lanczos.slangp

Filter chain creation failure

crt/crt-guest-advanced-ntsc.slangp vhs/mudlord-pal-vhs.slangp known broken shader test/feedback-noncausal.slangp sharpen/Anime4k.slangp known broken shader vhs/VHSPro.slangp

Other

vhs/vhs_and_crt_godot.slangp - Loads, renders, but pegs GPU to 100% even at low resolutions. Could just be a shader issue. presets/crt-royale-smooth.slangp - blurring issue, see downthread bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp - same blurring issue

reshade/gba.slangp - Fails to create preset shader issue reshade/nds.slangp - Fails to create preset shader issue

Other notes so far are that "megabezel" shader performance across the board is somewhat poor at ~4K resolutions when its reflections are enabled. This may simply be a shader issue but I figured worth including.

For testing, the ares' recent CI builds all include the Metal backend. I can provide more information or Metal GPU captures as well if needed for anything, if that is helpful.

chyyran commented 2 months ago

Filter chain failure is odd, I wonder if it might be something in SPIRV-Cross.. Will take a look this or next week.

chyyran commented 2 months ago

Metal GPU captures would be massively helpful here, as well as LLVM logs from the compiler if you’re able to get them.

jcm93 commented 2 months ago

Metal GPU captures would be massively helpful here, as well as LLVM logs from the compiler if you’re able to get them.

Sure, I'll get captures from the ones that appear to be rendering nothing; can you provide any guidance on the latter point? Is there a way to get the compiler output to appear in stdout for example? Would compiling librashader in debug mode do the job? I notice that I already get compilation warnings from the shaders by default.

chyyran commented 2 months ago

It should show up in debug logs in Xcode when first loading the shader. It’s not a librashader thing but a Metal -> MetalIR thing

jcm93 commented 2 months ago

Hmm, I don't get any output I can see from filter chain creation, even with Xcode Metal API and Shader validation enabled. I tried in the objctest code as well; selecting crt-guest-advanced-ntsc just ends up with a nil _filterChain. I see a couple compilation warnings, but compilation succeeds.

chyyran commented 2 months ago

Thats fine, I’ll investigate crt-guest-advanced-ntsc on my end.

jcm93 commented 2 months ago

Here are the GPU captures. They should be labeled appropriately. Let me know if you have any issues opening or getting relevant data from them!

https://drive.google.com/file/d/11bNWB78_drEg1IW3t4ZcViupYgg8qQkd/view?usp=sharing

For the vhs shader capture, it seemed to peg my GPU above a certain resolution, so I notched it just above that and took a capture. Again, that one could just be a shader issue, but I figured it was worth including. I also included a megabezel capture; it seems to be doing some very weird stuff indeed (frame times there were exceedingly high every few frames, though not every frame, so looking at this more closely, I think it's just dropping frames; regardless, I included three frames in that capture); I couldn't exactly tell what was going on.

chyyran commented 2 months ago

mudlord-pal is a known broken shader: https://github.com/SnowflakePowered/librashader/actions/runs/8577373017/job/23509866495#step:4:376

seems like crt-guest-advanced has been failing, will need to double check but it smells like a shader issue.

chyyran commented 2 months ago

Anime4k is also a known broken shader

jcm93 commented 2 months ago

scratch that, seems to be the result of a driver issue

jcm93 commented 1 month ago

Testing some things in ares and noticed another librashader issue with certain 'smoothing' shaders such as presets/crt-royale-smooth.slangp or bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp.

Left librashader, right RetroArch: Screenshot 2024-05-31 at 3 52 58 PMScreenshot 2024-05-31 at 3 53 37 PM

Screenshots are of the megabezel shader; here is a gputrace from the crt-royale-smooth shader which exhibits similar behavior.

https://drive.google.com/file/d/1NBePGt62XmFZ_mthqlR8YTj8EC7EFVdG/view?usp=share_link