diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0f6f8..04a025b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 5c264c1..4f514e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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" diff --git a/README.md b/README.md index 5a98994..f677e1d 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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 @@ -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 diff --git a/src/initialization.rs b/src/initialization.rs index bf447ed..58a4a6a 100644 --- a/src/initialization.rs +++ b/src/initialization.rs @@ -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); diff --git a/src/lib.rs b/src/lib.rs index 4f38d43..2ab12ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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}; //! @@ -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"))] diff --git a/src/ray_reconstruction.rs b/src/ray_reconstruction.rs index 01ed547..a1e8a02 100644 --- a/src/ray_reconstruction.rs +++ b/src/ray_reconstruction.rs @@ -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. @@ -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 { render_parameters.validate()?; let sdk = self.sdk.lock().unwrap(); @@ -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::(|command_encoder| { + dlss_command_encoder.as_hal_mut::(|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. diff --git a/src/super_resolution.rs b/src/super_resolution.rs index cbf33f3..e6498c8 100644 --- a/src/super_resolution.rs +++ b/src/super_resolution.rs @@ -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. @@ -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 { render_parameters.validate()?; let sdk = self.sdk.lock().unwrap(); @@ -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::(|command_encoder| { + dlss_command_encoder.as_hal_mut::(|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.