CSO save/restore flags a bunch of state dirty unnecessarily
try_pbo_readpixels does cso_save_state with CSO_BIT_PAUSE_QUERIES, which calls set_active_query_state twice. This flags a bunch of things dirty. It could possibly check if any queries are actually active before bothering with this.