The render queue currently basically consists of a list of integers representing index tuples to vertex and index buffers. This should be made more abstract, so it can contain other resources.
Brainstorming
Post-processing work should be prioritized using the render queue
The render queue consists of base classes "render_command::base" which has derived classes for...
Render state changes like materials, vertex buffers, index buffers, shaders (the derived class then contains a reference to the changed resource)
Switching targets (for the post-processing stuff) (likewise, the derived class contains the new target)
Rendering an indexed model (thus changing the transform matrix and calling render_indexed with a given index buffer)
Using base classes ensures extensibility, but maybe we don't need that. Render commands might be fixed, and extended just via a "custom(callback)" type. We cannot say that now, we have to explore the possible render commands
To render the scene, the list is built, as it is done currently. As a more general approach, however, a set of "layer generators" build the list instead of the single scene manager.
The layer generators have a unique ID starting at 0 (for the first rendered layer).
Layer generators are responsible for generating the 64 bit sort key for the render queue
The idea is that we write the layer id to the MSB and can then use the remaining 63 bits freely. This is more abstract than just fixing the bits' contents.
The "main_scene" layout manager could have id 0 and is supposed to write drawing commands for the models.
It keeps track of the added vertex buffers/textures and so on, as it is now, and generates a sort key from that, as well as the render_command::base instances.
To keep sorting performance high, instead of a vector we might need a vector<pair<sort_key,render_command>> (or a ptr_map<sort_key,render_command> maybe).
However, this introduces fragmentation (since render_commands have to be noncopyable, see above).
Motivation
The render queue currently basically consists of a list of integers representing index tuples to vertex and index buffers. This should be made more abstract, so it can contain other resources.
Brainstorming