Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DirectX

How to set up DirectX graphics API.
Read time 2 minutesLast updated 21 days ago

Unity supports the DirectX graphics API including both DirectX 11 and DirectX 12. However, not all features are available in DirectX 11. For more information, refer to Feature comparison of DirectX 11 and DirectX 12 in Unity.

Set your default graphics API to DirectX

You can choose to set DirectX 11 (DX11) or DirectX 12 (DX12) as your default Graphics API in the Editor or Standalone Player:
  1. Open the Player settings (menu: Edit >
    Project Settings

    ?

    > Player).
  2. In the Other Settings > Rendering section, disable the Auto Graphics API for a platform (Windows/Mac/Linux) option.
  3. Select the Add (+) button, then select Direct3D11 or Direct3D12 from the list of the supported Graphics APIs.
Note
Unity compiles two sets of shaders if you add both DX11 and DX12 to the list, and you enable using the DXC compiler for DX12 in your build profile settings.

Feature comparison of DirectX 11 and DirectX 12 in Unity

The following lists include the features introduced with the DirectX 12 graphics API, which are unavailable in DirectX 11.

APIs

DirectX 11

DirectX 12

Dynamic resolutionUnsupportedSupported
Asynchronous computeUnsupportedSupported
Native render passUnsupportedSupported
Ray tracing accelerationUnsupportedSupported
Graphics state collectionUnsupportedSupported
XR foveated renderingUnsupportedSupported

Render Threading Mode

DirectX 11

DirectX 12

DirectSupportedSupported
Single threadedSupportedSupported
Main + render threadSupportedSupported
Legacy jobifiedSupportedSupported
Native graphics jobsUnsupportedSupported
Split graphics jobsUnsupportedSupported

Shader features

DirectX 11

DirectX 12

Ray tracing shaderUnsupportedSupported
Inline ray tracing (
#pragma multi_compile _ UNITY_DEVICE_SUPPORTS_INLINE_RAY_TRACING
)
UnsupportedSupported
Compile shaders with the DXC compilerUnsupportedSupported
Native 16-bit (
#pragma multi_compile _ UNITY_DEVICE_SUPPORTS_NATIVE_16BIT
)
UnsupportedSupported
Wave function (
#pragma multi_compile _ UNITY_DEVICE_SUPPORTS_WAVE_ANY
)
UnsupportedSupported

Universal Render Pipeline

DirectX 11

DirectX 12

Raster pass mergingUnsupportedSupported (Windows on ARM)
Native RenderPassUnsupportedSupported (Windows on ARM)
Framebuffer fetchUnsupportedSupported (Windows on ARM)

High Definition Render Pipeline

DirectX 11

DirectX 12

Hardware dynamic resolutionUnsupportedSupported
Asynchronous Compute ShadersUnsupportedSupported
Ray traced ambient occlusionUnsupportedSupported
Ray traced contact shadowsUnsupportedSupported
Ray traced global illuminationUnsupportedSupported
Ray traced reflectionsUnsupportedSupported
Ray traced shadowsUnsupportedSupported
Ray traced recursionUnsupportedSupported
Ray traced subsurface scatteringUnsupportedSupported

Additional resources