Adds some Asserts in the renderer

Linux still has a bug, but I can't reproduce it all the time.
Hoping that these asserts will help me find it
Merge pull request #5109 from ricardoquesada/renderer_sane_checks

Adds some Asserts in the renderer