libretro / common-shaders

Collection of commonly used Cg shaders. These shaders are usable by either HLSL and/or Cg runtime compilers. The cg2glsl script will translate most of these into GLSL shaders.
http://www.libretro.com
1.05k stars 250 forks source link

How to debug shader loading? #84

Closed madig closed 8 years ago

madig commented 8 years ago

I'm using RA from master on Fedora 24. I've noticed that there are many shaders (from the GLSL package downloaded via the updater) that upon loading.. do nothing. fx-aa.glsl is one example. However, running retroarch --verbose doesn't produce any errors regarding shader loading. Is there some way to find out why the shader doesn't load?

hizzlekizzle commented 8 years ago

If there are no errors in the verbose log, it means it's compiling successfully and just isn't really doing anything (nothing visible, at least). This is difficult to debug because the script-converted GLSL shaders are horrible spaghetti code. The options in cases like this are basically: use the Cg version, hand-convert from Cg to GLSL, hand-write a GLSL version (luckily, FXAA is available elsewhere in GLSL, so this is actually a fair possibility) or wait until we get spir-v reflection to produce a better automated conversion (I haven't actually made a slang version of FXAA yet but was planning to do one soon).

madig commented 8 years ago

Hm, I'd use the Cg version, but the log says RetroArch [ERROR] :: [Shader driver]: Cg cannot be used with core GL context. Trying to fall back to GLSL... :( Oh well, thanks anyway, I'll go look for a GLSL version.

hizzlekizzle commented 8 years ago

Ah, ok. IIRC, that error is usually related to the ribbon effect in the menu. You could try turning it off in settings > menu to see if that helps.

madig commented 8 years ago

The ribbon was turned off already.

madig commented 8 years ago

(Interestingly, the fx-aa.cg shader (Cg!) didn't to anything visible either on Windows. Hm.)

hizzlekizzle commented 8 years ago

That is interesting. I thought I remembered that one working properly...

I just ported a version to slang and it works pretty well, if you can run the vulkan context (won't work with mupen, reicast or ppsspp)

madig commented 8 years ago

That one works. Guess I'll wait for SPIR-V reflection :)