Ah, so would it be somehow along those lines?
class Stage
{
SetRenderTarget(int, texture) { state.add<RenderTarget>(texture) }
private:
StateGroup stageState;
}
class Model
{
AddRenderInstance(Stage&, Mesh&, Effect&, Material*) { m_vInstances.push_back(new RenderInstance(stage, mesh, effect, material);
}
private:
vector<RenderInstance>
}
Then before the actual render loop, I'd have a scene graph thingy that holds pointer to all modes sort out the respective render instances to their stage bucket. After that I'd submit the buckets stage group, then submit all the render instances inside that bucket to the actual render queue. Correct? If so,
the bucket associated with each stage is sorted (if needed), the state group of that stage (containing the render target clearing/binding commands) is submitted
Do I need a seperate command for submitting a state group only for my render queue (because now I only support render instance submitting), or do you mean "submit" here more like explicitely set those states here?