[Pathtracer] Fixed little WebGL bugs that crashed rendering