Upload textures at the beginning of a frame

We should upload all dirty textures (glyph atlas, sprite atlas) at the beginning of a frame to avoid stalls during the rendering.