Fix error when shader can't link

Calling glValidateProgram clears glGetProgramInfoLog, so it must check for a
link error _before_ validating.