ID3D12Device interface

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  The latest version of this interface is ID3D12Device2 introduced in the Windows 10 Creators Update. Applications targetting Windows 10 Creators Update should use the ID3D12Device2 interface instead of ID3D12Device.
 

Members

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

Methods

The ID3D12Device interface has these methods.

MethodDescription
CheckFeatureSupport

Gets information about the features that are supported by the current graphics driver.

CopyDescriptors

Copies descriptors from a source to a destination.

CopyDescriptorsSimple

Copies descriptors from a source to a destination.

CreateCommandAllocator

Creates a command allocator object.

CreateCommandList

Creates a command list.

CreateCommandQueue

Creates a command queue.

CreateCommandSignature

This method creates a command signature.

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.

CreateComputePipelineState

Creates a compute pipeline state object.

CreateConstantBufferView

Creates a constant-buffer view for accessing resource data.

CreateDepthStencilView

Creates a depth-stencil view for accessing resource data.

CreateDescriptorHeap

Creates a descriptor heap object.

CreateFence

Creates a fence object.

CreateGraphicsPipelineState

Creates a graphics pipeline state object.

CreateHeap

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

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.

CreateQueryHeap

Creates a query heap. A query heap contains an array of queries.

CreateRenderTargetView

Creates a render-target view for accessing resource data.

CreateReservedResource

Creates a resource that is reserved, which is not yet mapped to any pages in a heap.

CreateRootSignature

Creates a root signature layout.

CreateSampler

Create a sampler object that encapsulates sampling information for a texture.

CreateShaderResourceView

Creates a shader-resource view for accessing data in a resource.

CreateSharedHandle

Creates a shared handle to an heap, resource, or fence object.

CreateUnorderedAccessView

Creates a view for unordered accessing.

Evict

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

GetAdapterLuid

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

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.

GetCustomHeapProperties

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

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.

GetDeviceRemovedReason

Gets the reason that the device was removed.

GetNodeCount

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

GetResourceAllocationInfo

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

GetResourceTiling

Gets info about how a tiled resource is broken into tiles.

MakeResident

Makes objects resident for the device.

OpenSharedHandle

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

OpenSharedHandleByName

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

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

Header

D3D12.h

Library

D3D12.lib

DLL

D3D12.dll

See also

ID3D12Object
Core Interfaces
Creating Descriptors
Memory Management in Direct3D 12
ID3D12Device2
ID3D12Device1

 

 

Show: