Bagikan melalui


Gaming Device Information

Due to differing console capabilities, Universal Windows Platform (UWP) game developers on Xbox need a way to determine the type of console the game is running on, in order to make run-time choices on how to best use the hardware. The Gaming Device Information APIs in <gamingdeviceinformation.h> provide this functionality.

Note

These are Win32 APIs that are supported in both Win32 and UWP apps. While they work on any device family, they are only really of value on Xbox devices.

Example: Allocate memory on startup

This is a simple query example which demonstrates an early call pattern for allocating pool memory that is specialized for the target device.

int init_game(void)
{
    GAMING_DEVICE_MODEL_INFORMATION modelInformation;
    if (FAILED(GetGamingDeviceModelInformation(&amp;modelInformation)))
    {
        // Optionally, allocate a generic memory pool with whatever 
        // the default characteristics are. 
        return 0;
    }

    if (modelInformation.vendorId != GAMING_DEVICE_VENDOR_ID_MICROSOFT)
    {
        return 0;
    }

    if (modelInformation.deviceId == GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X)
    {
        // Allocate pool of memory with appropriate characteristics for 
        // Xbox One X (i.e. write combined, cachable, GPU read-only, etc). 
    }

    if (modelInformation.deviceId == GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X_DEVKIT)
    {
        // Allocate block of tools memory. 
    }

    return 0;
}

[Platform::MTAThread]
int __cdecl main(Platform::Array<Platform::String^>^)
{
    init_game();
    auto direct3DApplicationSource = ref new Direct3DApplicationSource();
    CoreApplication::Run(direct3DApplicationSource);
    return 0;
}

In this section

Topic Description
Enumerations
The Gaming Device Information API contains these enumerations.
Functions
The Gaming Device Information API contains these functions.
Structures
The Gaming Device Information API contains these structures.