Skip to content

Commit 8d4d941

Browse files
committed
disable hit distance antilag for now
TODO: Re-enable after NRD upgrade
1 parent 77e5f64 commit 8d4d941

15 files changed

Lines changed: 124 additions & 112 deletions

File tree

crates/render/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bytemuck = "1.13"
3333

3434
# Processor dependencies
3535
shaderc = { version = "0.8", optional = true }
36-
playout = { path = "../../../playout", optional = true }
36+
playout = { git = "https://github.com/dust-engine/playout", optional = true }
3737
playout_macro = { path = "../../../playout/macro" }
3838

3939
[features]

crates/render/src/noise.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl BlueNoise {
4343
&self.unitvec3,
4444
&self.unitvec3_cosine,
4545
];
46-
for (i, (desc, handle)) in descriptors.iter_mut().zip(handles.iter()).enumerate() {
46+
for (_i, (desc, handle)) in descriptors.iter_mut().zip(handles.iter()).enumerate() {
4747
let Some(img) = image_arrays.get(*handle) else {
4848
return None;
4949
};

crates/render/src/pipeline/auto_exposure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bevy_ecs::{
55
system::{lifetimeless::SRes, Resource, SystemParamItem},
66
world::{FromWorld, Mut, World},
77
};
8-
use rhyolite::{future::run, descriptor::DescriptorSetLayout};
8+
use rhyolite::{descriptor::DescriptorSetLayout, future::run};
99

1010
use rhyolite::BufferExt;
1111
use rhyolite::{

crates/render/src/pipeline/nrd.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl NRDPipeline {
133133
descriptor_type: vk::DescriptorType::SAMPLER,
134134
descriptor_count: 1,
135135
stage_flags: vk::ShaderStageFlags::COMPUTE,
136-
p_immutable_samplers: sampler.raw()
136+
p_immutable_samplers: sampler.raw(),
137137
})
138138
.collect();
139139

@@ -769,9 +769,13 @@ impl Default for ReblurSettings {
769769
Self {
770770
common_settings: Default::default(),
771771
reblur_settings: nrd_sys::ReblurSettings {
772+
antilag_hit_distance_settings: AntilagHitDistanceSettings {
773+
enable: false,
774+
..Default::default()
775+
},
772776
antilag_intensity_settings: AntilagIntensitySettings {
773777
sensitivity_to_darkness: 0.1,
774-
enable: true,
778+
enable: false,
775779
..Default::default()
776780
},
777781
..Default::default()

crates/render/src/pipeline/standard.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use rand::Rng;
1818
use rhyolite::debug::DebugObject;
1919
use rhyolite::descriptor::DescriptorSetLayout;
2020
use rhyolite::future::{
21-
run, use_shared_image, use_shared_resource_flipflop, use_shared_state, use_state,
22-
GPUCommandFutureExt, SharedDeviceState, SharedDeviceStateHostContainer,
21+
run, use_shared_image, use_shared_resource_flipflop, use_shared_state, GPUCommandFutureExt,
22+
SharedDeviceState, SharedDeviceStateHostContainer,
2323
};
2424
use rhyolite::{
2525
accel_struct::AccelerationStructure,
@@ -74,7 +74,8 @@ impl RayTracingPipeline for StandardPipeline {
7474
}
7575
}
7676
fn pipeline_layout(device: &Arc<rhyolite::Device>) -> Arc<rhyolite::PipelineLayout> {
77-
let set0 = playout_macro::layout!("../../../../../assets/shaders/headers/layout.playout", 0);
77+
let set0 =
78+
playout_macro::layout!("../../../../../assets/shaders/headers/layout.playout", 0);
7879
let set0 = DescriptorSetLayout::new(device.clone(), &set0, Default::default()).unwrap();
7980
Arc::new(
8081
rhyolite::PipelineLayout::new(
@@ -123,13 +124,16 @@ impl RayTracingPipeline for StandardPipeline {
123124
asset_server.load("shaders/final_gather/ambient_occlusion.rgen"),
124125
vk::ShaderStageFlags::RAYGEN_KHR,
125126
),
126-
vec![SpecializedShader::for_shader(
127-
asset_server.load("shaders/final_gather/ambient_occlusion.rmiss"),
128-
vk::ShaderStageFlags::MISS_KHR,
129-
),SpecializedShader::for_shader(
130-
asset_server.load("shaders/final_gather/nee.rmiss"),
131-
vk::ShaderStageFlags::MISS_KHR,
132-
)],
127+
vec![
128+
SpecializedShader::for_shader(
129+
asset_server.load("shaders/final_gather/ambient_occlusion.rmiss"),
130+
vk::ShaderStageFlags::MISS_KHR,
131+
),
132+
SpecializedShader::for_shader(
133+
asset_server.load("shaders/final_gather/nee.rmiss"),
134+
vk::ShaderStageFlags::MISS_KHR,
135+
),
136+
],
133137
Vec::new(),
134138
),
135139
final_gather_ray_pipeline: RayTracingPipelineManager::new(
@@ -152,13 +156,16 @@ impl RayTracingPipeline for StandardPipeline {
152156
asset_server.load("shaders/surfel/surfel.rgen"),
153157
vk::ShaderStageFlags::RAYGEN_KHR,
154158
),
155-
vec![SpecializedShader::for_shader(
156-
asset_server.load("shaders/surfel/surfel.rmiss"),
157-
vk::ShaderStageFlags::MISS_KHR,
158-
),SpecializedShader::for_shader(
159-
asset_server.load("shaders/surfel/nee.rmiss"),
160-
vk::ShaderStageFlags::MISS_KHR,
161-
)],
159+
vec![
160+
SpecializedShader::for_shader(
161+
asset_server.load("shaders/surfel/surfel.rmiss"),
162+
vk::ShaderStageFlags::MISS_KHR,
163+
),
164+
SpecializedShader::for_shader(
165+
asset_server.load("shaders/surfel/nee.rmiss"),
166+
vk::ShaderStageFlags::MISS_KHR,
167+
),
168+
],
162169
Vec::new(),
163170
),
164171
pipeline_sbt_manager,
@@ -170,7 +177,8 @@ impl RayTracingPipeline for StandardPipeline {
170177
params: &mut SystemParamItem<M::ShaderParameterParams>,
171178
) -> crate::sbt::SbtIndex {
172179
self.primary_ray_pipeline.material_instance_added::<M>();
173-
self.ambient_occlusion_ray_pipeline.material_instance_added::<M>();
180+
self.ambient_occlusion_ray_pipeline
181+
.material_instance_added::<M>();
174182
self.final_gather_ray_pipeline
175183
.material_instance_added::<M>();
176184
self.surfel_ray_pipeline.material_instance_added::<M>();
@@ -337,7 +345,7 @@ impl StandardPipeline {
337345
if !surfel_pool_buffer.inner().reused() {
338346
fill_buffer(&mut surfel_pool_buffer, u32::MAX).await;
339347
}
340-
let mut spatial_hash_buffer = use_shared_state(
348+
let spatial_hash_buffer = use_shared_state(
341349
using!(),
342350
|_| {
343351
allocator.create_device_buffer_uninit(

crates/render/src/pipeline/tone_mapping.rs

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ use bevy_ecs::{
77
};
88
use rhyolite::{
99
ash::vk,
10-
descriptor::{DescriptorPool, DescriptorSetWrite, DescriptorSetLayout},
10+
descriptor::{DescriptorPool, DescriptorSetLayout, DescriptorSetWrite},
1111
future::{
1212
run, use_per_frame_state, DisposeContainer, GPUCommandFuture, RenderData, RenderImage,
1313
RenderRes,
1414
},
15-
utils::{retainer::Retainer, format::{ColorSpacePrimaries, ColorSpaceTransferFunction}},
15+
utils::{
16+
format::{ColorSpacePrimaries, ColorSpaceTransferFunction},
17+
retainer::Retainer,
18+
},
1619
BufferExt, BufferLike, ComputePipeline, HasDevice, ImageViewExt, ImageViewLike, PipelineLayout,
1720
};
18-
use rhyolite::{
19-
future::Disposable,
20-
macros::commands,
21-
utils::format::ColorSpace,
22-
};
21+
use rhyolite::{future::Disposable, macros::commands, utils::format::ColorSpace};
2322
use rhyolite_bevy::Queues;
2423

2524
use crate::{CachedPipeline, PipelineCache, ShaderModule, SpecializedShader};
@@ -41,7 +40,6 @@ impl FromWorld for ToneMappingPipeline {
4140
let num_frame_in_flight = queues.num_frame_in_flight();
4241
let device = queues.device().clone();
4342

44-
4543
let set0 = playout_macro::layout!("../../../../../assets/shaders/tone_map.playout", 0);
4644
let set0 = DescriptorSetLayout::new(device.clone(), &set0, Default::default()).unwrap();
4745
let layout = Arc::new(
@@ -64,7 +62,7 @@ impl FromWorld for ToneMappingPipeline {
6462
pipeline: None,
6563
display_color_space_transfer_fn: ColorSpaceTransferFunction::LINEAR,
6664
desc_pool: Retainer::new(desc_pool),
67-
scene_color_space: ColorSpacePrimaries::ACES_AP1
65+
scene_color_space: ColorSpacePrimaries::ACES_AP1,
6866
}
6967
}
7068
}
@@ -95,31 +93,29 @@ impl ToneMappingPipeline {
9593
self.pipeline = None;
9694
self.display_color_space_transfer_fn = output_color_space.transfer_function;
9795
}
98-
let pipeline = self
99-
.pipeline
100-
.get_or_insert_with(|| {
101-
let mat = self
102-
.scene_color_space
103-
.to_color_space(&output_color_space.primaries);
104-
let transfer_function = output_color_space.transfer_function as u32;
96+
let pipeline = self.pipeline.get_or_insert_with(|| {
97+
let mat = self
98+
.scene_color_space
99+
.to_color_space(&output_color_space.primaries);
100+
let transfer_function = output_color_space.transfer_function as u32;
105101

106-
let shader = asset_server.load("shaders/tone_map.comp");
107-
pipeline_cache.add_compute_pipeline(
108-
self.layout.clone(),
109-
SpecializedShader::for_shader(shader, vk::ShaderStageFlags::COMPUTE)
110-
.with_const(0, transfer_function)
111-
.with_const(1, mat.x_axis.x)
112-
.with_const(2, mat.x_axis.y)
113-
.with_const(3, mat.x_axis.z)
114-
.with_const(4, mat.y_axis.x)
115-
.with_const(5, mat.y_axis.y)
116-
.with_const(6, mat.y_axis.z)
117-
.with_const(7, mat.z_axis.x)
118-
.with_const(8, mat.z_axis.y)
119-
.with_const(9, mat.z_axis.z)
120-
.into(),
121-
)
122-
});
102+
let shader = asset_server.load("shaders/tone_map.comp");
103+
pipeline_cache.add_compute_pipeline(
104+
self.layout.clone(),
105+
SpecializedShader::for_shader(shader, vk::ShaderStageFlags::COMPUTE)
106+
.with_const(0, transfer_function)
107+
.with_const(1, mat.x_axis.x)
108+
.with_const(2, mat.x_axis.y)
109+
.with_const(3, mat.x_axis.z)
110+
.with_const(4, mat.y_axis.x)
111+
.with_const(5, mat.y_axis.y)
112+
.with_const(6, mat.y_axis.z)
113+
.with_const(7, mat.z_axis.x)
114+
.with_const(8, mat.z_axis.y)
115+
.with_const(9, mat.z_axis.z)
116+
.into(),
117+
)
118+
});
123119
let desc_pool = &mut self.desc_pool;
124120
commands! { move
125121
let Some(pipeline) = pipeline_cache.retrieve(pipeline, shader_assets) else {

crates/render/src/shader/glsl.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::HashMap, path::{Path, PathBuf}};
1+
use std::{collections::HashMap, path::PathBuf};
22

33
use bevy_app::Plugin;
44
use bevy_asset::{
@@ -99,11 +99,18 @@ impl AssetLoader for GlslShadercCompiler {
9999
continue;
100100
}
101101
let path = match ty {
102-
shaderc::IncludeType::Relative => ctx.path().parent().unwrap().join(&filename).join(included_filename),
102+
shaderc::IncludeType::Relative => ctx
103+
.path()
104+
.parent()
105+
.unwrap()
106+
.join(&filename)
107+
.join(included_filename),
103108
shaderc::IncludeType::Standard => included_filename.into(),
104109
};
105110
let normalized_path = normalize_path(&path);
106-
let inc = ctx.load_direct(AssetPath::from_path(normalized_path)).await?;
111+
let inc = ctx
112+
.load_direct(AssetPath::from_path(normalized_path))
113+
.await?;
107114
let source: &GlslShaderSource = inc.get().unwrap();
108115
pending_sources.push((included_filename.to_string(), source.source.clone()));
109116
}
@@ -303,4 +310,3 @@ impl AssetLoader for PlayoutGlslLoader {
303310
&["playout"]
304311
}
305312
}
306-

crates/rhyolite/src/descriptor/layout.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::Device;
22
use ash::{prelude::VkResult, vk};
3-
use std::{sync::Arc, collections::BTreeMap};
3+
use std::{collections::BTreeMap, sync::Arc};
44

55
pub struct DescriptorSetLayout {
66
device: Arc<Device>,
@@ -58,11 +58,10 @@ impl DescriptorSetLayout {
5858
}
5959
}
6060

61-
6261
Ok(Self {
6362
device,
6463
raw,
65-
desc_types: desc_types.into_iter().collect()
64+
desc_types: desc_types.into_iter().collect(),
6665
})
6766
}
6867
pub unsafe fn raw(&self) -> vk::DescriptorSetLayout {

crates/rhyolite/src/shader.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use ash::prelude::VkResult;
22
use ash::vk;
3-
use smallvec::SmallVec;
3+
44
use std::ffi::CStr;
55
use std::fmt::Debug;
66
use std::ops::Deref;
7-
use std::{collections::HashMap, sync::Arc};
7+
use std::sync::Arc;
88

99
use crate::descriptor::DescriptorSetLayout;
10-
use crate::sampler::Sampler;
10+
1111
use crate::{Device, HasDevice};
1212

1313
pub struct SpirvShader<T: Deref<Target = [u32]>> {
@@ -74,7 +74,6 @@ impl Drop for ShaderModule {
7474
}
7575
}
7676

77-
7877
#[derive(Clone)]
7978
pub struct ShaderModuleEntryPoint {
8079
pub stage: vk::ShaderStageFlags,

0 commit comments

Comments
 (0)