Problem: SetViewport() and Cls() do their adjustments immediately while all drawing commands (DrawRect, DrawImage...) are batched. This leads to the odd behaviour of viewport adjustments being executed before the batch is rendered. So they happen at another position in the queue then intended. Same for Cls(). So calling Cls() between two "DrawRect()" (which share the same primitive_id) would get executed before the batch renders these two rectangles.
Problem: SetViewport() and Cls() do their adjustments immediately while all drawing commands (DrawRect, DrawImage...) are batched. This leads to the odd behaviour of viewport adjustments being executed before the batch is rendered. So they happen at another position in the queue then intended. Same for Cls(). So calling Cls() between two "DrawRect()" (which share the same primitive_id) would get executed before the batch renders these two rectangles.