• Stars
    star
    525
  • Rank 83,812 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NVRHI

Build Status

Introduction

NVRHI (NVIDIA Rendering Hardware Interface) is a library that implements a common abstraction layer over multiple graphics APIs (GAPIs): Direct3D 11, Direct3D 12, and Vulkan 1.2. It works on Windows (x64 only) and Linux (x64 and ARM64).

Key features:

  • Automatic tracking of resource states and barrier placement (optional).
  • Automatic tracking of resource usage and lifetime, deferred and safe resource destruction.
  • Convenient and efficient resource binding model with little runtime overhead.
  • Easy direct interaction with the underlying GAPI when necessary.
  • Easy portability of the rendering code between the supported GAPIs.
  • Hidden sub-allocation of upload buffers and versioning of constant buffers.
  • Parallel command list recording and multi-queue rendering.
  • Supports all types of pipelines: Graphics, Compute, Ray Tracing, and Meshlet.
  • Validation layer and resource reflection for easy debugging.

NVRHI is used in several NVIDIA GameWorks SDKs:

Notable third-party projects using NVRHI:

Various early versions of NVRHI have been used in various projects created at NVIDIA, including:

Requirements

  • Windows or Linux (x64 or ARM64)
  • CMake 3.10
  • A C++ 17 compiler (Visual Studio 2019, GCC 8 or Clang 6)
  • Windows SDK version 10.0.19041.0 or later for DX12 support

Building NVRHI

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:

  1. Add this repository as a submodule.
  2. Add a add_subdirectory(nvrhi) directive to the parent CMakeLists.txt.
  3. Add dependencies to the necessary targets:
    • nvrhi for the interface headers, common utilities, and validation;
    • nvrhi_d3d11 for DX11 (enabled when NVRHI_WITH_DX11 is ON);
    • nvrhi_d3d12 for DX12 (enabled when NVRHI_WITH_DX12 is ON); and
    • nvrhi_vk for Vulkan (enabled when NVRHI_WITH_VULKAN is ON).

To build NVRHI as a shared library (DLL or .so):

  1. Clone this repository recursively (including submodules).
  2. Generate the project with CMake:
    • Set the NVRHI_BUILD_SHARED variable to ON.
    • Make sure to set the target platform to a 64-bit one. 32-bit builds are not supported.
  3. Build and install as normal.

Using NVRHI in Applications

See the programming guide and the tutorial.

Shader Compiler -- DEPRECATED

The batch shader compiler that is included with NVRHI is superseded by ShaderMake and will be removed soon. Please update your projects to use ShaderMake.

Command line differences between nvrhi-scomp and ShaderMake:

  • -i/--infile replaced with -c/--config.
  • -p/--parallel is now the default behavior, use --serial to get single-thread compilation.
  • --keep removed.
  • --ignore replaced with --relaxedInclude.
  • --cflags removed to support API interaction with the compilers, use individual feature settings instead.
  • --platform arguments now need to be uppercase: DXIL, DXBC, SPIRV.
  • --vk-{s,t,b,u}-shift replaced with --{s,t,b,u}RegShift
  • Add --useAPI on Windows to improve compilation performance.

Config file differences:

  • -T <type>_<model> replaced with just -T <type>, and the shader model is now specified from ShaderMake command line with --shaderModel <model>.
  • Comments now start with // instead of #.
  • Added limited support for #ifdef and similar preprocessor directives to conditionally compile shaders.

The format of shader permutation blobs remains the same, but NVRHI will no longer support it once ShaderCompiler is removed. Use the new ShaderMakeBlob library instead of createShaderPermutation and createShaderLibraryPermutation to parse the blobs on the application side.

The shader compiler target and its dependency cxxopts can be removed from build by setting NVRHI_WITH_SHADER_COMPILER to OFF in CMake configuration.

NVAPI Support

NVRHI includes optional support for certain DX11 and 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.

