Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c75b2b4
Initial DLSS implementation
JMS55 Jun 29, 2025
af1b47c
Update example description
JMS55 Jun 29, 2025
eb8c77f
Rename variable
JMS55 Jun 29, 2025
951c3f9
Merge commit '1579256709dd64dcc4910b0bad5e81622d9ede0c' into dlss3
JMS55 Jul 6, 2025
742ebfa
Fix merge
JMS55 Jul 6, 2025
463c66d
Switch to git dep
JMS55 Jul 6, 2025
950f3e8
Merge branch 'main' into dlss3
JMS55 Jul 6, 2025
bf56980
Add release notes
JMS55 Jul 6, 2025
6b960b0
Modify release notes
JMS55 Jul 6, 2025
cf1a1f7
Add note about DlssSupported
JMS55 Jul 6, 2025
1b71463
Merge commit '5e3927ba489f597dd189f63286dc7985840db1b5' into dlss3
JMS55 Jul 8, 2025
10c96e8
Fix resolution override to work even if the camera lacks a viewport
JMS55 Jul 8, 2025
04f488b
Update release notes
JMS55 Jul 8, 2025
e2a9761
Docs
JMS55 Jul 8, 2025
fda09d1
Fix typo
JMS55 Jul 8, 2025
ab113c8
Fix
JMS55 Jul 8, 2025
5ab0093
Add missing import
JMS55 Jul 8, 2025
baa2668
Switch link to https://github.com/bevyengine/dlss_wgpu
JMS55 Jul 9, 2025
e2d8a9e
Fix another link
JMS55 Jul 9, 2025
8084745
Merge branch 'main' into dlss3
JMS55 Jul 9, 2025
e202226
Update release-content/release-notes/dlss.md
JMS55 Jul 9, 2025
1701bb1
Add blurb
JMS55 Jul 9, 2025
6f9114b
Merge branch 'main' into dlss3
JMS55 Jul 9, 2025
484310d
Move DLSS setup to ManageViews, so that prepare systems can later che…
JMS55 Jul 11, 2025
27f40ef
Merge commit '20dfae9a2d07038bda2921f82af50ded6151c3de' into dlss3
JMS55 Jul 11, 2025
d962a37
Release notes
JMS55 Jul 11, 2025
baa46ae
Have Solari account for MainPassResolutionOverride
JMS55 Jul 11, 2025
a6751bd
Misc
JMS55 Jul 15, 2025
b89387d
Merge commit '2bddbdfd7c920d1ea61245dcdb7ff1c155e6b03b' into dlss3
JMS55 Jul 15, 2025
b0303fe
Fix bug
JMS55 Jul 15, 2025
ded4b9f
Merge commit '04cc4bb55681fca705cd97ba3b441d24a0b3bad7' into dlss3
JMS55 Aug 2, 2025
497e85f
Fix rebase
JMS55 Aug 2, 2025
e33d1f0
More fixes
JMS55 Aug 2, 2025
3499283
Fix
JMS55 Aug 2, 2025
733017a
Use dlss_wgpu::create_instance
JMS55 Aug 2, 2025
e66ba3f
Testing ray reconstruction setup
JMS55 Aug 2, 2025
1bce5f5
Fix
JMS55 Aug 2, 2025
f707d2d
More fixes
JMS55 Aug 2, 2025
97989d1
Use main branch of dlss_wgpu
JMS55 Aug 2, 2025
4d7a107
Fix urls
JMS55 Aug 2, 2025
8c7df68
Fix solari copy under DLSS
JMS55 Aug 3, 2025
546244a
Merge commit '0b30b6ba588abfe5d862631603860e30c461f9d8' into dlss3
JMS55 Aug 3, 2025
da757a8
Trait-ify DLSS so that DLSS-RR can be supported easily
JMS55 Aug 3, 2025
40acb71
Fix render world cleanup
JMS55 Aug 3, 2025
24c6bce
Markdown lint
JMS55 Aug 3, 2025
f644683
Have bevy_anti_aliasing instead of bevy_internal enable bevy_render/dlss
JMS55 Aug 3, 2025
6225e61
Add main_pass_viewport for shaders
JMS55 Aug 3, 2025
975a10b
Use main_pass_viewport in SolariLighting
JMS55 Aug 3, 2025
4c87049
Merge commit 'b378e0ad9701ac1ad98763ee6106bba164e20907' into dlss3
JMS55 Aug 4, 2025
b6412b5
Merge commit '40b6940356e4ba1cf5ff3dc7a43f7261d660f242' into dlss3
JMS55 Aug 7, 2025
e2f6ec4
Fix rebase
JMS55 Aug 7, 2025
f205394
Add timing span
JMS55 Aug 7, 2025
160c386
Merge commit '777556453cacd3ab9c69df5eeb2ba7526cb0c0b8' into dlss3
JMS55 Aug 9, 2025
9cb2e1a
Don't enable DLSS for bevy_ci_testing
JMS55 Aug 9, 2025
890bc71
Switch back to bevy repo for dlss_wgpu
JMS55 Aug 9, 2025
73c35a7
Finish hooking up DLSS-RR
JMS55 Aug 9, 2025
b6aaea4
Use specular motion vectors as it's better than specular hit distance
JMS55 Aug 9, 2025
817cd14
Format
JMS55 Aug 9, 2025
e954fc9
Merge branch 'main' into dlss3
JMS55 Aug 9, 2025
622522c
Merge commit '3f14e3486063b8c2435e06130cf538135e30df0b' into dlss3
JMS55 Aug 10, 2025
d7cde18
Add seperate force_disable_dlss feature
JMS55 Aug 10, 2025
9209d3b
Build templated pages
JMS55 Aug 10, 2025
53e1c2f
Add note about UUID
JMS55 Aug 10, 2025
548b53d
Remove force_disable_dlss from public example
JMS55 Aug 10, 2025
45d6f3c
Merge branch 'main' into dlss3
JMS55 Aug 10, 2025
4eeab79
Revert "Remove force_disable_dlss from public example"
JMS55 Aug 10, 2025
73ff83f
Merge commit 'e742730e3540b67643389c80d35b4478851941a3' into dlss3
JMS55 Aug 11, 2025
a406188
Merge branch 'main' into dlss3
JMS55 Aug 11, 2025
2bf8837
Merge commit 'c0eb89eedcf0f451a26ea71e456532b8b8311a29' into dlss3
JMS55 Aug 12, 2025
7b3f14b
Fix merge
JMS55 Aug 12, 2025
3bfd551
Port to "raw vulkan init"
cart Aug 14, 2025
c349dcd
Address feedback
cart Aug 14, 2025
da202cc
Merge commit 'a76e0a20d9ea44f9f042e15a8624024f41e1f5dd' into dlss3
JMS55 Aug 15, 2025
bbf69b3
Use published dlss_wgpu
JMS55 Aug 15, 2025
9374266
Fix feature
JMS55 Aug 15, 2025
20b7d61
Credit cart
JMS55 Aug 15, 2025
4d6d6ad
Remove unused import
JMS55 Aug 15, 2025
11ad770
Fix some things
cart Aug 15, 2025
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
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough"]
# Statically linked DXC shader compiler for DirectX 12
statically-linked-dxc = ["bevy_internal/statically-linked-dxc"]

# Forces the wgpu instance to be initialized using the raw Vulkan HAL, enabling additional configuration
raw_vulkan_init = ["bevy_internal/raw_vulkan_init"]

# Tracing support, saving a file in Chrome Tracing format
trace_chrome = ["trace", "bevy_internal/trace_chrome"]

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_anti_aliasing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trace = []
webgl = []
webgpu = []
smaa_luts = ["bevy_image/ktx2", "bevy_image/zstd"]
dlss = ["dep:dlss_wgpu", "bevy_render/dlss"]
dlss = ["dep:dlss_wgpu", "dep:uuid", "bevy_render/raw_vulkan_init"]
force_disable_dlss = ["dlss_wgpu?/mock"]

[dependencies]
Expand All @@ -35,6 +35,7 @@ bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.17.0-dev" }
# other
tracing = { version = "0.1", default-features = false, features = ["std"] }
dlss_wgpu = { git = "https://github.com/bevyengine/dlss_wgpu", optional = true }
uuid = { version = "1", optional = true }

[lints]
workspace = true
Expand Down
136 changes: 110 additions & 26 deletions crates/bevy_anti_aliasing/src/dlss/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ mod extract;
mod node;
mod prepare;

pub use dlss_wgpu::DlssPerfQualityMode;

use bevy_app::{App, Plugin};
use bevy_core_pipeline::{
core_3d::graph::{Core3d, Node3d},
prepass::{DepthPrepass, MotionVectorPrepass},
};
use bevy_ecs::{
component::Component, prelude::ReflectComponent, resource::Resource,
schedule::IntoScheduleConfigs,
};
use bevy_ecs::prelude::*;
use bevy_math::{UVec2, Vec2};
use bevy_reflect::{reflect_remote, Reflect};
use bevy_render::{
camera::{MipBias, TemporalJitter},
render_graph::{RenderGraphExt, ViewNodeRunner},
renderer::{RenderDevice, RenderQueue},
renderer::{
raw_vulkan_init::{AdditionalVulkanFeatures, RawVulkanInitSettings},
RenderDevice, RenderQueue,
},
texture::CachedTexture,
view::{prepare_view_targets, Hdr},
ExtractSchedule, Render, RenderApp, RenderSystems,
Expand All @@ -42,52 +44,118 @@ use dlss_wgpu::{
DlssRayReconstruction, DlssRayReconstructionDepthMode, DlssRayReconstructionRoughnessMode,
},
super_resolution::DlssSuperResolution,
FeatureSupport,
};
use std::{
marker::PhantomData,
ops::Deref,
sync::{Arc, Mutex},
};
use tracing::info;
use uuid::Uuid;

pub use bevy_render::{
DlssProjectId, DlssRayReconstructionSupported, DlssSuperResolutionSupported,
};
pub use dlss_wgpu::DlssPerfQualityMode;
/// Initializes DLSS support in the renderer. This must be registered before [`RenderPlugin`](bevy_render::RenderPlugin) because
/// it configures render init code.
#[derive(Default)]
pub struct DlssInitPlugin;

impl Plugin for DlssInitPlugin {
fn build(&self, app: &mut App) {
let dlss_project_id = app.world().get_resource::<DlssProjectId>()
.expect("The `dlss` feature is enabled, but DlssProjectId was not added to the App before DlssPlugin.").0;
let mut raw_vulkan_settings = app
.world_mut()
.get_resource_or_init::<RawVulkanInitSettings>();

raw_vulkan_settings.create_instance_callbacks.push(Arc::new(
move |mut args, additional_vulkan_features| {
let mut feature_support = FeatureSupport::default();
match dlss_wgpu::register_instance_extensions(
dlss_project_id,
&mut args,
&mut feature_support,
) {
Ok(_) => {
if feature_support.ray_reconstruction_supported {
additional_vulkan_features.register::<DlssRayReconstructionSupported>();
}
if feature_support.super_resolution_supported {
additional_vulkan_features.register::<DlssSuperResolutionSupported>();
}
}
Err(_) => todo!(),
}
},
));

raw_vulkan_settings.create_device_callbacks.push(Arc::new(
move |mut args, adapter, additional_vulkan_features| {
let mut feature_support = FeatureSupport::default();
match dlss_wgpu::register_device_extensions(
dlss_project_id,
&mut args,
adapter,
&mut feature_support,
) {
Ok(_) => {
if feature_support.ray_reconstruction_supported {
additional_vulkan_features.register::<DlssRayReconstructionSupported>();
}
if feature_support.super_resolution_supported {
additional_vulkan_features.register::<DlssSuperResolutionSupported>();
}
}
Err(_) => todo!(),
}
},
));
}
}

/// Enables DLSS support. This requires [`DlssInitPlugin`] to function, which must be manually registered in the correct order
/// prior to registering this plugin.
#[derive(Default)]
pub struct DlssPlugin;

