Welcome to the Crossfire API sample, which shows how to use the Crossfire API.
Make sure a driver with Crossfire API support is installed and that Crossfire is enabled in Radeon Settings.
If Crossfire is not enabled in Radeon Settings, the extension will not load, and the AGS_DX11_EXTENSION_CROSSFIRE_API flag will not be set.
The sample has a texture/render-target (texture_
) which is updated in every odd frame by rendering into it. On a Crossfire system running in alternate frame rendering (AFR), the rendering will happen only on one GPU and hence the application will exhibit flickering.
The Crossfire API solves this by allowing the developer to mark up the resource for copy.
The Crossfire API consists of three main entry points:
NotifyResourceBeginAllAccess
: Called before the first use of a resource. Ensures a copy is finished at this point.NotifyResourceEndWrites
: Called after the last write access to a resource. After this point, the resource can be copied.NotifyResourceEndAllAccess
: Called after the last read access to a resource. While a resource is being accessed, it cannot be updated from another GPU.Here's an illustration of the process. The boxes indicate frames, the orange area is the time between begin/end any access and the striped region is the time between begin and end write access. The left-hand side is the normal case, where the copy is initiated immediately after the write access has ended so it's available in time on the second GPU.
The right-hand side illustrates why the EndAnyAccess
is needed. Without it, the copy would overwrite the resource while it's still in use on GPU 0. With EndAnyAccess
, it can be properly delayed until GPU 0 is done using it.