How to Integrate NVIDIA DLSS 4 into Your Game with NVIDIA Streamline
NVIDIA DLSS 4 is the latest iteration of DLSS introduced with the
NVIDIA GeForce RTX 50 Series GPUs
. It includes several new features:
DLSS Multi Frame Generation:
Multi Frame Generation has been introduced for GeForce RTX 50 Series GPUs, allowing for generation of up to 3 frames per rendered frame.
DLSS Ray Reconstruction & DLSS Super Resolution (Beta):
Updated to use a new Transformer model, which improves temporal stability, detail in motion, and lighting details.
DLSS Frame Generation:
The Frame Generation model has been updated to run faster and use less VRAM on GeForce RTX 50 and RTX 40 Series GPUs.
Video 1. DLSS 4 | New Multi Frame Gen & Everything Enhanced
Here’s how you can get started with DLSS 4 in your integrations. This post focuses on the
Streamline SDK
, which provides a plug-and-play framework for simplified plugin integration.
Streamline SDK integration overview
The NVIDIA Streamline SDK is an open-source framework that simplifies the integration of NVIDIA DLSS and various super-resolution technologies from other hardware vendors into games and applications. It enables you to implement multiple upscaling solutions through a single integration point within your game engine.
Figure 1. Streamline SDK architecture
To add Streamline to your application, follow the
Streamline Manual Hooking
guide. Integrate without any features and focus on tasks such as manual hooking and resource state tracking.
Verify the NVIDIA and Streamline dual signatures on sl.itnerposer.dll before loading the DLL. Follow the verification process within the Security section of the programming guide.
Check for system (hardware and software) support for each of the DLSS 4 features and show appropriate error messages to end users based on reported hardware support.
DLSS Multi Frame Generation integration overview
DLSS Frame Generation is an NVIDIA technology that uses AI to generate additional frames between existing ones in game, significantly boosting frame rates and enabling smoother gameplay on NVIDIA GeForce RTX 50 Series and NVIDIA RTX 40 Series GPUs.
In DLSS 4, NVIDIA introduces Multi-Frame Generation, which enables up to three more frames to be generated per rendered frame on GeForce RTX 50 Series GPUs. For more information, see the
DLSS Frame Generation Programming Guide
.
Figure 2. The difference with DLSS 4 Multi Frame Generation
Using Streamline, integrate DLSS Multi Frame Generation. Pass in the appropriate constants, camera matrices, and input resources in addition to the ones marked for DLSS Super Resolution (for example, Hudless and UI Color or Alpha). Be sure to also disable DLSS Multi Frame Generation when appropriate, such as for in-menu or scene transitions.
Validate that inputs are correct using the Streamline Imgui plugin and buffer visualization using the development DLLs.
DLSS Multi Frame Generation checklist
Here’s the integration checklist:
All the required inputs are passed to Streamline:
Depth buffers
Motion vectors
HUD-less color buffers
UI color buffers
Common constants and a frame index are provided for each frame using the
slSetConstants
and
slSetFeatureConstants
methods.
All tagged buffers are valid at frame present time, and they are not reused for other purposes.
Buffers are tagged with a unique ID of
0
.
The frame index provided with the common constants matches the presented frame.
For multi-frame generation,
numFramesToGenerate
is set 1 less than the multiplier mode. For example: set it to
1
for 2x,
2
for 3x, and
3
for 4x.
Inputs passed into Streamline look correct, as well as camera matrices and dynamic objects.
The application checks the signature of
sl.interposer.dll
to make sure it is a genuine NVIDIA library.
Requirements for Dynamic Resolution are met, if supported by the game.
DLSS Frame Generation is disabled by setting
sl::DLSSGOptions::mode
to
sl::DLSSGMode::off
in the following cases:
When the game is paused
Loading
In-menu
Modifying resolution
Switching between full-screen and windowed mode
Not rendering game frames
The swap chain is re-created every time DLSS Frame Generation is turned on or off by changing
sl::DLSSGOptions::mode
. This avoids unnecessary performance overhead when DLSS Frame Generation is switched off.
The amount of motion blur is reduced. When DLSS Frame Generation is enabled, halve the distance and magnitude of motion blur.
Reflex is properly integrated. For more information, see the checklist in the
Reflex Programming Guide
.
The in-game user interface for enabling or disabling DLSS Frame Generation is implemented and follows the
NVIDIA RTX UI guidelines
.
Only full production, non-watermarked libraries are packaged in the release build.
There are no errors or unexpected warnings in the Streamline and DLSS Frame Generation log files while running the feature.
The extent resolution or resource size, whichever is in use, for the Hudless and UI Color and Alpha buffers exactly matches that of the back buffer.
The
VSync
setting in the menu is hooked to
sl::DLSSGState::bIsVsyncSupportAvailable
.
DLSS Super Resolution integration overview
DLSS Super Resolution is an NVIDIA technology that uses AI to upscale a lower-resolution image to a higher resolution, boosting game performance. For more information, see the
DLSS Programming Guide
.
Figure 3. High-quality graphics using DLSS Super Resolution
Using Streamline, pass in the necessary input resources and set up the upscaling pipeline before all post-processing. Validate IQ and performance benefits from DLSS Super Resolution.
DLSS Super Resolution checklist
Here’s the integration checklist:
A game-specific application ID is used during initialization.
DLSS Super Resolution is integrated as close to the start of post-processing as possible.
Mip-map bias is set when DLSS Ray Resolution is enabled. Without this, textures will look blurry, smudgy, or low-resolution.
Motion vectors for all scenes, materials, and objects are accurate.
Static scenes resolve and compatible jitter is confirmed. Incorrect or missing jitter can lead to poor anti-aliasing and increased flickering.
Exposure value is properly sent each frame or auto-exposure is enabled.
DLSS modes are queried and user-selectable in the user interface or dynamic resolution support is active and tested.
The full production, non-watermarked DLSS library (
nvngx_dlss.dll
) is packaged in the release build.
The
Camera Reset
flag is passed on scene changes, view changes such as first person to third person, or during camera jumps in cutscenes.
NGX cleanup or shutdown procedures are performed when DLSS is no longer needed. Otherwise, you’ll leak resources/memory.
DLSS should only replace the primary upscale pass on the main render target and should not be used on secondary buffers such as shadows and reflections.
DLSS Ray Reconstruction integration overview
DLSS Ray Reconstruction improves the image quality of path-traced and intensive ray-traced content. It does this by replacing hand-tuned denoisers with an NVIDIA supercomputer-trained AI network that generates higher-quality pixels in between sampled rays. For more information, see the
DLSS Ray Reconstruction Programming Guide
.
Figure 4. With and without DLSS Ray Reconstruction
ALT text: Two versions of a still image from the game Cyberpunk show DLSS off in Overdrive mode and DLSS 3.5 in Overdrive mode with Ray Reconstruction.
DLSS Ray Resolution is an addition to DLSS Super Resolution and uses the same perf quality modes. Make sure that DLSS Super Resolution is integrated first. Then, integrate DLSS Ray Reconstruction using the Streamline SDK. Validate IQ and performance benefits from DLSS Ray Reconstruction.
Ray Reconstruction integration checklist
Here’s the integration checklist:
A game-specific application ID is used during initialization.
Both DLSS Ray Reconstruction and DLSS Super Resolution are integrated at the start, or as close to the start as possible, of post-processing.
Other denoisers in your pipeline, such as NRD, are completely disabled.
DLSSDPreset
is set to
eDefault
if you previously set it to
ePresetA
or
ePresetB
.
Mip-map bias is set when DLSS Ray Reconstruction is enabled. Without this, textures will look blurry,  smudgy, or low-resolution.
The required buffers are provided.
DLSS Ray Reconstruction requires linear depth, which is different from those buffers provided to DLSS Super Resolution and DLSS Frame Generation. Use
kBufferTypeLinearDepth
, which is specifically provided for this.
The
Inverted Depth
bit is set if the depth buffer provided has inverted z ordering.
Motion vectors and specular motion vectors for all scenes, materials, and objects are accurate.
Static scenes resolve and compatible jitter is confirmed. Incorrect or missing jitter can lead to poor anti-aliasing and increased flickering.
DLSS modes are queried and user-selectable in the user interface or dynamic resolution support is active and tested.
A DLSS RR enable and disable toggle is available.
The full production, non-watermarked DLSS Ray Reconstruction library (
nvngx_dlssd.dll
) is packaged in the release build.
The
Camera Reset
flag is passed on scene changes, view changes such as first person to third person, or during camera jumps in cutscenes.
NGX cleanup and shutdown procedures are performed when DLSS is no longer needed. Otherwise, you’ll leak resources and memory.
Summary
In this post, I explained how to integrate DLSS 4 features, with a focus on the
Streamline SDK
for simplified plugin integration. For more information about how to get started today, see
NVIDIA DLSS
.
如何借助 NVIDIA Streamline 将 NVIDIA DLSS 4 集成到您的游戏中
NVIDIA DLSS 4 是
NVIDIA GeForce RTX 50 系列 GPU
中引入的 DLSS 的最新版本。它包含多项新功能：
DLSS 多帧生成：
已为 GeForce RTX 50 系列 GPUs 引入多帧生成，允许每渲染帧生成多达 3 帧。
DLSS Ray Reconstruction & DLSS Super Resolution (Beta):
：已更新，可使用新的 Transformer 模型，提高时间稳定性、动态细节和照明细节。
DLSS 帧生成
：帧生成模型经过更新，可在 GeForce RTX 50 和 RTX 40 系列 GPUs 上运行更快，并使用更少的 VRAM。
DLSS 4|
下面介绍如何在集成中开始使用 DLSS 4、本文重点介绍
Streamline SDK
，它提供了一个即插即用的框架，可简化插件集成。
简化 SDK 集成概述
NVIDIA Streamline SDK 是一个开源框架，可简化将 NVIDIA DLSS 和其他硬件供应商提供的各种超分辨率技术集成到游戏和应用中的过程。它使您能够通过游戏引擎中的单个集成点实施多个放大解决方案。
图 1. Streamline SDK 架构
要将 Streamline 添加到您的应用中，请按照 Streamline 手动连接指南进行操作。无需任何功能即可集成，并专注于手动连接和资源状态跟踪等任务。
在加载 DLL 之前，请先验证 NVIDIA，并在 sl.itnerposer.dll 上简化双重签名。遵循编程指南中的安全部分中的验证流程。
检查每个 DLSS 4 功能的系统 (硬件和软件) 支持，并根据报告的硬件支持向最终用户显示适当的错误消息。
DLSS 多帧生成集成概述
DLSS 帧生成是一项 NVIDIA 技术，该技术利用 AI 在游戏中的现有帧之间生成更多帧，从而显著提高帧率，并在 NVIDIA GeForce RTX 50 Series 和 NVIDIA RTX 40 Series GPUs 上实现更流畅的游戏体验。
在 DLSS 4 中，NVIDIA 引入了多帧生成技术，该技术可在 GeForce RTX 50 Series GPUs 上为每一渲染帧多生成三个帧。有关更多信息，请参阅
DLSS Frame Generation Programming Guide
。
图 2、与 DLSS 4 Multi Frame Generation 的区别
使用 Streamline 集成 DLSS Multi Frame Generation。除了标记为 DLSS Super Resolution 的资源 (例如 Hudless 和 UI Color 或 Alpha) 外，还传递适当的常量、摄像头矩阵和输入资源。另外，请务必在适当时禁用 DLSS Multi Frame Generation，例如菜单中或场景过渡。
使用 Streamline Imgui 插件验证输入是否正确，并使用开发 DLL 实现缓冲区可视化。
DLSS 多帧生成检查清单
以下是集成检查清单：
所有必需的输入都将传递给 Streamline：
深度缓冲区
运动矢量
无 HUD 色彩缓冲区
UI 颜色缓冲区
我们使用
slSetConstants
和
slSetFeatureConstants
方法为每一帧提供常用常量和帧索引。
所有标记缓冲区在帧出现时均有效，且不会重复用于其他目的。
缓冲区的唯一 ID 为
0
。
随常用常量提供的帧索引与呈现的帧相匹配。
对于多帧生成，
numFramesToGenerate
的设置比乘数模式小 1。例如：2x 设置为
1
，3x 设置为
2
，4x 设置为
3
。
传入 Streamline 的输入看起来正确，摄像头矩阵和动态对象也是如此。
应用程序会检查
sl.interposer.dll
的签名，以确保它是真正的 NVIDIA 库。
如果游戏支持，则需满足动态分辨率要求。
在以下情况下，通过将
sl::DLSSGOptions::mode
设置为
sl::DLSSGMode::off
来禁用 DLSS 帧生成：
游戏暂停时
加载
菜单中
修改分辨率
在全屏模式和窗口模式之间切换
不渲染游戏帧
每次打开或关闭 DLSS 帧生成时，系统都会通过更改
sl::DLSSGOptions::mode
来重新创建交换链。这可避免在关闭 DLSS 帧生成时产生不必要的性能开销。
动态模糊量减少。当 DLSS 帧生成启用后，将动态模糊的距离和大小减半。
Reflex 已正确集成。有关更多信息，请参阅 Reflex
编程指南
中的检查清单。
启用或禁用 DLSS 帧生成的游戏中用户界面遵循
NVIDIA RTX UI 指南
。
在发布版本中，只有完整的生产、非水印库被打包。
运行该功能时，Streamline 和 DLSS 帧生成日志文件中没有出现任何错误或意外警告。
Hudless 和 UI Color 和 Alpha 缓冲区的范围分辨率或资源大小 (以使用中的大小为准) 与反向缓冲区的范围分辨率或资源大小完全匹配。
菜单中的
VSync
设置已关联到
sl::DLSSGState::bIsVsyncSupportAvailable
。
DLSS 超分辨率集成概述
DLSS 超分辨率是一项 NVIDIA 技术，可利用 AI 将低分辨率图像升级到更高分辨率，从而提升游戏性能。有关更多信息，请参阅
DLSS 编程指南
。
图 3、使用 DLSS Super Resolution 的高质量图形
使用 Streamline，在进行所有后处理之前，传递必要的输入资源并设置放大管线。验证 DLSS Super Resolution 带来的 IQ 和性能优势。
DLSS 超分辨率检查清单
以下是集成检查清单：
在初始化期间使用特定于游戏的应用程序 ID。
DLSS 超分辨率尽可能在后处理开始时集成。
启用 DLSS 光线分辨率后，系统会设置 Mip-map 偏差。否则，纹理将显得模糊、模糊或低分辨率。
所有场景、材质和对象的运动矢量均准确无误。
确认静态场景解析和兼容抖动。抖动不正确或缺失会导致抗锯齿效果不佳和闪烁增加。
在每一帧或启用 auto-exposure 时，都会正确发送 Exposure 值。
系统会查询 DLSS 模式，并允许用户在用户界面中选择 DLSS 模式，或启用动态分辨率支持并对其进行测试。
完整的无水印生产 DLSS 库 (
nvngx_dlss.dll
) 已封装在版本构建中。
在场景更改、视图更改 (例如将第一人称更改为第三人称) 或转换场景中的镜头跳转期间，系统会将“Camera Reset”标志传递给相关人员。
当不再需要 DLSS 时，系统会执行 NGX 清理或关闭程序。否则，您将泄露资源/内存。
DLSS 应仅取代主渲染目标上的主要 upscale 通道，而不应用于阴影和反射等次要缓冲区。
DLSS Ray Reconstruction 集成概述
DLSS 光线重建技术可提高路径追踪和密集型光线追踪内容的画质。它通过将手动调整的降噪器替换为 NVIDIA 超级计算机训练的 AI 网络来实现这一点，该网络可在采样光线之间生成更高质量的像素。如需了解更多信息，请参阅
DLSS Ray Reconstruction Programming Guide
。
图 4、启用和禁用 DLSS Ray Reconstruction
ALT 文本：“赛博朋克”游戏中静态图像的两个版本在 Overdrive 模式下关闭 DLSS，在 Overdrive 模式下通过光线重建功能关闭 DLSS 3.5
DLSS 光线分辨率是 DLSS 超分辨率的新增功能，并使用相同的性能质量模式。确保首先集成 DLSS 超分辨率。然后，使用 Streamline SDK 集成 DLSS 光线重建。验证 DLSS 光线重建带来的 IQ 和性能优势。
Ray Reconstruction 集成检查清单
以下是集成检查清单：
在初始化期间使用特定于游戏的应用程序 ID。
DLSS 光线重建和 DLSS 超分辨率均在后处理开始时或尽可能接近开始时集成。
工作流中的其他降噪器 (例如 NRD) 将完全禁用。
如果您之前将
ePresetA
或
ePresetB
设置为
eDefault
，则会将
DLSSDPreset
设置为 tg_18。
启用 DLSS 光线重建后，系统会设置 Mip-map 偏差。否则，纹理将显得模糊、模糊或低分辨率。
The required buffers are provided.
DLSS 光线重建需要线性深度，这不同于为 DLSS 超分辨率和 DLSS 帧生成提供的缓冲区。使用专门为此提供的
kBufferTypeLinearDepth
。
如果所提供的深度缓冲区采用反向 z 排序，则设置
Inverted Depth
位。
所有场景、材质和物体的运动矢量和镜面运动矢量均准确无误。
确认静态场景解析和兼容抖动。抖动不正确或缺失会导致抗锯齿效果不佳和闪烁增加。
系统会查询 DLSS 模式，并允许用户在用户界面中选择 DLSS 模式，或启用动态分辨率支持并对其进行测试。
您可以使用 DLSS RR 启用和禁用开关。
完整的量产版、无水印的 DLSS Ray Reconstruction 库 (
nvngx_dlssd.dll
) 已封装在发行版中。
在场景更改、视图更改 (例如将第一人称更改为第三人称) 或转换场景中的镜头跳转期间，系统会将“Camera Reset”标志传递给相关人员。
当不再需要 DLSS 时，系统会执行 NGX 清理和关闭程序。否则，您将泄露资源和内存。
总结
在本文中，我介绍了如何集成 DLSS 4 功能，并重点介绍了简化插件集成的
Streamline SDK
。有关如何立即开始使用的更多信息，请参阅
NVIDIA DLSS
。