ID3D12Device interface (d3d12.h)

Represents a virtual adapter; it is used to create command allocators, command lists, command queues, fences, resources, pipeline state objects, heaps, root signatures, samplers, and many resource views.

Note  This interface was introduced in Windows 10. Applications targetting Windows 10 should use this interface instead of later versions. Applications targetting a later version of Windows 10 should use the appropriate version of the ID3D12Device interface. The latest version of this interface is ID3D12Device3 introduced in Windows 10 Fall Creators Update.
 

Inheritance

The ID3D12Device interface inherits from ID3D12Object. ID3D12Device also has these types of members:

Methods

The ID3D12Device interface has these methods.

 
ID3D12Device::CheckFeatureSupport

Gets information about the features that are supported by the current graphics driver. (ID3D12Device.CheckFeatureSupport)
ID3D12Device::CopyDescriptors

Copies descriptors from a source to a destination. (ID3D12Device.CopyDescriptors)
ID3D12Device::CopyDescriptorsSimple

Copies descriptors from a source to a destination. (ID3D12Device.CopyDescriptorsSimple)
ID3D12Device::CreateCommandAllocator

Creates a command allocator object.
ID3D12Device::CreateCommandList

Creates a command list.
ID3D12Device::CreateCommandQueue

Creates a command queue.
ID3D12Device::CreateCommandSignature

This method creates a command signature.
ID3D12Device::CreateCommittedResource

Creates both a resource and an implicit heap, such that the heap is big enough to contain the entire resource, and the resource is mapped to the heap.
ID3D12Device::CreateComputePipelineState

Creates a compute pipeline state object.
ID3D12Device::CreateConstantBufferView

Creates a constant-buffer view for accessing resource data.
ID3D12Device::CreateDepthStencilView

Creates a depth-stencil view for accessing resource data.
ID3D12Device::CreateDescriptorHeap

Creates a descriptor heap object.
ID3D12Device::CreateFence

Creates a fence object. (ID3D12Device.CreateFence)
ID3D12Device::CreateGraphicsPipelineState

Creates a graphics pipeline state object.
ID3D12Device::CreateHeap

Creates a heap that can be used with placed resources and reserved resources.
ID3D12Device::CreatePlacedResource

Creates a resource that is placed in a specific heap. Placed resources are the lightest weight resource objects available, and are the fastest to create and destroy.
ID3D12Device::CreateQueryHeap

Creates a query heap. A query heap contains an array of queries.
ID3D12Device::CreateRenderTargetView

Creates a render-target view for accessing resource data. (ID3D12Device.CreateRenderTargetView)
ID3D12Device::CreateReservedResource

Creates a resource that is reserved, and not yet mapped to any pages in a heap.
ID3D12Device::CreateRootSignature

Creates a root signature layout.
ID3D12Device::CreateSampler

Create a sampler object that encapsulates sampling information for a texture.
ID3D12Device::CreateShaderResourceView

Creates a shader-resource view for accessing data in a resource. (ID3D12Device.CreateShaderResourceView)
ID3D12Device::CreateSharedHandle

Creates a shared handle to a heap, resource, or fence object.
ID3D12Device::CreateUnorderedAccessView

Creates a view for unordered accessing.
ID3D12Device::Evict

Enables the page-out of data, which precludes GPU access of that data.
ID3D12Device::GetAdapterLuid

Gets a locally unique identifier for the current device (adapter).
ID3D12Device::GetCopyableFootprints

Gets a resource layout that can be copied. Helps the app fill-in D3D12_PLACED_SUBRESOURCE_FOOTPRINT and D3D12_SUBRESOURCE_FOOTPRINT when suballocating space in upload heaps.
ID3D12Device::GetCustomHeapProperties

Divulges the equivalent custom heap properties that are used for non-custom heap types, based on the adapter's architectural properties.
ID3D12Device::GetDescriptorHandleIncrementSize

Gets the size of the handle increment for the given type of descriptor heap. This value is typically used to increment a handle into a descriptor array by the correct amount.
ID3D12Device::GetDeviceRemovedReason

Gets the reason that the device was removed.
ID3D12Device::GetNodeCount

Reports the number of physical adapters (nodes) that are associated with this device.
ID3D12Device::GetResourceAllocationInfo

Gets the size and alignment of memory required for a collection of resources on this adapter.
ID3D12Device::GetResourceTiling

Gets info about how a tiled resource is broken into tiles. (ID3D12Device.GetResourceTiling)
ID3D12Device::MakeResident

Makes objects resident for the device.
ID3D12Device::OpenSharedHandle

Opens a handle for shared resources, shared heaps, and shared fences, by using HANDLE and REFIID.
ID3D12Device::OpenSharedHandleByName

Opens a handle for shared resources, shared heaps, and shared fences, by using Name and Access.
ID3D12Device::SetStablePowerState

A development-time aid for certain types of profiling and experimental prototyping.

Remarks

Use D3D12CreateDevice to create a device.

For Windows 10 Anniversary some additional functionality is available through ID3D12Device1.

Examples

The D3D1211on12 sample uses ID3D12Device as follows:

Header file declarations.

// Pipeline objects.
D3D12_VIEWPORT m_viewport;
ComPtr<IDXGISwapChain3> m_swapChain;
ComPtr<ID3D12Device> m_device;
ComPtr<ID3D12Resource> m_renderTargets[FrameCount];
ComPtr<ID3D12Resource> m_depthStencil;
ComPtr<ID3D12CommandAllocator> m_commandAllocator;
ComPtr<ID3D12GraphicsCommandList> m_commandList;
ComPtr<ID3D12CommandQueue> m_commandQueue;
ComPtr<ID3D12RootSignature >m_rootSignature;
ComPtr<ID3D12DescriptorHeap> m_rtvHeap;
ComPtr<ID3D12DescriptorHeap> m_cbvSrvHeap;
ComPtr<ID3D12DescriptorHeap> m_dsvHeap;
ComPtr<ID3D12DescriptorHeap> m_samplerHeap;
ComPtr<ID3D12PipelineState> m_pipelineState1;
ComPtr<ID3D12PipelineState> m_pipelineState2;
D3D12_RECT m_scissorRect;

Checking supported features.

inline UINT8 D3D12GetFormatPlaneCount(
    _In_ ID3D12Device* pDevice,
    DXGI_FORMAT Format
    )
{
    D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format};
    if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo))))
    {
        return 0;
    }
    return formatInfo.PlaneCount;
}

Refer to the Example Code in the D3D12 Reference.

Requirements

Requirement Value
Target Platform Windows
Header d3d12.h

See also

Core Interfaces

Creating Descriptors

ID3D12Device1

ID3D12Device2

ID3D12Object

Memory Management in Direct3D 12