6.3.3 Compute values per frame

If your application requires continuous updates of data elements and there are dependencies between them, try breaking the computations into discrete units and perform one iteration per image frame displayed.

For example, the following figure shows an application that runs a continuous physics simulation of a flag.

Figure 6-1 Flag simulation
Flag simulation

The flag is made up of a grid of nodes that are connected to the neighboring nodes. These nodes are shown in the following figure.

Figure 6-2 Flag simulation grid
Flag simulation grid

The simulation runs as a series of iterations. In one iteration, all the nodes are updated and the image is redrawn.

The following operations are performed in each iteration:

  1. The node values are read from a buffer A.
  2. A physics simulation computes the forces between the nodes.
  3. The position and forces on the nodes are updated and stored into buffer B.
  4. The flag image is drawn.
  5. Buffer A and buffer B are switched.

In this case, splitting the computations into iterations also splits the dependencies. The data required for one frame is computed in the previous frame.

Some types of simulation require many iterations for relatively small movements. If this is the case, try computing multiple iterations before drawing frames.

Non-ConfidentialPDF file icon PDF version101574_0302_00_en
Copyright © 2019 Arm Limited or its affiliates. All rights reserved.