• Create Account

### #ActualTiagoCosta

Posted 15 April 2013 - 12:11 PM

I do also have stage groups, probably a lot like yours. As in one of Hodgmans posts, my model, material and effect all holds their own state group, which the model puts together and submits to the queue.

In my implementation the models don't have access to the render queue, (in my opinion the model class should be independent on the Renderer), instead the model class has a method getStateGroups() an array containing the effect, material, mesh, model state groups.

for(Model model : models)
{
queue.submit(model.getStageGroups(), model.getNumStateGroups();
}


Now that you say "models, materials and effects should not have anything to do" with clearing render targets - how do you set the stage group anyway? Since each of those entities have their own stage groups, command injection has to go through them, at some point, right? E.g. my model has a "SetVertexConstant"-method that adds a VertexConstantX-command to the stage. How do you handle this? Thats a question I was going to ask anyway at some point, because I was really unsure how this is normally done.

The Stage group is submitted individually before the models. How do you bind render targets/depth stencil buffers?

I don't have commands to set individual constants, instead I work with constant buffers, the model "SetVertexConstant"-method will change the value of the constant in a POD buffer then the model uses two commands, UpdateCBuffer (that fills a D3D buffer with the contents of the POD buffer containing the constants) and VSBindCBuffer0 (that binds the D3D buffer to the constant buffer slot 0 of the vertex stage)

### #1TiagoCosta

Posted 15 April 2013 - 12:08 PM

I do also have stage groups, probably a lot like yours. As in one of Hodgmans posts, my model, material and effect all holds their own state group, which the model puts together and submits to the queue.

In my implementation the models don't have access to the render queue, (in my opinion the model class should be independent on the Renderer), instead the model class has a method getStateGroups() an array containing the effect, material, mesh, model state groups.

for(Model model : models)
{
queue.submit(model.getStageGroups(), model.getNumStateGroups();
}


Now that you say "models, materials and effects should not have anything to do" with clearing render targets - how do you set the stage group anyway? Since each of those entities have their own stage groups, command injection has to go through them, at some point, right? E.g. my model has a "SetVertexConstant"-method that adds a VertexConstantX-command to the stage. How do you handle this? Thats a question I was going to ask anyway at some point, because I was really unsure how this is normally done.

The Stage group is submitted individually before the models.

I don't have commands to set individual constants, instead I work with constant buffers, the model "SetVertexConstant"-method will change the value of the constant in a POD buffer then the model uses two commands, UpdateCBuffer (that fills a D3D buffer with the contents of the POD buffer containing the constants) and VSBindCBuffer0 (that binds the D3D buffer to the constant buffer slot 0 of the vertex stage)

PARTNERS