DMLCreateDevice function (directml.h)
Creates a DirectML device for a given Direct3D 12 device.
Syntax
HRESULT DMLCreateDevice(
ID3D12Device *d3d12Device,
DML_CREATE_DEVICE_FLAGS flags,
REFIID riid,
void **ppv
);
Parameters
d3d12Device
Type: ID3D12Device*
A pointer to an ID3D12Device representing the Direct3D 12 device to create the DirectML device over. DirectML supports any D3D feature level, and Direct3D 12 devices created on any adapter, including WARP. However, not all features in DirectML may be available depending on the capabilities of the Direct3D 12 device. See IDMLDevice::CheckFeatureSupport for more info.
If the call to DMLCreateDevice is successful, then the DirectML device maintains a strong reference to the supplied Direct3D 12 device.
flags
Type: DML_CREATE_DEVICE_FLAGS
A DML_CREATE_DEVICE_FLAGS value specifying additional device creation options.
riid
Type: REFIID
A reference to the globally unique identifier (GUID) of the interface that you wish to be returned in device. This is expected to be the GUID of IDMLDevice.
ppv
Type: _COM_Outptr_opt_ void**
A pointer to a memory block that receives a pointer to the device. This is the address of a pointer to an IDMLDevice, representing the DirectML device created.
Return value
Type: HRESULT
If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
A newer version of this function, DMLCreateDevice1, was introduced in DirectML version 1.1.0. DMLCreateDevice is equivalent to calling DMLCreateDevice1 and supplying a minimumFeatureLevel of DML_FEATURE_LEVEL_1_0.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10 [desktop apps only] |
Minimum supported server | Windows Server 2016 [desktop apps only] |
Target Platform | Windows |
Header | directml.h |
Library | DirectML.lib |
DLL | DirectML.dll |