Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v3.0.0
* Upgrade to wgpu 28
* Bump DLSS SDK to v310.5.0
* DlssSuperResolution::render and DlssRayReconstruction::render now return a CommandBuffer that you must submit to a queue in a specific way. Read the documentation for more info.

# v2.0.0
* Upgrade to wgpu 27

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dlss_wgpu"
version = "2.0.0"
version = "3.0.0"
edition = "2024"
categories = ["graphics", "rendering"]
description = "Adds support for using DLSS with wgpu"
Expand All @@ -9,7 +9,7 @@ documentation = "https://docs.rs/dlss_wgpu"
license = "MIT OR Apache-2.0"

[dependencies]
wgpu = { version = "27", default-features = false, features = ["vulkan"] }
wgpu = { version = "28", default-features = false, features = ["vulkan"] }
ash = "0.38"
glam = "0.30"
uuid = "1"
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A wrapper for using [DLSS](https://www.nvidia.com/en-us/geforce/technologies/dls

| dlss_wgpu | dlss | wgpu |
| :-------: | :------: | :---: |
| v3.0.0 | v310.5.0 | v28 |
| v2.0.0 | v310.4.0 | v27 |
| v1.0.1 | v310.4.0 | v26 |
| v1.0.0 | v310.3.0 | v26 |
Expand All @@ -14,8 +15,8 @@ A wrapper for using [DLSS](https://www.nvidia.com/en-us/geforce/technologies/dls

The DLSS SDK cannot be redistributed by this crate. You will need to download the SDK as follows:

* Ensure you comply with the [DLSS SDK license](https://github.com/NVIDIA/DLSS/blob/v310.4.0/LICENSE.txt)
* Clone the [NVIDIA DLSS Super Resolution SDK v310.4.0](https://github.com/NVIDIA/DLSS/tree/v310.4.0)
* Ensure you comply with the [DLSS SDK license](https://github.com/NVIDIA/DLSS/blob/v310.5.0/LICENSE.txt)
* Clone the [NVIDIA DLSS Super Resolution SDK v310.5.0](https://github.com/NVIDIA/DLSS/tree/v310.5.0)
* Set the environment variable `DLSS_SDK = /path/to/DLSS`

## Build Dependencies
Expand All @@ -30,11 +31,11 @@ Once your app is compiled, you do not need to distribute the entire DLSS SDK, or

1. Copy the DLL:
* Windows: Copy `$DLSS_SDK/lib/Windows_x86_64/rel/nvngx_dlss.dll` to the same directory as your app
* Linux: Copy `$DLSS_SDK/lib/Linux_x86_64/rel/libnvidia-ngx-dlss.so.310.4.0` to the same directory as your app
* Linux: Copy `$DLSS_SDK/lib/Linux_x86_64/rel/libnvidia-ngx-dlss.so.310.5.0` to the same directory as your app
2. Include the full copyright and license blurb texts from section `9.5` of `$DLSS_SDK/doc/DLSS_Programming_Guide_Release.pdf` with your app
3. Additionally, for DLSS ray reconstruction:
* Windows: Copy `$DLSS_SDK/lib/Windows_x86_64/rel/nvngx_dlssd.dll` to the same directory as your app
* Linux: Copy `$DLSS_SDK/lib/Linux_x86_64/rel/libnvidia-ngx-dlssd.so.310.4.0` to the same directory as your app
* Linux: Copy `$DLSS_SDK/lib/Linux_x86_64/rel/libnvidia-ngx-dlssd.so.310.5.0` to the same directory as your app

## Debug Overlay

Expand Down
1 change: 1 addition & 0 deletions src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn create_instance(
flags: instance_descriptor.flags,
memory_budget_thresholds: instance_descriptor.memory_budget_thresholds,
backend_options: instance_descriptor.backend_options.clone(),
telemetry: None,
},
Some(Box::new(|mut args| {
result = register_instance_extensions(project_id, &mut args, feature_support);
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! For further info on how to integrate DLSS into your application, read `$DLSS_SDK/doc/DLSS_Programming_Guide_Release.pdf`.
//!
//! ## API Usage
//! ```rust
//! ```compile_fail
//! use dlss_wgpu::{FeatureSupport, DlssSdk, DlssPerfQualityMode, DlssFeatureFlags};
//! use dlss_wgpu::super_resolution::{DlssSuperResolution, DlssSuperResolutionRenderParameters};
//!
Expand Down Expand Up @@ -46,8 +46,11 @@
//!
//! // Encode DLSS render commands
//! let render_parameters = DlssSuperResolutionRenderParameters { ... };
//! context.render(render_parameters, &mut command_encoder, &adapter)
//! let dlss_command_buffer = context.render(render_parameters, &mut command_encoder, &adapter)
//! .expect("Failed to render DLSS");
//!
//! // Submit render commands
//! queue.submit([command_encoder.finsh(), dlss_command_buffer]);
//! ```

#[cfg(not(feature = "mock"))]
Expand Down
26 changes: 21 additions & 5 deletions src/ray_reconstruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::{
sync::{Arc, Mutex},
};
use wgpu::{
Adapter, CommandEncoder, CommandEncoderDescriptor, Device, Queue, Texture, TextureTransition,
TextureUses, TextureView, hal::api::Vulkan,
Adapter, CommandBuffer, CommandEncoder, CommandEncoderDescriptor, Device, Queue, Texture,
TextureTransition, TextureUses, TextureView, hal::api::Vulkan,
};

/// Camera-specific object for using DLSS Ray Reconstruction.
Expand Down Expand Up @@ -120,12 +120,21 @@ impl DlssRayReconstruction {
}

/// Encode rendering commands for DLSS Ray Reconstruction.
///
/// The resulting command buffer should be submitted to a [`Queue`] in the same submit as the finished `command_encoder`, ordered immediately afterwards.
/// ```compile_fail
/// let mut my_command_encoder = device.create_command_encoder(descriptor);
/// let dlss_command_buffer = dlss.render(render_parameters, &mut my_command_encoder, adapter).unwrap();
/// queue.submit([my_command_encoder.finish(), dlss_command_buffer]);
/// ```
///
/// Failing to follow these rules is undefined behavior.
pub fn render(
&mut self,
render_parameters: DlssRayReconstructionRenderParameters,
command_encoder: &mut CommandEncoder,
adapter: &Adapter,
) -> Result<(), DlssError> {
) -> Result<CommandBuffer, DlssError> {
render_parameters.validate()?;

let sdk = self.sdk.lock().unwrap();
Expand Down Expand Up @@ -287,16 +296,23 @@ impl DlssRayReconstruction {
};

command_encoder.transition_resources(iter::empty(), render_parameters.barrier_list());

let mut dlss_command_encoder =
self.device
.create_command_encoder(&CommandEncoderDescriptor {
label: Some("dlss_ray_reconstruction"),
});
unsafe {
command_encoder.as_hal_mut::<Vulkan, _, _>(|command_encoder| {
dlss_command_encoder.as_hal_mut::<Vulkan, _, _>(|command_encoder| {
check_ngx_result(NGX_VULKAN_EVALUATE_DLSSD_EXT(
command_encoder.unwrap().raw_handle(),
self.feature,
sdk.parameters,
&mut eval_params,
))
})
})?;
}
Ok(dlss_command_encoder.finish())
}

/// Suggested subpixel camera jitter for a given frame.
Expand Down
26 changes: 21 additions & 5 deletions src/super_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::{
sync::{Arc, Mutex},
};
use wgpu::{
Adapter, CommandEncoder, CommandEncoderDescriptor, Device, Queue, Texture, TextureTransition,
TextureUses, TextureView, hal::api::Vulkan,
Adapter, CommandBuffer, CommandEncoder, CommandEncoderDescriptor, Device, Queue, Texture,
TextureTransition, TextureUses, TextureView, hal::api::Vulkan,
};

/// Camera-specific object for using DLSS Super Resolution.
Expand Down Expand Up @@ -107,12 +107,21 @@ impl DlssSuperResolution {
}

/// Encode rendering commands for DLSS Super Resolution.
///
/// The resulting command buffer should be submitted to a [`Queue`] in the same submit as the finished `command_encoder`, ordered immediately afterwards.
/// ```compile_fail
/// let mut my_command_encoder = device.create_command_encoder(descriptor);
/// let dlss_command_buffer = dlss.render(render_parameters, &mut my_command_encoder, adapter).unwrap();
/// queue.submit([my_command_encoder.finish(), dlss_command_buffer]);
/// ```
///
/// Failing to follow these rules is undefined behavior.
pub fn render(
&mut self,
render_parameters: DlssSuperResolutionRenderParameters,
command_encoder: &mut CommandEncoder,
adapter: &Adapter,
) -> Result<(), DlssError> {
) -> Result<CommandBuffer, DlssError> {
render_parameters.validate()?;

let sdk = self.sdk.lock().unwrap();
Expand Down Expand Up @@ -183,16 +192,23 @@ impl DlssSuperResolution {
};

command_encoder.transition_resources(iter::empty(), render_parameters.barrier_list());

let mut dlss_command_encoder =
self.device
.create_command_encoder(&CommandEncoderDescriptor {
label: Some("dlss_super_resolution"),
});
unsafe {
command_encoder.as_hal_mut::<Vulkan, _, _>(|command_encoder| {
dlss_command_encoder.as_hal_mut::<Vulkan, _, _>(|command_encoder| {
check_ngx_result(NGX_VULKAN_EVALUATE_DLSS_EXT(
command_encoder.unwrap().raw_handle(),
self.feature,
sdk.parameters,
&mut eval_params,
))
})
})?;
}
Ok(dlss_command_encoder.finish())
}

/// Suggested subpixel camera jitter for a given frame.
Expand Down