Samples demonstrating NVIDIA Render Interface (NRI), a cross-platform rendering hardware interface (RHI), covering graphics, compute, ray tracing, resource copies, streaming, low latency, video encoding/decoding, and other features.
Prerequisites:
- CMake 3.30+ and a C/C++ compiler
- Windows: Windows SDK and Vulkan SDK
- Linux: Vulkan SDK and xorg-dev
- macOS: Xcode 26+ with command line tools, Ninja, and the Vulkan SDK (provides DXC for shader compilation and Vulkan through MoltenVK). Install the Metal toolchain with
xcodebuild -downloadComponent MetalToolchain. Install Metal Shader Converter to run the samples on Metal
Notes:
- Run
Scripts/<platform>/1-Deploy.<ext>, thenScripts/<platform>/2-Build.<ext>for your platform - Scripts resolve the project root from their own location and can be launched from any working directory. Build output is placed in
_Buildand_Binat the project root - To clean generated files, run
Scripts/<platform>/4-Clean.<ext>. Cleanup also removes downloaded_Data - To use the static MSVC runtime, pass
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>"when configuring CMake - On macOS, source the Vulkan SDK's
setup-env.shbefore building. Metal Shader Converter enables the HLSL to DXIL to Metal shader workflow automatically when installed and makes Metal the default API; otherwise, Vulkan is used
CMake options:
NRIF_USE_WAYLAND- use Wayland instead of X11 on Linux
Run executables from _Bin with the working directory set to the project root so they can load resources from _Data and shaders from _Shaders. To run all samples sequentially, use Scripts/Windows/3-Test samples.bat, bash "Scripts/Linux/3-Test samples.sh", or bash "Scripts/MacOS/3-Test samples.sh". These scripts set the working directory automatically. The Linux runner uses Vulkan and WebGPU; the macOS runner also uses Metal.
Start with Clear for the device, swap chain, and frame loop, then Triangle for pipelines, descriptors, and uploads. Readback shows the reverse transfer to the CPU; AsyncCompute adds work on a second queue and the fences connecting it to graphics.
The interactive demos derive from SampleBase: Initialize creates resources, PrepareFrame updates CPU data and UI, and RenderFrame records and submits GPU work. A queued frame owns reusable command objects; the acquired swap chain image selects the render target. Their indices serve different purposes.
The headless examples built on TestShared.h follow a shorter path: initialize a test::Context, run the commands, wait, and report PASS, FAIL, or SKIP. The context owns registered NRI objects and cleans them up when the context leaves scope. Unsupported features produce SKIP. Use --api=D3D12 or --api=VULKAN to select a backend, and --debugNRI / --debugAPI to enable validation.
Each headless example checks a different scope. Copy, streaming, and vertex-input cases compare readback data. IndirectCommands, MeshShader, and GraphicsPipelineStates exercise command recording and submission without comparing rendered pixels. Their PASS reports completion of that scope. Run with validation enabled to check API usage as well.
- AsyncCompute - demonstrates parallel execution of graphics and compute workloads
- BindlessSceneViewer - bindless GPU-driven rendering test
- Buffers - buffer creation, copying and readback
- Clear - minimal example of rendering using framebuffer clears only
- ClearStorage - clears storage buffers and textures through bound descriptors
- CopyTests - validates core copy commands and synchronous host texture copies
- DeviceInfo - queries and prints information about GPU adapters in the system
- DescriptorPoolIndexing - HLSL dynamic resources through a directly indexed descriptor pool
- DescriptorHeapIndexing - HLSL dynamic resources through a directly indexed descriptor heap
- DescriptorManagement - descriptor copying, pool switching, update-after-set and pool recycling testing
- DedicatedQueues - dedicated copy queue, synchronization and copy-queue timestamp testing
- GraphicsPipelineStates - exercises dynamic state, geometry, tessellation, and rasterization commands
- GraphicsVertexInput - vertex input, geometry and tessellation draw testing
- InputAttachment - "dynamic rendering local read" demonstration (reading on-chip rendering results)
- IndirectCommands - records indirect draws and compute dispatches, including count-buffer draws
- LowLatency - low latency demonstration
- MemoryAliasing - overlapping resource memory testing
- MeshShader - records direct and indirect mesh shader draws
- Multisample - multisample rendering testing
- MultiThreading - shows advantages of multi-threaded command buffer recording
- Multiview - multiview demonstration in LAYER_BASED mode (VK and D3D12 compatible)
- Queries - timestamp, occlusion and calibrated timestamp testing
- RayTracingAdvanced - builds an AABB acceleration structure, queries its compacted size, then exercises clone, compaction, and update
- RayTracingBoxes - traces many instances of a shared box BLAS through a TLAS
- RayTracingTriangle - simple triangle rendering through ray tracing
- Readback - getting data from the GPU back to the CPU
- Resize - demonstrates window resize
- ResolveSampleZero - sample-zero resolve testing for color and depth-stencil textures
- Resources - resource allocation testing
- SceneViewer - loading & rendering of meshes with materials (also tests programmable sample locations, shading rate and pipeline statistics)
- Streamer - buffer and texture streaming testing
- TextureTypes - 1D, 2D array, cube and 3D texture/view testing
- Triangle - simple textured triangle rendering (also multiview demonstration in FLEXIBLE mode)
- VideoEncodeDecode - H.264/H.265/AV1 NV12 video encode/decode round trip
- Wrapper - shows how to wrap native D3D11/D3D12/VK objects into NRI entities
VideoEncodeDecode notes:
- Select
--codec=H264,H265, orAV1(default:H264). The animated preview supports--h26Frame=IDR|P|Bfor H.264/H.265 and--av1Frame=IDR|Pfor AV1; both default toIDR. - Use
--videoWidthand--videoHeightfor the NV12 video size (default: 1920x1080). Each dimension falls back to--widthor--heightif supplied; explicit video dimensions take precedence. Width must be divisible by 4 and height must be even. - CQP is the default rate control mode. Set
--qpI,--qpP, and--qpBfor frame quantizers, and--av1BaseQIndexfor AV1's base quantizer. The sample accepts 0..51 for H.264/H.265 and 1..255 for AV1. Lower values favor quality.--losslessuses zero quantizers for H.264/H.265 and near-lossless quantizer 1 for AV1. - Use
--streamfor a headless encode/decode sequence,--matrixfor the built-in cases, or--listCasesto list them. Stream options include--frames,--gop,--rc=cqp|cbr|vbr, and--dumpfor output files. - External AV1 OBU decoding with
--decodeFilerequires-DNRISAMPLES_ENABLE_AV1_FILE_DECODING=ONand matching NRI sources for its private parser. Optional--refYuvchecks decoded output against an NV12 reference. This developer feature is off by default; previews, round-trip streams, and matrix cases use public NRI APIs.