Browse by type
NVRHI (NVIDIA Rendering Hardware Interface) is a library that implements a common abstraction layer over Direct3D 12 and Vulkan 1.3. It works on Windows and Linux (x64 and ARM64).
Key features:
NVRHI is used in several NVIDIA SDKs:
Notable third-party projects using NVRHI:
Various early versions of NVRHI have been used in various projects created at NVIDIA, including:
NVRHI can be configured to be used a set of static libraries in CMake-based projects, or as a single dynamic library.
To include NVRHI into a CMake project as static libraries:
add_subdirectory(nvrhi) directive to the parent CMakeLists.txt.nvrhi for the interface headers, common utilities, and validation;nvrhi_d3d12 for DX12 (enabled when NVRHI_WITH_DX12 is ON); andnvrhi_vk for Vulkan (enabled when NVRHI_WITH_VULKAN is ON).To build NVRHI as a shared library (DLL or .so):
NVRHI_BUILD_SHARED variable to ON.The Direct3D 11 backend, nvrhi_d3d11 target, and <nvrhi/d3d11.h> header have been removed. Applications must use the Direct3D 12 or Vulkan backend. Remove dependencies on nvrhi_d3d11 and replace D3D11 device creation and native-resource wrapping with the chosen backend's equivalents.
An explicit NVRHI_WITH_DX11=OFF remains accepted for existing build configurations. Setting NVRHI_WITH_DX11=ON produces a configuration error. Older Donut versions that still include a DX11 device manager must also configure DONUT_WITH_DX11=OFF and migrate their calls to the updated NVRHI API.
The D3D11 API selector and native object identifiers have also been removed, along with SharedResourceFlags::Shared_NTHandle, CommandListParameters::enableImmediateExecution, and its setter. Remove uses of these declarations; command lists must always be explicitly submitted. IDevice::createInputLayout now takes only the vertex attributes and attribute count, so remove the shader argument from existing calls. Rebuild NVRHI and its consumers together because these changes affect the public API and ABI. The numeric values of the remaining graphics API selectors and shared-resource flags are unchanged.
NVRHI depends on the Vulkan-Headers and DirectX-Headers libraries for platform headers (where applicable). These libraries can be provided externally by importing them into the CMake project before NVRHI, or they can be downloaded automatically at project configuration time using CMake FetchContent. This behavior is controlled with the following CMake variables:
NVRHI_FETCH_VULKAN_HEADERS enables downloading of the Vulkan-Headers library (otherwise it must be provided externally if Vulkan is enabled)NVRHI_VULKAN_HEADERS_GIT_REPOSITORY sets the git repository URL for Vulkan-HeadersNVRHI_VULKAN_HEADERS_GIT_TAG sets the git tag or commit hash for Vulkan-HeadersNVRHI_VULKAN_HEADERS_FETCH_DIR sets the path that Vulkan-Headers will be downloaded to - empty means the default location in build/_depsNVRHI_FETCH_DIRECTX_HEADERS enables downloading of the DirectX-Headers library (otherwise it must be provided externally if Vulkan is enabled)NVRHI_DIRECTX_HEADERS_GIT_REPOSITORY sets the git repository URL for DirectX-HeadersNVRHI_DIRECTX_HEADERS_GIT_TAG sets the git tag or commit hash for DirectX-HeadersNVRHI_DIRECTX_HEADERS_FETCH_DIR sets the path that DirectX-Headers will be downloaded to - empty means the default location in build/_depsThe default values of these configuration variables should be OK for most use cases.
See the programming guide, the tutorial, and the optional memory query reference.
NVRHI includes optional support for certain DX12 extensions available through the NVAPI library. The library is not distributed with NVRHI but is available separately here.
To enable NVAPI support, extract the NVAPI SDK into the nvapi subfolder of your main project and set the NVRHI_WITH_NVAPI CMake variable to ON.
Windows on ARM64 needs the R615 or later NVAPI SDK, the first to ship the ARM64 library (aarch64/nvapia64.lib). The library matching the target architecture is picked automatically.
The following extensions are supported:
Set the NVRHI_D3D12_WITH_DXRCLUSTER CMake variable to ON to add native DXR cluster operations to the DX12 backend. Using them requires:
NVRHI_D3D12_DXRCLUSTER_INCLUDE_DIR set to its include directory; later previews are not guaranteed to work with NVIDIA driver 621.01nvrhi::d3d12::enableExperimentalFeatures() before the D3D12 device is createdWhen NVRHI is also built with NVRHI_WITH_NVAPI and an NVAPI SDK that supports cluster operations, the NVAPI cluster operations stay compiled in, and each device picks one API at creation: DXR clusters when the device supports it, NVAPI otherwise. Without NVAPI cluster support, a device without DXR clusters has no cluster operations. d3d12::DeviceDesc::enableDxrClusters and enableNvapiClusters remove an API from that choice. Query Feature::RayTracingClusters with a RayTracingClustersFeatureInfo to find the API in use: DXR clusters read the nvrhi::rt::cluster::dxr argument layouts and writes 64-bit result sizes, while NVAPI and Vulkan use the nvrhi::rt::cluster::nv layouts and 32-bit sizes. The cluster argument structs in nvrhiHLSL.h have 16-bit fields, so HLSL only declares them when compiled with -enable-16bit-types.
NVRHI includes an optional integration of the RTXMU library. The library is downloaded at project configuration time using CMake FetchContent when the NVRHI_WITH_RTXMU CMake variable is set to ON. Similar to the platform header libraries, the RTXMU dependency can be configured using the following CMake variables:
NVRHI_RTXMU_GIT_REPOSITORY sets the git repository URL for RTXMUNVRHI_RTXMU_GIT_TAG sets the git tag or commit hash for RTXMUNVRHI_RTXMU_FETCH_DIR sets the path that RTXMU will be downloaded to - empty means the default location in build/_depsWhen RTXMU integration is enabled, all bottom-level ray tracing acceleration structures (BLAS'es) are managed by that library. All built BLAS'es that have the AllowCompaction flag set are automatically compacted when ICommandList::compactBottomLevelAccelStructs method is called. No other configuration is necessary.
NVRHI is licensed under the MIT License.
$ claude mcp add NVRHI \
-- python -m otcore.mcp_server <graph>