AMD GPU Services (AGS)
Functions
Multi Draw Indirect (MDI)

API for dispatching multiple instanced draw commands. The multi draw indirect extensions allow multiple sets of DrawInstancedIndirect to be submitted in one API call. The draw calls are issued on the GPU's command processor (CP), potentially saving the significant CPU overheads incurred by submitting the equivalent draw calls on the CPU. More...

Functions

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect (AGSContext *context, ID3D11DeviceContext *dxContext, unsigned int drawCount, ID3D11Buffer *pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs)
 Function used to submit a batch of draws via MultiDrawIndirect. More...
 
AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect (AGSContext *context, ID3D11DeviceContext *dxContext, unsigned int drawCount, ID3D11Buffer *pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs)
 Function used to submit a batch of draws via MultiDrawIndirect. More...
 
AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect (AGSContext *context, ID3D11DeviceContext *dxContext, ID3D11Buffer *pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer *pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs)
 Function used to submit a batch of draws via MultiDrawIndirect. More...
 
AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect (AGSContext *context, ID3D11DeviceContext *dxContext, ID3D11Buffer *pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer *pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs)
 Function used to submit a batch of draws via MultiDrawIndirect. More...
 

Detailed Description

API for dispatching multiple instanced draw commands. The multi draw indirect extensions allow multiple sets of DrawInstancedIndirect to be submitted in one API call. The draw calls are issued on the GPU's command processor (CP), potentially saving the significant CPU overheads incurred by submitting the equivalent draw calls on the CPU.

The extension allows the following code:

// Submit n batches of DrawIndirect calls
for ( int i = 0; i < n; i++ )
deviceContext->DrawIndexedInstancedIndirect( buffer, i * sizeof( cmd ) );

To be replaced by the following call:

// Submit all n batches in one call
agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( m_agsContext, deviceContext, n, buffer, 0, sizeof( cmd ) );

The buffer used for the indirect args must be of the following formats:

// Buffer layout for agsDriverExtensions_MultiDrawInstancedIndirect
struct DrawInstancedIndirectArgs
{
UINT VertexCountPerInstance;
UINT InstanceCount;
UINT StartVertexLocation;
UINT StartInstanceLocation;
};
// Buffer layout for agsDriverExtensions_MultiDrawIndexedInstancedIndirect
struct DrawIndexedInstancedIndirectArgs
{
UINT IndexCountPerInstance;
UINT InstanceCount;
UINT StartIndexLocation;
UINT BaseVertexLocation;
UINT StartInstanceLocation;
};

Example usage can be seen in AMD's GeometryFX (https://github.com/GPUOpen-Effects/GeometryFX). In particular, in this file: https://github.com/GPUOpen-Effects/GeometryFX/blob/master/amd_geometryfx/src/AMD_GeometryFX_Filtering.cpp

Function Documentation

◆ agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect ( AGSContext *  context,
ID3D11DeviceContext *  dxContext,
unsigned int  drawCount,
ID3D11Buffer *  pBufferForArgs,
unsigned int  alignedByteOffsetForArgs,
unsigned int  byteStrideForArgs 
)

Function used to submit a batch of draws via MultiDrawIndirect.

Parameters
[in]contextPointer to a context.
[in]dxContextPointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed.
[in]drawCountThe number of draws.
[in]pBufferForArgsThe args buffer.
[in]alignedByteOffsetForArgsThe offset into the args buffer.
[in]byteStrideForArgsThe per element stride of the args buffer.

◆ agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect ( AGSContext *  context,
ID3D11DeviceContext *  dxContext,
ID3D11Buffer *  pBufferForDrawCount,
unsigned int  alignedByteOffsetForDrawCount,
ID3D11Buffer *  pBufferForArgs,
unsigned int  alignedByteOffsetForArgs,
unsigned int  byteStrideForArgs 
)

Function used to submit a batch of draws via MultiDrawIndirect.

Parameters
[in]contextPointer to a context.
[in]dxContextPointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed.
[in]pBufferForDrawCountThe draw count buffer.
[in]alignedByteOffsetForDrawCountThe offset into the draw count buffer.
[in]pBufferForArgsThe args buffer.
[in]alignedByteOffsetForArgsThe offset into the args buffer.
[in]byteStrideForArgsThe per element stride of the args buffer.

◆ agsDriverExtensionsDX11_MultiDrawInstancedIndirect()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect ( AGSContext *  context,
ID3D11DeviceContext *  dxContext,
unsigned int  drawCount,
ID3D11Buffer *  pBufferForArgs,
unsigned int  alignedByteOffsetForArgs,
unsigned int  byteStrideForArgs 
)

Function used to submit a batch of draws via MultiDrawIndirect.

Parameters
[in]contextPointer to a context.
[in]dxContextPointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed.
[in]drawCountThe number of draws.
[in]pBufferForArgsThe args buffer.
[in]alignedByteOffsetForArgsThe offset into the args buffer.
[in]byteStrideForArgsThe per element stride of the args buffer.

◆ agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect ( AGSContext *  context,
ID3D11DeviceContext *  dxContext,
ID3D11Buffer *  pBufferForDrawCount,
unsigned int  alignedByteOffsetForDrawCount,
ID3D11Buffer *  pBufferForArgs,
unsigned int  alignedByteOffsetForArgs,
unsigned int  byteStrideForArgs 
)

Function used to submit a batch of draws via MultiDrawIndirect.

Parameters
[in]contextPointer to a context.
[in]dxContextPointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed.
[in]pBufferForDrawCountThe draw count buffer.
[in]alignedByteOffsetForDrawCountThe offset into the draw count buffer.
[in]pBufferForArgsThe args buffer.
[in]alignedByteOffsetForArgsThe offset into the args buffer.
[in]byteStrideForArgsThe per element stride of the args buffer.
agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect
AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect(AGSContext *context, ID3D11DeviceContext *dxContext, unsigned int drawCount, ID3D11Buffer *pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs)
Function used to submit a batch of draws via MultiDrawIndirect.