I’m trying to understand the differences between these two shader pipelines. Getting_Started_with_Shaders mentions that Fixed functions is meant for compatibility for older hardware. I also read FFP may have less features compared to SM2, which is understandable. But if I could get away with all shaders as fixed function, should I? Is there any performance difference?
I’m just a little confused, because if a shader can be either. Which one should I be preferring?
My device uses Android, Arm7, OpenGL-ES 2.0
Been doing some research, I think I have found enough related information to answer myself. To help others in the future whom may have the same question, I’ve provided links to the most helpful web pages.
In the Unity Shader Manual:
Fixed Function Shaders need to be written for old hardware that doesn’t support programmable shaders. You will probably want to write fixed function shaders as an n-th fallback to your fancy fragment or surface shaders, to make sure your game still renders something sensible when run on old hardware or simpler mobile platforms.
Also found an interesting forum post that discusses the topic and more:
maik’s Question: So, does this means that it would be better to always code my own Cg shaders? (i.e. replace all the default shaders with my own ones in cg?)
Jessy’s Reply: Non-surface shader Cg can be faster, but the device runs GLSL. If performance is an issue, GLSL is the way to go, unless the Cg auto-translates into optimized GLSL. Sometimes it will, sometimes it won’t. If you find GLSL to run faster than the translated Cg, you should report a bug. I don’t have time for that (the auto-translated GLSL looks like garbage, so comparisons are too time-consuming), so I use GLSL directly, but that’s not the approach Unity steers you into.
Fixed function shaders will always be translated to the programmable hardware in a way that yields suboptimal performance.
SubShaders should be added, so they work on obsolete hardware, and faster on modern hardware. You can find threads here from the past year or so in which I detail this.
and some more links: