Guidelines

Here is the hints and guidelines on how to use DirectX 12. First is the general ones and later the hardware vendor specific ones. There are three main ones to care about with DX12 and they are NVIDIA, AMD and and Intel.

Pipeline State Objects

Do's

    • Create PSOs on worker threads. Shaders get compiled when creating PSO and it takes time and will stall the game if on main thread.

Barriers & Fences

Do's

    • Batch barriers to in one call to ResourceBarrier.
    • Always use the most contrained state possible on a resource so avoid COMMON and GENERIC_READ.

Dont's

    • Avoid doing redundant transitions.

AMD

Make use of all the queues

- Resources are shared to schedule workloads with different bottlenecks togheter.

Root signature

- Only put small, heavily used data that change per draw as root constants.

Intel

NVIDIA

Use bundle resource binding inheritance sparsely

Place constants, CBVs, SRVs and UAVs directly into the root signature if possible

- Start with the entries for the pixel stage

- Constants that sit directly in root can speed up pixel shaders significantly on NVidia hardware – specifically consider shader constants that toggle parts of uber-shaders

- CBVs that sit in the root signature can also speed up pixel shaders significantly on NVidia hardware

- Carry on with decreasing execution frequency of the shader stages

Limit visiblity of CBV/SRV/UAV to only necessry shader stages.