Move RenderState manipulation out of a loop so that we thrash it less

It doesn't really make sense to say that we're idle when we're
potentially still rendering.
Merge pull request #2965 from zwarich/render-state-less

Move RenderState manipulation out of a loop so that we thrash it less