Game Development Reference
In-Depth Information
this location. The animation task execution time drops to 5.92 ms, and the wall
time drops from 2.89 ms to 2.2 ms or about a 20% improvement in frame time
(see Figure17.6 ).RunningTGEwithoutGPAshows3.53msperframewiththe
allocations versus 3.38 ms without, or a 4.2% improvement in frame time. The
difference is attributable to the logging overhead of GPA. Using GPA helps focus
on opportunities to improve performance, but it is dicult to predict the absolute
improvement.
17.3.6 Animation and Rendering Task Set Scheduling
The next step is rendering. The thread-based implementation usuallys involve
waiting on the animation system before generating D3D11 command lists 2 .Inthe
task-based approach, waiting for the animation taskset to complete before creating
the render taskset will result in idle worker time waiting for the main thread to
create the render taskset. Creating the render taskset right after the animation
tasksets, specifying the animation taskset as a dependency, will achieve the fastest
possible scheduling for both tasksets. The animation taskset starts immediately
upon creation, and the rendering taskset starts as soon as the animation taskset
completes without intervention from the main thread.
// During OnFrameMove function
gTaskMgr.CreateTaskSet(
AnimateModels ,
&gAnimationInfo ,
guModels,
NULL,
0,
"Animate Models",
&hAnimationSet );
// During D3D11OnFrameRender function
gTaskMgr.CreateTaskSet(
RenderModels ,
&gRenderInfo,
guTasksPerSet ,
&ghAnimationSet ,
1,
"Render Models",
&hRenderSet );
2 The D3D11 API is available on Windows Vista and above for D3D9 hardware. D3D11 allows
command lists to be created on multiple threads and requires their submission on the main thread.
For games that ship on Windows XP, a slightly more complex solution is possible. DX9 does not
have command lists and allows only single-threaded rendering. The game can implement a simple
token scheme and using a taskset to generate the tokens for each of the draw calls in your frame.
With such token lists, the main thread can submit the D3D9 frame similarly to how it does this on
D3D11, and the game should get similar performance benefits relative to single-threaded D3D11
drivers.
Search WWH ::




Custom Search