Skip to content

WIP: RFC: Optimize draw_vbo commands

Antonio Caggiano requested to merge Fahien/virglrenderer:opt-draw-vbo into main

A candidate for optimization are draw_vbo commands as they can be reordered when submission order does not matter (e.g. blending is not enabled).

In other words, draw_vbo commands, and related binding calls, can be deferred and submitted later after reordering. The idea here is to group these set of commands by their set_vertex_buffer command so to avoid calling glBindVertexBuffer multiple times.

The implementation consists of adding a list to the decode context, to store draw_vbo commands as they are processed from the command buffer. Previous commands related to a draw_vbo command are stored as well into a sub-list, so to preserve the order of binding calls.

When conditions for deferring are not met anymore, because of blending enabled or a command that should not be deferred is encountered, all commands that have been deferred are submitted and the list is reset.

This is a WIP at the moment as while I could get a 4% FPS improvement on a Portal 2 trace, I noticed that other traces performance worsened.

Merge request reports