From b8f2b30d86fe7283f7bf5fcac264063bcf9e6500 Mon Sep 17 00:00:00 2001 From: mosure Date: Tue, 2 Jan 2024 00:19:43 -0600 Subject: [PATCH] fix: prioritize storage buffers and disable rayon sort camera debounce --- Cargo.toml | 6 +++--- src/render/mod.rs | 38 +------------------------------------- src/render/packed.wgsl | 2 +- src/render/planar.rs | 11 ++--------- src/render/planar.wgsl | 2 +- src/render/texture.wgsl | 2 +- src/sort/mod.rs | 10 +--------- src/sort/rayon.rs | 8 +------- 8 files changed, 11 insertions(+), 68 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 83ff0854..4e4e77af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,8 +40,8 @@ default = [ # "packed", "planar", - # "buffer_storage", - "buffer_texture", + "buffer_storage", + # "buffer_texture", # "f32", "f16", @@ -49,7 +49,7 @@ default = [ "query_select", "query_sparse", - # "sort_radix", + "sort_radix", "sort_rayon", "sort_std", diff --git a/src/render/mod.rs b/src/render/mod.rs index 5cf6650e..8313da84 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -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, diff --git a/src/render/packed.wgsl b/src/render/packed.wgsl index 624c0bb4..cfe3ba02 100644 --- a/src/render/packed.wgsl +++ b/src/render/packed.wgsl @@ -18,7 +18,7 @@ fn get_color( ray_direction: vec3, ) -> vec3 { 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); } diff --git a/src/render/planar.rs b/src/render/planar.rs index 529499d2..95a66ee8 100644 --- a/src/render/planar.rs +++ b/src/render/planar.rs @@ -1,13 +1,6 @@ +#[allow(unused_imports)] use bevy::render::{ - render_resource::{ - Buffer, - BufferInitDescriptor, - BufferUsages, - Extent3d, - ShaderType, - TextureDimension, - TextureFormat, - }, + render_resource::*, renderer::RenderDevice, }; diff --git a/src/render/planar.wgsl b/src/render/planar.wgsl index 72409b78..a2266442 100644 --- a/src/render/planar.wgsl +++ b/src/render/planar.wgsl @@ -24,7 +24,7 @@ fn get_color( ray_direction: vec3, ) -> vec3 { 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); } diff --git a/src/render/texture.wgsl b/src/render/texture.wgsl index 1c8e9d29..1950b77d 100644 --- a/src/render/texture.wgsl +++ b/src/render/texture.wgsl @@ -255,7 +255,7 @@ fn get_color( ray_direction: vec3, ) -> vec3 { 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 diff --git a/src/sort/mod.rs b/src/sort/mod.rs index e325729e..e44baf1f 100644 --- a/src/sort/mod.rs +++ b/src/sort/mod.rs @@ -7,15 +7,7 @@ use bevy::{ }, reflect::TypeUuid, render::{ - render_resource::{ - Buffer, - BufferInitDescriptor, - BufferUsages, - Extent3d, - ShaderType, - TextureDimension, - TextureFormat, - }, + render_resource::*, render_asset::{ RenderAsset, RenderAssetPlugin, diff --git a/src/sort/rayon.rs b/src/sort/rayon.rs index 538a9823..2edce7f2 100644 --- a/src/sort/rayon.rs +++ b/src/sort/rayon.rs @@ -41,7 +41,6 @@ pub fn rayon_sort( mut last_camera_position: Local, mut last_sort_time: Local>, mut period: Local, - mut camera_debounce: Local, mut sort_done: Local, ) { if last_sort_time.is_none() { @@ -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,