renderer: refactor/fix frame acquire/release logic
The target frame could accidentally be double-acquired under the old logic, leading to deadlock. Additionally, we could sometimes accidentally release frames we never acquired. Finally, we released the target too early, leading to an assertion when attempting to actually use it.
Fix all three at the same time by just keeping explicit track of which frames have been acquired. In theory, we could do this to also avoid releasing frames that were previously acquired.