Graphics Reference
In-Depth Information
meshes.AddRange(meshGroup);
}
}
// Initialize each mesh renderer
meshes.ForEach(m => m.Initialize(this));
To analyze the performance accurately, it is necessary to either disable
the animation or pause on a particular frame. This is because the
frames later in the animation will apply additional CPU load due to the
increased number of bone matrix transformations that are necessary
causing the frame times to increase and decrease at different times
during the animation. It is also critical to run a release build.
We are now ready to update our rendering loop for multithreaded rendering.
6.
At the start of the rendering loop in D3DApp.Run , we will retrieve the immediate
context and the first context within the contextList array.
// Retrieve immediate context
var immediateContext = DeviceManager.Direct3DDevice
.ImmediateContext;
// Note: the context at index 0 is always executed first
var context = contextList[0];
7. All the operations within the main render loop are now taking place on the first
device context within the contextList array, such as the following call to clear
the render target:
// Clear render target view
context.ClearRenderTargetView(RenderTargetView,
background);
Assuming all the contexts are using the same pipeline state, we only
want to do this once and on the first context; otherwise, we will be
clearing the results of other render contexts.
8.
Towards the end of the render loop, where we normally call the Render method of
our renderers, we will create a System.Threading.Tasks.Task instance for each
render context, which will perform the render logic and then record its SharpDX.
Direct3D11.CommandList value.
Task[] renderTasks = new Task[contextList.Length];
CommandList[] commands = new CommandList[contextList.Length];
for (var i = 0; i < contextList.Length; i++)
{
 
Search WWH ::




Custom Search