AMD GPU Services (AGS)
Classes | Typedefs | Functions | Variables
Device and device object creation and cleanup

It is now mandatory to call agsDriverExtensionsDX12_CreateDevice when creating a device if the user wants to access any future DX12 AMD extensions. The corresponding agsDriverExtensionsDX12_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call. More...

Classes

struct  AGSDX12DeviceCreationParams
 The struct to specify the DX12 device creation parameters. More...
 
struct  AGSDX12ExtensionParams
 The struct to specify DX12 additional device creation parameters. More...
 
struct  AGSDX12ReturnedParams
 The struct to hold all the returned parameters from the device creation call. More...
 

Typedefs

typedef struct AGSDX12DeviceCreationParams AGSDX12DeviceCreationParams
 The struct to specify the DX12 device creation parameters.
 
typedef struct AGSDX12ExtensionParams AGSDX12ExtensionParams
 The struct to specify DX12 additional device creation parameters.
 
typedef struct AGSDX12ReturnedParams AGSDX12ReturnedParams
 The struct to hold all the returned parameters from the device creation call.
 

Functions

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_CreateDevice (AGSContext *context, const AGSDX12DeviceCreationParams *creationParams, const AGSDX12ExtensionParams *extensionParams, AGSDX12ReturnedParams *returnedParams)
 Function used to create a D3D12 device with additional AMD-specific initialization parameters. More...
 
AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DestroyDevice (AGSContext *context, ID3D12Device *device, unsigned int *deviceReferences)
 Function to destroy the D3D12 device. More...
 

Variables

const unsigned int AGS_DX12_SHADER_INTRINSICS_SPACE_ID = 0x7FFF0ADE
 The space id for DirectX12 intrinsic support.
 

Detailed Description

It is now mandatory to call agsDriverExtensionsDX12_CreateDevice when creating a device if the user wants to access any future DX12 AMD extensions. The corresponding agsDriverExtensionsDX12_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call.

Function Documentation

◆ agsDriverExtensionsDX12_CreateDevice()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_CreateDevice ( AGSContext *  context,
const AGSDX12DeviceCreationParams creationParams,
const AGSDX12ExtensionParams extensionParams,
AGSDX12ReturnedParams returnedParams 
)

Function used to create a D3D12 device with additional AMD-specific initialization parameters.

When using the HLSL shader extensions please note:

  • The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION (/Od) option or /O0, otherwise it will not work.
  • The shader compiler needs D3DCOMPILE_ENABLE_STRICTNESS (/Ges) enabled.
  • The intrinsic instructions require a 5.1 shader model.
  • The Root Signature will need to reserve an extra UAV resource slot. This is not a real resource that requires allocating, it is just used to encode the intrinsic instructions.

The easiest way to set up the reserved UAV slot is to specify it at u0. The register space id will automatically be assumed to be AGS_DX12_SHADER_INTRINSICS_SPACE_ID. The HLSL expects this as default and the set up code would look similar to this:

CD3DX12_DESCRIPTOR_RANGE range[];
...
range[ 0 ].Init( D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, AGS_DX12_SHADER_INTRINSICS_SPACE_ID ); // u0 at driver-reserved space id

Newer drivers also support a user-specified slot in which case the register space id is assumed to be 0. It is important that the AGSDX12ReturnedParams::ExtensionsSupported::UAVBindSlot bit is set. to ensure the driver can support this. If not, then u0 and AGS_DX12_SHADER_INTRINSICS_SPACE_ID must be used. If the driver does support this feature and a non zero slot is required, then the HLSL must also define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE as the matching slot value.

Parameters
[in]contextPointer to a context. This is generated by agsInitialize
[in]creationParamsPointer to the struct to specify the existing DX12 device creation parameters.
[in]extensionParamsOptional pointer to the struct to specify DX12 additional device creation parameters.
[out]returnedParamsPointer to struct to hold all the returned parameters from the call.

◆ agsDriverExtensionsDX12_DestroyDevice()

AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DestroyDevice ( AGSContext *  context,
ID3D12Device *  device,
unsigned int *  deviceReferences 
)

Function to destroy the D3D12 device.

This call will also cleanup any AMD-specific driver extensions for D3D12.

Parameters
[in]contextPointer to a context.
[in]devicePointer to the D3D12 device.
[out]deviceReferencesOptional pointer to an unsigned int that will be set to the value returned from device->Release().
AGS_DX12_SHADER_INTRINSICS_SPACE_ID
const unsigned int AGS_DX12_SHADER_INTRINSICS_SPACE_ID
The space id for DirectX12 intrinsic support.
Definition: amd_ags.h:529