This fixes various bugs that appear in the HW rasterizer after switching between it and the SW one during emulation.