Skip to content

Commit b038321

Browse files
committed
Update AGS_SDK for 5.0 release
1 parent 0113fe2 commit b038321

File tree

5 files changed

+215
-270
lines changed

5 files changed

+215
-270
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
**Note:** See `ags_lib\CHANGELOG.md` for changes to the core AGS library.
44

5+
### v5.0.5 - 2016-12-07
6+
* Update samples for latest AGS API
7+
58
### v4.0.3 - 2016-08-18
69
* Fix up crossfire_sample for latest AGS API
710

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AMD AGS SDK
22
![AMD AGS SDK](http://gpuopen-librariesandsdks.github.io/media/amd_logo_black.png)
33

4-
The AMD GPU Services (AGS) library provides software developers with the ability to query AMD GPU software and hardware state information that is not normally available through standard operating systems or graphic APIs. Version 4.0 of the library includes support for querying graphics driver version info, GPU performance, Crossfire™ (AMD's multi-GPU rendering technology) configuration info, and Eyefinity (AMD's multi-display rendering technology) configuration info. AGS also exposes the explicit Crossfire API extension, GCN shader extensions, and additional extensions supported in the AMD drivers for DirectX 11 and DirectX 12.
4+
The AMD GPU Services (AGS) library provides software developers with the ability to query AMD GPU software and hardware state information that is not normally available through standard operating systems or graphic APIs. AGS includes support for querying graphics driver version info, GPU performance, Crossfire™ (AMD's multi-GPU rendering technology) configuration info, and Eyefinity (AMD's multi-display rendering technology) configuration info. AGS also exposes the explicit Crossfire API extension, GCN shader extensions, and additional extensions supported in the AMD drivers for DirectX 11 and DirectX 12. Version 5.0 adds support for HDR displays.
55

66
In addition to the library itself, the AGS SDK includes several samples to demonstrate use of the library.
77

@@ -10,24 +10,26 @@ In addition to the library itself, the AGS SDK includes several samples to demon
1010
</div>
1111

1212
### What's new in AGS
13-
AGS now returns a lot more information from the GPU in addition to exposing the explicit Crossfire API and other extensions for DirectX 11. Version 4.0 also exposes GCN shader extensions for both DirectX 11 and DirectX 12. Highlights include the following:
14-
15-
* The initialization function can now return information about the GPU:
16-
* Whether the GPU is GCN or not
17-
* The adapter string and device id
18-
* The driver version is now rolled into this structure instead of a separate function call
19-
* Performance metrics such as the number of compute units and clock speeds
20-
* New explicit Crossfire API
21-
* Provides the ability to control resource transfers between GPUs in Crossfire configuration in DirectX 11
22-
* Allows improved performance in multi-GPU configurations
23-
* New GCN shader extension support
24-
* DirectX 11 and DirectX 12
25-
* Requires Radeon Software Crimson Edition 16.9.1 (driver version 16.40) or later
26-
* AGS provides access to additional extensions available in the AMD driver for DirectX 11:
13+
Version 5.0 is a major overhaul of the library designed to provide a much clearer view of the GPUs in the system and the displays attached to them. It also exposes the ability to query each display for HDR capabilities and put those HDR-capable displays into various HDR modes.
14+
15+
Highlights include the following:
16+
* Full GPU enumeration with adapter string, device id, revision id and vendor id.
17+
* Per-GPU display enumeration including information on display name, resolution, and HDR capabilities.
18+
* Optional user-supplied memory allocator.
19+
* Function to set displays into HDR mode.
20+
* DirectX 11 shader compiler controls.
21+
* DirectX 11 multiview extension.
22+
* DirectX 11 Crossfire API updates.
23+
* Now supports using the API without needing a driver profile.
24+
* You can also now specify the transfer engine.
25+
26+
### Driver extensions
27+
AGS exposes GCN shader extensions for both DirectX 11 and DirectX 12. It also provides access to additional extensions available in the AMD driver for DirectX 11:
2728
* Quad List primitive type
2829
* UAV overlap
2930
* Depth bounds test
3031
* Multi-draw indirect
32+
* Multiview
3133

3234
### Prerequisites
3335
* AMD Radeon&trade; GCN-based GPU (HD 7000 series or newer)

ags_sample/src/AGSSample.cpp

Lines changed: 90 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -33,69 +33,104 @@
3333
#include <amd_ags.h>
3434

3535

36-
#pragma warning( disable : 4100 ) // disable unreference formal parameter warnings for /W4 builds
3736

38-
void GetEyefinityInfo( AGSContext* context, int primaryDisplayIndex )
37+
const char* getVendorName( int vendorId )
3938
{
40-
int numDisplaysInfo = 0;
39+
switch ( vendorId )
40+
{
41+
case 0x1002: return "AMD";
42+
case 0x8086: return "INTEL";
43+
case 0x10DE: return "NVIDIA";
44+
default: return "unknown";
45+
}
46+
}
47+
4148

42-
// Query the number of displays first
43-
if ( agsGetEyefinityConfigInfo( context, primaryDisplayIndex, nullptr, &numDisplaysInfo, nullptr ) == AGS_SUCCESS && numDisplaysInfo > 0 )
49+
void PrintDisplayInfo( const AGSGPUInfo& gpuInfo )
50+
{
51+
for ( int gpuIndex = 0; gpuIndex < gpuInfo.numDevices; gpuIndex++ )
4452
{
45-
AGSEyefinityInfo eyefinityInfo = {};
46-
AGSDisplayInfo* displaysInfo = new AGSDisplayInfo[ numDisplaysInfo ];
47-
ZeroMemory( displaysInfo, numDisplaysInfo * sizeof( *displaysInfo ) );
53+
const AGSDeviceInfo& device = gpuInfo.devices[ gpuIndex ];
54+
55+
printf( "\n---------- Device %d%s, %s\n", gpuIndex, device.isPrimaryDevice ? " [primary]" : "", device.adapterString );
56+
57+
printf( "Vendor id: 0x%04X (%s)\n", device.vendorId, getVendorName( device.vendorId ) );
58+
printf( "Device id: 0x%04X\n", device.deviceId );
59+
printf( "Revision id: 0x%04X\n\n", device.revisionId );
4860

49-
// Find out if this display has an Eyefinity config enabled
50-
if ( agsGetEyefinityConfigInfo( context, primaryDisplayIndex, &eyefinityInfo, &numDisplaysInfo, displaysInfo ) == AGS_SUCCESS )
61+
if ( device.vendorId == 0x1002 )
5162
{
52-
if ( eyefinityInfo.iSLSActive )
53-
{
54-
printf( "Eyefinity enabled for display index %d:\n", primaryDisplayIndex );
55-
printf( " SLS grid is %d displays wide by %d displays tall\n", eyefinityInfo.iSLSGridWidth, eyefinityInfo.iSLSGridHeight );
56-
printf( " SLS resolution is %d x %d pixels\n", eyefinityInfo.iSLSWidth, eyefinityInfo.iSLSHeight );
57-
58-
if ( eyefinityInfo.iBezelCompensatedDisplay )
59-
{
60-
printf( " SLS is bezel-compensated\n" );
61-
}
62-
63-
for ( int i = 0; i < numDisplaysInfo; i++ )
64-
{
65-
printf( "Display %d\n", i );
66-
67-
if ( displaysInfo[ i ].iPreferredDisplay )
68-
{
69-
printf( " Preferred/main monitor\n" );
70-
}
71-
72-
printf( " SLS grid coord [%d,%d]\n", displaysInfo[i].iGridXCoord, displaysInfo[i].iGridYCoord );
73-
printf( " Base coord [%d,%d]\n", displaysInfo[i].displayRect.iXOffset, displaysInfo[i].displayRect.iYOffset );
74-
printf( " Dimensions [%d x %d]\n", displaysInfo[i].displayRect.iWidth, displaysInfo[i].displayRect.iHeight );
75-
printf( " Visible base coord [%d,%d]\n", displaysInfo[i].displayRectVisible.iXOffset, displaysInfo[i].displayRectVisible.iYOffset );
76-
printf( " Visible dimensions [%d x %d]\n", displaysInfo[i].displayRectVisible.iWidth, displaysInfo[i].displayRectVisible.iHeight );
77-
}
78-
}
79-
else
63+
printf( "Is %sGCN, %d CUs, core clock %d MHz, memory clock %d MHz, %.1f Tflops\n", device.architectureVersion == AGSDeviceInfo::ArchitectureVersion_GCN ? "" : "not ", device.numCUs, device.coreClock, device.memoryClock, device.teraFlops );
64+
printf( "local memory: %d MBs\n\n", (int)( device.localMemoryInBytes / ( 1024 * 1024 ) ) );
65+
}
66+
67+
printf( "\n" );
68+
69+
if ( device.eyefinityEnabled )
70+
{
71+
printf( "SLS grid is %d displays wide by %d displays tall\n", device.eyefinityGridWidth, device.eyefinityGridHeight );
72+
printf( "SLS resolution is %d x %d pixels\n", device.eyefinityResolutionX, device.eyefinityResolutionY );
73+
74+
if ( device.eyefinityBezelCompensated )
8075
{
81-
printf( "Eyefinity not enabled for display index %d\n", primaryDisplayIndex );
76+
printf( " SLS is bezel-compensated\n" );
8277
}
8378
}
8479
else
8580
{
86-
printf( "Eyefinity configuration query failed to get display info for display index %d\n", primaryDisplayIndex );
81+
printf( "Eyefinity not enabled on this device\n" );
8782
}
8883

89-
delete[] displaysInfo;
90-
}
91-
else
92-
{
93-
printf( "Eyefinity configuration query failed to get number of displays for display index %d\n", primaryDisplayIndex );
84+
printf( "\n" );
85+
86+
for ( int i = 0; i < device.numDisplays; i++ )
87+
{
88+
const AGSDisplayInfo& display = device.displays[ i ];
89+
90+
printf( "\t---------- Display %d %s----------------------------------------\n", i, display.displayFlags & AGS_DISPLAYFLAG_PRIMARY_DISPLAY ? "[primary]" : "---------" );
91+
92+
printf( "\tdevice name: %s\n", display.displayDeviceName );
93+
printf( "\tmonitor name: %s\n\n", display.name );
94+
95+
printf( "\tMax resolution: %d x %d, %.1f Hz\n", display.maxResolutionX, display.maxResolutionY, display.maxRefreshRate );
96+
printf( "\tCurrent resolution: %d x %d, Offset (%d, %d), %.1f Hz\n", display.currentResolution.width, display.currentResolution.height, display.currentResolution.offsetX, display.currentResolution.offsetY, display.currentRefreshRate );
97+
printf( "\tVisible resolution: %d x %d, Offset (%d, %d)\n\n", display.visibleResolution.width, display.visibleResolution.height, display.visibleResolution.offsetX, display.visibleResolution.offsetY );
98+
99+
printf( "\tchromaticity red: %f, %f\n", display.chromaticityRedX, display.chromaticityRedY );
100+
printf( "\tchromaticity green: %f, %f\n", display.chromaticityGreenX, display.chromaticityGreenY );
101+
printf( "\tchromaticity blue: %f, %f\n", display.chromaticityBlueX, display.chromaticityBlueY );
102+
printf( "\tchromaticity white point: %f, %f\n\n", display.chromaticityWhitePointX, display.chromaticityWhitePointY );
103+
104+
printf( "\tluminance: [min, max, avg] %f, %f, %f\n", display.minLuminance, display.maxLuminance, display.avgLuminance );
105+
106+
printf( "\tscreen reflectance diffuse %f\n", display.screenDiffuseReflectance );
107+
printf( "\tscreen reflectance specular %f\n\n", display.screenSpecularReflectance );
108+
109+
if ( display.displayFlags & AGS_DISPLAYFLAG_HDR10 )
110+
printf( "\tHDR10 supported\n" );
111+
112+
if ( display.displayFlags & AGS_DISPLAYFLAG_DOLBYVISION )
113+
printf( "\tDolby Vision supported\n" );
114+
115+
printf( "\n" );
116+
117+
if ( display.displayFlags & AGS_DISPLAYFLAG_EYEFINITY_IN_GROUP )
118+
{
119+
printf( "\tEyefinity Display [%s mode] %s\n", display.displayFlags & AGS_DISPLAYFLAG_EYEFINITY_IN_PORTRAIT_MODE ? "portrait" : "landscape", display.displayFlags & AGS_DISPLAYFLAG_EYEFINITY_PREFERRED_DISPLAY ? " (preferred display)" : "" );
120+
121+
printf( "\tGrid coord %d x %d\n", display.eyefinityGridCoordX, display.eyefinityGridCoordY );
122+
}
123+
124+
printf( "\tlogical display index: %d\n", display.logicalDisplayIndex );
125+
printf( "\tADL adapter index: %d\n\n", display.adlAdapterIndex );
126+
127+
printf( "\n" );
128+
}
94129
}
95130
}
96131

97132

98-
int main(int argc, char* argv[])
133+
int main(int , char**)
99134
{
100135
// Enable run-time memory check for debug builds.
101136
// (When _DEBUG is not defined, calls to _CrtSetDbgFlag are removed during preprocessing.)
@@ -104,59 +139,29 @@ int main(int argc, char* argv[])
104139
AGSContext* agsContext = nullptr;
105140

106141
int displayIndex = 0;
107-
int primaryDisplayIndex = 0;
108142
DISPLAY_DEVICEA displayDevice;
109143
displayDevice.cb = sizeof( displayDevice );
110144
while ( EnumDisplayDevicesA( 0, displayIndex, &displayDevice, 0 ) )
111145
{
112-
if ( displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE )
113-
{
114-
primaryDisplayIndex = displayIndex;
115-
}
116-
117-
//printf( "Display Device: %d %s %s\n", displayIndex, displayDevice.DeviceString, displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE ? "(primary)" : "" );
118-
146+
printf( "Display Device: %d: %s, %s %s%s\n", displayIndex, displayDevice.DeviceString, displayDevice.DeviceName, displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE ? "(primary)" : "", displayDevice.StateFlags & DISPLAY_DEVICE_ACTIVE ? "" : " [disabled]" );
119147
displayIndex++;
120148
}
121149

122150
AGSGPUInfo gpuInfo;
123-
if ( agsInit( &agsContext, nullptr, &gpuInfo ) == AGS_SUCCESS )
151+
152+
AGSConfiguration config = {};
153+
config.crossfireMode = AGS_CROSSFIRE_MODE_EXPLICIT_AFR;
154+
155+
if ( agsInit( &agsContext, &config, &gpuInfo ) == AGS_SUCCESS )
124156
{
125-
printf( "AGS Library initialized: v%d.%d.%d\n\n", gpuInfo.agsVersionMajor, gpuInfo.agsVersionMinor, gpuInfo.agsVersionPatch );
157+
printf( "\nAGS Library initialized: v%d.%d.%d\n", gpuInfo.agsVersionMajor, gpuInfo.agsVersionMinor, gpuInfo.agsVersionPatch );
158+
printf( "Is%s WACK compliant for use in UWP apps\n", gpuInfo.isWACKCompliant ? "" : " *not*" );
126159
printf( "-----------------------------------------------------------------\n" );
127160

128-
printf( "%s, device id: 0x%04X, revision id: 0x%02X\n", gpuInfo.adapterString ? gpuInfo.adapterString : "unknown GPU", gpuInfo.deviceId, gpuInfo.revisionId );
129161
printf( "Radeon Software Version: %s\n", gpuInfo.radeonSoftwareVersion );
130162
printf( "Driver Version: %s\n", gpuInfo.driverVersion );
131163
printf( "-----------------------------------------------------------------\n" );
132164

133-
printf( "Is %sGCN, %d CUs, core clock %d MHz, memory clock %d MHz, %.1f Tflops\n", gpuInfo.architectureVersion == AGSGPUInfo::ArchitectureVersion_GCN ? "" : "not ", gpuInfo.iNumCUs, gpuInfo.iCoreClock, gpuInfo.iMemoryClock, gpuInfo.fTFlops );
134-
135-
int totalGPUs = 0;
136-
if ( agsGetTotalGPUCount( agsContext, &totalGPUs ) == AGS_SUCCESS )
137-
{
138-
printf( "Total system GPU count = %d\n", totalGPUs );
139-
140-
for ( int i = 0; i < totalGPUs; i++ )
141-
{
142-
long long memory = 0;
143-
if ( agsGetGPUMemorySize( agsContext, i, &memory ) == AGS_SUCCESS )
144-
{
145-
printf( "GPU %d Memory: %dMBs\n", i, (int)(memory / (1024*1024)) );
146-
}
147-
else
148-
{
149-
printf( "Failed to get memory size from GPU %d\n", i );
150-
}
151-
}
152-
153-
printf( "-----------------------------------------------------------------\n" );
154-
}
155-
else
156-
{
157-
printf( "Failed to get total GPU count\n" );
158-
}
159-
160165
int numCrossfireGPUs = 0;
161166
if ( agsGetCrossfireGPUCount( agsContext, &numCrossfireGPUs ) == AGS_SUCCESS )
162167
{
@@ -168,7 +173,7 @@ int main(int argc, char* argv[])
168173
printf( "Failed to get Crossfire GPU count\n" );
169174
}
170175

171-
GetEyefinityInfo( agsContext, primaryDisplayIndex );
176+
PrintDisplayInfo( gpuInfo );
172177
printf( "-----------------------------------------------------------------\n" );
173178

174179
if ( agsDeInit( agsContext ) != AGS_SUCCESS )

crossfire_sample/src/CFXAPISample.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void CFXAPISample::InitializeAMDAGS()
206206
{
207207
// the desired Crossfire mode needs to be passed to agsInit
208208
// prior to device creation
209-
AGSConfiguration config;
209+
AGSConfiguration config = {};
210210
config.crossfireMode = AGS_CROSSFIRE_MODE_EXPLICIT_AFR;
211211
agsInit (&agsContext_, &config, nullptr );
212212
}
@@ -277,7 +277,7 @@ void CFXAPISample::Initialize ()
277277
// as the updated version is not transfered to the second GPU.
278278
// With TransferApp1StepP2P, the Crossfire API will copy the
279279
// data to the second GPU.
280-
AGS_AFR_TRANSFER_1STEP_P2P);
280+
AGS_AFR_TRANSFER_1STEP_P2P, AGS_AFR_TRANSFERENGINE_DEFAULT);
281281
} else {
282282
device_->CreateTexture2D (&textureDesc, nullptr, &texture_);
283283
}

0 commit comments

Comments
 (0)