Skip to content

Commit

Permalink
fix: prioritize storage buffers and disable rayon sort camera debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure committed Jan 2, 2024
1 parent 6f57b78 commit b8f2b30
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 68 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ default = [
# "packed",
"planar",

# "buffer_storage",
"buffer_texture",
"buffer_storage",
# "buffer_texture",

# "f32",
"f16",

"query_select",
"query_sparse",

# "sort_radix",
"sort_radix",
"sort_rayon",
"sort_std",

Expand Down
38 changes: 1 addition & 37 deletions src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,7 @@ use bevy::{
SetItemPipeline,
TrackedRenderPass,
},
render_resource::{
BindGroup,
BindGroupEntry,
BindGroupLayout,
BindGroupLayoutDescriptor,
BindGroupLayoutEntry,
BindingResource,
BindingType,
BlendState,
Buffer,
BufferBinding,
BufferBindingType,
BufferInitDescriptor,
BufferUsages,
ColorTargetState,
ColorWrites,
CompareFunction,
DepthBiasState,
DepthStencilState,
FragmentState,
FrontFace,
MultisampleState,
PipelineCache,
PolygonMode,
PrimitiveState,
PrimitiveTopology,
RenderPipelineDescriptor,
ShaderDefVal,
ShaderStages,
ShaderType,
SpecializedRenderPipeline,
SpecializedRenderPipelines,
StencilFaceState,
StencilState,
TextureFormat,
VertexState,
},
render_resource::*,
renderer::RenderDevice,
Render,
RenderApp,
Expand Down
2 changes: 1 addition & 1 deletion src/render/packed.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn get_color(
ray_direction: vec3<f32>,
) -> vec3<f32> {
let sh = get_spherical_harmonics(index);
let color = spherical_harmonics_lookup(sh, ray_direction);
let color = spherical_harmonics_lookup(ray_direction, sh);
return srgb_to_linear(color);
}

Expand Down
11 changes: 2 additions & 9 deletions src/render/planar.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#[allow(unused_imports)]
use bevy::render::{
render_resource::{
Buffer,
BufferInitDescriptor,
BufferUsages,
Extent3d,
ShaderType,
TextureDimension,
TextureFormat,
},
render_resource::*,
renderer::RenderDevice,
};

Expand Down
2 changes: 1 addition & 1 deletion src/render/planar.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn get_color(
ray_direction: vec3<f32>,
) -> vec3<f32> {
let sh = get_spherical_harmonics(index);
let color = spherical_harmonics_lookup(sh, ray_direction);
let color = spherical_harmonics_lookup(ray_direction, sh);
return srgb_to_linear(color);
}

Expand Down
2 changes: 1 addition & 1 deletion src/render/texture.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn get_color(
ray_direction: vec3<f32>,
) -> vec3<f32> {
let sh = get_spherical_harmonics(index);
let color = spherical_harmonics_lookup(sh, ray_direction);
let color = spherical_harmonics_lookup(ray_direction, sh);
return srgb_to_linear(color);
}
#endif
Expand Down
10 changes: 1 addition & 9 deletions src/sort/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ use bevy::{
},
reflect::TypeUuid,
render::{
render_resource::{
Buffer,
BufferInitDescriptor,
BufferUsages,
Extent3d,
ShaderType,
TextureDimension,
TextureFormat,
},
render_resource::*,
render_asset::{
RenderAsset,
RenderAssetPlugin,
Expand Down
8 changes: 1 addition & 7 deletions src/sort/rayon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn rayon_sort(
mut last_camera_position: Local<Vec3>,
mut last_sort_time: Local<Option<Instant>>,
mut period: Local<std::time::Duration>,
mut camera_debounce: Local<bool>,
mut sort_done: Local<bool>,
) {
if last_sort_time.is_none() {
Expand All @@ -68,18 +67,13 @@ pub fn rayon_sort(

if camera_movement {
*sort_done = false;
*camera_debounce = true;
} else {
if *sort_done {
return;
}
}

if *camera_debounce {
*last_camera_position = camera_position;
*camera_debounce = false;
return;
}
*last_camera_position = camera_position;

for (
gaussian_cloud_handle,
Expand Down

0 comments on commit b8f2b30

Please sign in to comment.