+ apply_framebuffer();
+ commands.use_pipeline(&get_pipeline_state());
+ commands.resolve_multisample(target);
+}
+
+void Renderer::begin_query(const QueryPool &pool, unsigned index)
+{
+ commands.begin_query(pool, index);
+}
+
+void Renderer::end_query(const QueryPool &pool, unsigned index)
+{
+ commands.end_query(pool, index);
+}
+
+PipelineState &Renderer::get_pipeline_state()
+{
+ if(changed&PIPELINE_KEY)
+ {
+ RendererBackend::set_pipeline_key(current_state->pipeline_key);
+ changed &= ~PIPELINE_KEY;
+ }
+
+ return RendererBackend::get_pipeline_state();
+}
+
+void Renderer::apply_framebuffer()
+{
+ const State &state = get_state();
+
+ PipelineState &ps = get_pipeline_state();
+
+ ps.set_framebuffer(state.framebuffer);
+ static const Rect default_rect = Rect::max();
+ ps.set_viewport(state.viewport ? *state.viewport : default_rect);
+ ps.set_scissor(state.scissor ? *state.scissor : default_rect);