The following extensions are supported:

  • Opacity Micro-Maps (DX12, Ada+)
  • Shader Execution Reordering on DX12 (DX12, Ada+)
  • Single Pass Stereo (Pascal+)
  • Fast Geometry Shader with optional coordinate swizzling (Maxwell+)
  • Conservative Raster and other rasterizer features (Maxwell+)
  • HLSL Extensions through a fake UAV slot (see this blog post)

RTXMU Integration

NVRHI includes an optional integration of the RTXMU library. The library is included as a git submodule, and can be enabled with the NVRHI_WITH_RTXMU CMake variable.

When 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.

License

NVRHI is licensed under the MIT License.

More Repositories

1

kaolin

A PyTorch Library for Accelerating 3D Deep Learning Research
Python
4,424
star
2

PhysX

NVIDIA PhysX SDK
C++
2,893
star
3

Falcor

Real-Time Rendering Framework
C++
2,615
star
4

PhysX-3.4

NVIDIA PhysX SDK 3.4
C++
2,307
star
5

kaolin-wisp

NVIDIA Kaolin Wisp is a PyTorch library powered by NVIDIA Kaolin Core to work with neural fields (including NeRFs, NGLOD, instant-ngp and VQAD).
Python
1,451
star
6

rtx-remix

Combined repo for the RTX-Remix runtime
1,354
star
7

DxrTutorials

C++
828
star
8

RTXGI-DDGI

RTX Global Illumination (RTXGI)
C++
685
star
9

GettingStartedWithRTXRayTracing

Getting Started with RTX Ray Tracing
C++
613
star
10

RTX-Path-Tracing

Real-time path tracing library and sample
C++
599
star
11

FleX

C++
579
star
12

RayTracingDenoiser

NVIDIA Ray Tracing Denoiser
HLSL
505
star
13

FaceWorks

A middleware library and sample application for high-quality skin and eye rendering
C++
450
star
14

NVIDIAImageScaling

NVIDIA Image Scaling SDK
C
426
star
15

Streamline

Streamline Integration Framework
C
375
star
16

RTXDI

C++
347
star
17

Blast

A modular destruction SDK designed for performance and flexibility, replacing APEX destruction
C++
331
star
18

dxvk-remix

C++
303
star
19

NvCloth

C
296
star
20

KickstartRT

KickstartRT SDK
C++
185
star
21

Flow

Flow is a sparse grid-based fluid simulation library for real-time applications.
C
168
star
22

donut

C++
164
star
23

HBAOPlus

HBAO+
C++
160
star
24

bridge-remix

This is the NVIDIA RTX Remix Runtime Bridge repository
C++
146
star
25

SpatiotemporalBlueNoiseSDK

C
127
star
26

Displacement-MicroMap-Toolkit

C++
125
star
27

UnityPhysXPlugin

Experimental Unity package to enable access to NVIDIA PhysX SDK 4 from within Unity.
C#
122
star
28

NRI

C++
90
star
29

RTXMU

C++
89
star
30

donut_examples

C++
72
star
31

ShaderMake

Shader Compilation Tool
C++
72
star
32

NRDSample

C++
69
star
33

GeForceNOW-SDK

This is the home of the SDK for GeForce NOW
C
65
star
34

KickstartRT_demo

Repo for KickstartRT demo application
C++
50
star
35

Opacity-MicroMap-SDK

Opacity Micro-Map SDK Source Repository
C++
36
star
36

MathLib

C++
28
star
37

Displacement-MicroMap-SDK

C++
19
star
38

nas-sample

C++
16
star
39

Streamline_Sample

C++
16
star
40

ComfyUI-RTX-Remix

ComfyUI RTX Remix
Python
14
star
41

Opacity-MicroMap-Samples

Samples repository for the Opacity MicroMap SDK
C++
11
star
42

Displacement-MicroMap-BaryFile

C++
11
star
43

NRIFramework

C
8
star
44

NRISamples

C++
7
star
45

rtxdi-runtime

HLSL
2
star