DirectX Graphics API Documentation

D3D12CreateDevice

Creates a Direct3D 12 device.

Syntax

HRESULT D3D12CreateDevice(
  IUnknown *pAdapter,
  D3D_FEATURE_LEVEL FeatureLevel,
  REFIID riid,
  void **ppDevice
);
                

Parameters

  • pAdapter: Pointer to an instance of the hardware adapter to use for creating the device.
  • FeatureLevel: The minimum feature level that the created device must support.
  • riid: Globally unique identifier (GUID) for the device interface.
  • ppDevice: Pointer to a memory block that receives a pointer to the Direct3D 12 device.

Return value

  • S_OK if the device was created successfully.
  • E_INVALIDARG if parameters were invalid.
  • DXGI_ERROR_UNSUPPORTED if the requested feature level is not supported.
  • Other DXGI error codes.

Remarks

This function creates a device object, which represents the display adapter. A device object is the primary object for interacting with the graphics hardware. The device object is used to create other Direct3D 12 objects, such as command queues, command allocators, command lists, and resources.

Requirements

Header d3d12.h
Library d3d12.lib
Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Target platforms Windows

See Also