SFTtech/openage

Draw order optimizations

Opened this issue · 1 comments

Objects in a render pass should be ordered in such a way that they don't require expensive state switches. We can minimize the changes by clever ordering of objects by

  1. render target
  2. shader program
  3. texture bindings
  4. vertex format
  5. uniform buffer bindings
  6. vertex bindings
  7. uniform updates

Sorting should happen on-the-fly, i.e. during insertion/removal of new renderables to a render pass.

There is an overview from this talk that shows the estimated cost for each switch:

state_change_cost

probably each thing just has a priority and we use our heap to get elements one after the other. but it gets trickier due do the dependencies between these actions.