only set uniforms if their passes are defined
cherry-pick from terrain branch