567
presents a unique set of optimization challenges to the programmer. As a re-
sult, some animation pipeline APIs are highly specifi c to a particular platform.
Other pipelines att empt to present an API that can be optimized in diff erent
ways on diff erent processors. Let’s take a look at a few examples.
11.10.5.1. Optimization on the PlayStation 2
The PlayStation 2 has a region of ultra-fast memory known as the scratch pad.
It also has a fast direct memory access (DMA) controller, which is capable of
copying data to and from the scratch pad effi ciently. Some animation pipelines
take advantage of this hardware architecture by arranging for all animation
blending to take place within the scratch pad. When two skeletal poses are to
be blended, they are DMA’d from main RAM to the scratch pad. The blend is
performed, and the result is writt en into another buff er within the scratch pad.
Finally, the resulting pose is DMA’d back into main RAM.
The PS2’s DMA controller can move memory around in parallel with the
main CPU. So, to maximize throughput, PS2 programmers are always look-
ing for ways to keep the CPU and the DMA controller busy simultaneously.
Oft en the best way to accomplish this is to use a batch-style API, where the
game queues up requests for animation blends in a big list and then kicks
everything off in one go. This permits the animation pipeline to maximize
the utilization of both the DMA controller and the CPU, because it can feed
a large number of pose requests through the pipeline with no “dead space”
between them and even overlap the DMA of one request with the processing
of an unrelated request.
11.10.5.2. Optimization on the PLAYSTATION 3
As we saw in Section 7.6.1.2, the PLAYSTATION 3 has six specialized proces-
sors known as synergistic processing units (SPU). The SPUs execute most code
much more quickly than the main CPU (known as the power processing unit or
PPU). Each SPU also has a 256 kB region of ultra-fast local store memory for its
exclusive use. Like the PS2, the PS3 has a powerful DMA controller capable
of moving memory back and forth between main RAM and the SPUs’ memo-
ries in parallel with computing tasks. If one could write an ideal animation
pipeline for the PS3, as much processing as possible would be executed on
the SPUs, and neither the PPU nor any SPU would ever be idle waiting for a
DMA to complete.
This architecture leads to animation pipeline APIs that look similar in
some respects to their PlayStation 2 counterparts, in the sense that animation
requests are again batched so that they can be interleaved effi ciently. In ad-
dition, a PLAYSTATION 3 animation API will usually expose the concept of
animation jobs, because a job is a fundamental unit of execution on the SPUs.
11.10. The Animation Pipeline