UNITY.COM
DirectX 12 improvements in Unity 6
Greetings from the Unity Graphics team!In this post, we will cover the latest improvements to the functionality and performance of the DirectX 12 (DX12) graphics backend. As of Unity 6.1, DirectX 12 is now set as the default graphics API for new projects.DX12 provides a modern, lower level and thinner abstraction for graphics acceleration. It was designed to better utilize multi core CPUs, by allowing applications to efficiently multi-thread the recording and submission of graphics commands to the GPU.We also recommend you watch the latest Unite Graphics Performance session, where we cover some of the latest improvements to DX12.Accelerate CPU performance with Split Graphics JobsThe new Split Jobs threading mode for DX12 improves on the older “Native Jobs” threading mode, by reducing synchronization between the main thread and graphics jobs thread.This is especially beneficial for CPU-bound games, which render large and complex environments, submitting many draw calls.As of Unity 6, Split Graphics Jobs are also supported in the Unity Editor for DX12, to improve the Scene and Game View rendering performance. You can now toggle Graphics Jobs from the Editor’s “Preferences” -> “Job Settings” panel.NOTE: DX12 multithreading comes with additional graphics memory cost, due to the allocation of additional resources per thread. This imposes a tradeoff between CPU performance and memory usage, and can increase memory usage compared to the single-threaded DX11.Beyond CPU performance, DX12 exposes the latest GPU capabilities to game developers, unlocking new ways to improve both fidelity and performance.Prevent rendering stutters with PSO TracingWith DX12, we can explicitly state the needed graphics states well ahead of rendering time, by creating and caching Pipeline State Objects (PSOs). This workflow eliminates application stutters/hitches, resulting in smoother rendering and game play.To enable this, Unity 6 introduces support for the new GraphicsStateCollection API. In the below example, we are using the API to precook PSOs before loading the scene. This results in a stutter-less flythrough of the Garden demo.For more information on PSO tracing, check the official Unity Discussions post.Balance shading performance and quality with Variable Rate ShadingDX12 also introduces support for Variable Rate Shading (VRS), to control the shading rate of pixel shaders and draw calls. Using the new VRS API in Unity 6.1, we can generate a shading rate image (SRI) from texture, or procedurally using shaders. Once created, we can apply the SRI using the CommandBuffer API, or using Scriptable Render Passes.In the example below, we are applying a lower shading rate to screen areas affected by motion blur. This reduces the pixel shading overhead, without noticeable degradation to visual fidelity.To learn more about Variable Rate Shading, check the official Unity Discussions post. Improve GPU utilization with Async ComputeAnother capability introduced by DX12 is Asynchronous Compute dispatch. This allows to overlap Compute Shader execution with heavy rasterization workloads, to improve GPU parallelism.. Raster-heavy passes (such as Shadowmaps) are often bound by geometry processing, and may not fully utilize the GPUs shader cores. By dispatching compute kernels asynchronously, we can increase GPU utilization and reduce frame times.For more information on DX12 exclusive features, please refer to the official documentation.Push fidelity to the max with DirectX Ray TracingUnity’s High Definition Render Pipeline (HDRP) utilizes DirectX 12 Raytracing (DXR), to achieve unparalleled visual fidelity and realism. This is demonstrated by the “Enemies” real time demo, which uses HDRP and DXR to achieve stunning visuals.Unity 6 provides production-ready support for Ray Tracing, along with DXR 1.1 feature level compatibility. This brings many improvements to ray tracing functionality and performance.Solid Angle Culling allows to improve ray tracing performance, by discarding objects that are too small or distant. You can enable angle culling via the HDRP ray tracing setting (Culling Mode), to significantly reduce CPU processing time Additional improvements to DX12 Ray Tracing include:Inline Ray Tracing in ShadersRay Tracing Acceleration Structure Build FlagsIndirect Ray Tracing DispatchIndirect Ray Tracing InstancingUnity 6 also reduces memory usage for DX12 Ray Tracing via:BLAS Compaction reduces the memory usage of static meshes.Custom GPU memory allocator for small BLASes reduces the memory usage of small meshes and details.MinimizeMemory flag can be set per MeshRenderer, to further reduce memory usage.Reduce memory bandwidth usage with DirectX12 Render PassWith the introduction of Windows-on-ARM support, DX12 also improves mobile (tile-based) GPU efficiency, via the new Render Pass API.The DX12 Render Pass is utilized by the Render Graph system in Unity 6, which automatically tracks and merges compatible render passes. In the example below, Render Graph is able to merge the geometry render passes, and load the GBuffer textures directly from on-chip tile memory. This can significantly reduce bandwidth and energy usage, along with thermals, allowing mobile devices to run for longer and at a stable framerate. To learn more about on-tile rendering in URP, see the Render Graph documentation. Accelerate Neural Network Inference with DirectMLIn addition to graphics improvements, DX12 can also improve the performance of Neural Network inference through the Sentis API. When using DX12 and the Sentis GPU backend, we observe up to 50% reduction in inference time when executing larger Convolutional Neural Networks.To learn more about DX12 acceleration for Sentis, check the official Unity Discussions post. Platform supportDirectX 12 is supported on modern Windows platforms. Please follow these instructions for checking which DirectX version is supported by your PC. You can also refer to Wikipedia for per-GPU information on DirectX 12 and feature level support:NVIDIA: https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_unitsAMD: https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_unitsIntel: https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_unitsDirectX 12 may not be recommended on significantly old GPU models and outdated driver versions. If you are targeting legacy Windows devices, we recommend you still target DirectX 11 or keep it as a fallback API.Please give these latest DX12 improvements a try, and let us know what you think!You can follow our progress via the public roadmap. If you cannot find the feature you are looking for, feel free to submit a feature request, or contact the team directly in this thread or the graphics discussion forum.
0 Комментарии 0 Поделились 48 Просмотры