impl Plugin for DlssPlugin {
fn build(&self, app: &mut App) {
app.register_type::<Dlss<DlssSuperResolutionFeature>>()
.register_type::<Dlss<DlssRayReconstructionFeature>>();
}

fn finish(&self, app: &mut App) {
if app
.world()
.get_resource::<DlssSuperResolutionSupported>()
.is_none()
{
info!("DLSS is not supported on this system");
let (super_resolution_supported, ray_reconstruction_supported) = {
let features = app
.sub_app_mut(RenderApp)
.world()
.resource::<AdditionalVulkanFeatures>();
(
features.has::<DlssSuperResolutionSupported>(),
features.has::<DlssRayReconstructionSupported>(),
)
};
if !super_resolution_supported {
return;
}

let dlss_project_id = app.world().resource::<DlssProjectId>().0;

let render_app = app.get_sub_app_mut(RenderApp).unwrap();
let render_device = render_app.world().resource::<RenderDevice>().clone();

let dlss_sdk =
dlss_wgpu::DlssSdk::new(dlss_project_id, render_device.wgpu_device().clone());
let wgpu_device = {
let render_world = app.sub_app(RenderApp).world();
let render_device = render_world.resource::<RenderDevice>().wgpu_device();
render_device.clone()
};
let project_id = app.world().get_resource::<DlssProjectId>()
.expect("The `dlss` feature is enabled, but DlssProjectId was not added to the App before DlssPlugin.");
let dlss_sdk = dlss_wgpu::DlssSdk::new(project_id.0, wgpu_device);
if dlss_sdk.is_err() {
app.world_mut()
.remove_resource::<DlssSuperResolutionSupported>();
info!("DLSS is not supported on this system");
return;
}

render_app
app.insert_resource(DlssSuperResolutionSupported);
if ray_reconstruction_supported {
app.insert_resource(DlssRayReconstructionSupported);
}

app.sub_app_mut(RenderApp)
.insert_resource(DlssSdk(dlss_sdk.unwrap()))
.add_systems(
ExtractSchedule,
Expand Down Expand Up @@ -303,3 +371,19 @@ enum DlssPerfQualityModeRemoteReflect {

#[derive(Resource)]
struct DlssSdk(Arc<Mutex<dlss_wgpu::DlssSdk>>);

/// Application-specific ID for DLSS.
///
/// See the DLSS programming guide for more info.
#[derive(Resource, Clone)]
pub struct DlssProjectId(pub Uuid);

/// When DLSS Super Resolution is supported by the current system, this resource will exist in the main world.
/// Otherwise this resource will be absent.
#[derive(Resource, Clone, Copy)]
pub struct DlssSuperResolutionSupported;

/// When DLSS Ray Reconstruction is supported by the current system, this resource will exist in the main world.
/// Otherwise this resource will be absent.
#[derive(Resource, Clone, Copy)]
pub struct DlssRayReconstructionSupported;
3 changes: 3 additions & 0 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ spirv_shader_passthrough = ["bevy_render/spirv_shader_passthrough"]
# TODO: When wgpu switches to DirectX 12 instead of Vulkan by default on windows, make this a default feature
statically-linked-dxc = ["bevy_render/statically-linked-dxc"]

# Forces the wgpu instance to be initialized using the raw Vulkan HAL, enabling additional configuration
raw_vulkan_init = ["bevy_render/raw_vulkan_init"]

# Include tonemapping LUT KTX2 files.
tonemapping_luts = ["bevy_core_pipeline/tonemapping_luts"]
# Include Bluenoise texture for environment map generation.
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_internal/src/default_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ plugin_group! {
bevy_scene:::ScenePlugin,
#[cfg(feature = "bevy_winit")]
bevy_winit:::WinitPlugin,
#[custom(cfg(all(feature = "dlss", not(feature = "force_disable_dlss"))))]
bevy_anti_aliasing::dlss:::DlssInitPlugin,
#[cfg(feature = "bevy_render")]
bevy_render:::RenderPlugin,
// NOTE: Load this after renderer initialization so that it knows about the supported
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spirv_shader_passthrough = ["wgpu/spirv"]
# TODO: When wgpu switches to DirectX 12 instead of Vulkan by default on windows, make this a default feature
statically-linked-dxc = ["wgpu/static-dxc"]

# Forces the wgpu instance to be initialized using the raw Vulkan HAL, enabling additional configuration
raw_vulkan_init = ["wgpu/vulkan"]

trace = ["profiling"]
tracing-tracy = ["dep:tracy-client"]
ci_limits = []
Expand Down Expand Up @@ -91,7 +94,6 @@ wgpu = { version = "26", default-features = false, features = [
"fragile-send-sync-non-atomic-wasm",
] }
naga = { version = "26", features = ["wgsl-in"] }
dlss_wgpu = { git = "https://github.com/bevyengine/dlss_wgpu", optional = true }
bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
downcast-rs = { version = "2", default-features = false, features = ["std"] }
thiserror = { version = "2", default-features = false }
Expand Down
67 changes: 18 additions & 49 deletions crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,20 @@ impl Plugin for RenderPlugin {

let settings = render_creation.clone();

#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
let dlss_project_id = app
.world()
.get_resource::<DlssProjectId>()
.expect("The `dlss` feature is enabled, but DlssProjectId was not added to the App before DefaultPlugins.")
.0;
#[cfg(feature = "raw_vulkan_init")]
let raw_vulkan_init_settings = app
.world_mut()
.get_resource::<renderer::raw_vulkan_init::RawVulkanInitSettings>()
.cloned()
.unwrap_or_default();

let async_renderer = async move {
let render_resources = renderer::initialize_renderer(
backends,
primary_window,
&settings,
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
dlss_project_id,
#[cfg(feature = "raw_vulkan_init")]
raw_vulkan_init_settings,
)
.await;

Expand Down Expand Up @@ -414,19 +414,9 @@ impl Plugin for RenderPlugin {
if let Some(future_render_resources) =
app.world_mut().remove_resource::<FutureRenderResources>()
{
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
let RenderResources(
device,
queue,
adapter_info,
render_adapter,
instance,
dlss_super_resolution_supported,
dlss_ray_reconstruction_supported,
) = future_render_resources.0.lock().unwrap().take().unwrap();
#[cfg(any(not(feature = "dlss"), feature = "force_disable_dlss"))]
let RenderResources(device, queue, adapter_info, render_adapter, instance) =
future_render_resources.0.lock().unwrap().take().unwrap();
let render_resources = future_render_resources.0.lock().unwrap().take().unwrap();
let RenderResources(device, queue, adapter_info, render_adapter, instance, ..) =
render_resources;

let compressed_image_format_support = CompressedImageFormatSupport(
CompressedImageFormats::from_features(device.features()),
Expand All @@ -438,17 +428,15 @@ impl Plugin for RenderPlugin {
.insert_resource(render_adapter.clone())
.insert_resource(compressed_image_format_support);

#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
if let Some(dlss_super_resolution_supported) = dlss_super_resolution_supported {
app.insert_resource(dlss_super_resolution_supported);
}
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
if let Some(dlss_ray_reconstruction_supported) = dlss_ray_reconstruction_supported {
app.insert_resource(dlss_ray_reconstruction_supported);
}

let render_app = app.sub_app_mut(RenderApp);

#[cfg(feature = "raw_vulkan_init")]
{
let additional_vulkan_features: renderer::raw_vulkan_init::AdditionalVulkanFeatures =
render_resources.5;
render_app.insert_resource(additional_vulkan_features);
}

render_app
.insert_resource(instance)
.insert_resource(PipelineCache::new(
Expand Down Expand Up @@ -603,22 +591,3 @@ pub fn get_mali_driver_version(adapter: &RenderAdapter) -> Option<u32> {

None
}

/// Application-specific ID for DLSS.
///
/// See the DLSS programming guide for more info.
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
#[derive(Resource)]
pub struct DlssProjectId(pub bevy_asset::uuid::Uuid);

/// When DLSS Super Resolution is supported by the current system, this resource will exist in the main world.
/// Otherwise this resource will be absent.
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
#[derive(Resource, Clone, Copy)]
pub struct DlssSuperResolutionSupported;

/// When DLSS Ray Reconstruction is supported by the current system, this resource will exist in the main world.
/// Otherwise this resource will be absent.
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
#[derive(Resource, Clone, Copy)]
pub struct DlssRayReconstructionSupported;
Loading