Do Not Force Unnecessary Synchronisation

Avoid API functionality that could stall the graphics pipeline, and do not access any hardware buffer directly.

Avoid API functionality that could stall the graphics pipeline, and do not access any hardware buffer directly.

Graphics applications achieve the best performance when the CPU and graphics core tasks run in parallel. Graphics cores also operate most efficiently when the vertex-processing tasks of one frame are processed in parallel to the fragment-colouring tasks of previous frames. When an application issues a command that causes the CPU to interrupt the graphics core, it can significantly reduce performance.

The most efficient way for the hardware to schedule tasks is vertex processing executing in parallel to fragment tasks. To achieve this, the application should aim to remove functions which cause synchronisation between the CPU and graphics core wherever possible.

  • In OpenGL ES - synchronisation functions such as glReadPixels , glFinish , eglClientWaitSync and glWaitSync.
  • In Vulkan® - there is much finer control over synchronisation between resources, as any synchronisation between the graphics processor and CPU is defined by the developer.

One of the most common causes of poor application performance is when the application accesses the contents of a frame buffer from the CPU. When such an operation is issued, the calling application's CPU thread must stall until the graphics core has finished rendering into the frame buffer attachment. Once the render is complete, the CPU can begin reading data from the attachment. During this time, the graphics core will not have write access to that attachment, which can cause the graphics core to stall subsequent renders to that frame buffer.

Due to the severe cost, these operations should only be used when absolutely necessary - for example to capture a screenshot of a game when a player requests one.