shader-db: simplify and improve SSO handling

This does two things:
1. Allows cross shader optimisations to be preformed on SSO
programs that contain more than one stage (seems like I
don't have any of these in my shader-db collection).
2. Allows us to write compilation errors to stderr. With this
change I discovered a Deus Ex: MD shader was failing to
compile (I've reported it to Feral).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>