Only put those uniforms to uniformsList which are in the program

Also cache uniform locations in the uniformsList, so that querying them
from the program is not needed. This reduces CPU usage.
Merge pull request #5036 from NVIDIA/optimize-uniforms-list

Only put those uniforms to uniformsList which are in the program