Skip to content

Commit

Permalink
feat: cpu sort (#43)
Browse files Browse the repository at this point in the history
* test: initial scaffolding of rendering tests

* feat: pipeline capture tests

* fix: add main to radix gpu test

* fix: bevy_inspector_egui patch and render_context access

* test: radix sort order

* fix: debug_gpu feature

* more radix testing

* refactor: scaffold for CPU/GPU sort backends

* refactor: generic sort plugin and entry_buffer_a migration

* feat: CPU and GPU sort runtime switching

* fix: CPU sort skipping logic

* fix: radix test must use radix sort

* fix: gaussian cloud asset mutation on CPU sort

* docs: cleanup TODO comments
  • Loading branch information
mosure committed Dec 15, 2023
1 parent 7c11e18 commit 5c9a20a
Show file tree
Hide file tree
Showing 24 changed files with 1,182 additions and 197 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ jobs:

- name: test
run: cargo test

# - name: gaussian render test
# run: cargo run --bin test_gaussian

# - name: radix sort test
# run: cargo run --bin test_radix --features="debug_gpu"
11 changes: 11 additions & 0 deletions .vscode/bevy_gaussian_splatting.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "../"
},
{
"path": "../../bevy"
}
],
"settings": {}
}
79 changes: 65 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,90 @@
[package]
name = "bevy_gaussian_splatting"
description = "bevy gaussian splatting render pipeline plugin"
version = "0.4.0"
version = "0.5.0"
edition = "2021"
authors = ["mosure <[email protected]>"]
license = "MIT"
keywords = ["bevy", "gaussian-splatting", "render-pipeline", "ply"]
categories = ["computer-vision", "graphics", "rendering", "rendering::data-formats"]
keywords = [
"bevy",
"gaussian-splatting",
"render-pipeline",
"ply",
]
categories = [
"computer-vision",
"graphics",
"rendering",
"rendering::data-formats",
]
homepage = "https://github.com/mosure/bevy_gaussian_splatting"
repository = "https://github.com/mosure/bevy_gaussian_splatting"
readme = "README.md"
exclude = [".devcontainer", ".github", "docs", "dist", "build", "assets", "credits"]
exclude = [
".devcontainer",
".github",
"docs",
"dist",
"build",
"assets",
"credits",
]
default-run = "viewer"


[features]
default = ["io_flexbuffers", "io_ply"]
default = [
"io_flexbuffers",
"io_ply",
"sort_radix",
"sort_rayon",
"tooling",
"viewer",
]

debug_gpu = []

io_bincode2 = ["bincode2", "flate2"]
io_flexbuffers = ["flexbuffers"]
io_ply = ["ply-rs"]

sort_radix = []
sort_rayon = [
"rayon",
"wasm-bindgen-rayon",
]

tooling = [
"byte-unit",
]

viewer = [
"bevy-inspector-egui",
"bevy_panorbit_camera",
]



[dependencies]
bevy-inspector-egui = "0.21"
bevy_panorbit_camera = "0.9"
bevy-inspector-egui = { version = "0.21", optional = true }
bevy_panorbit_camera = { version = "0.9", optional = true }
bincode2 = { version = "2.0", optional = true }
byte-unit = "5.0.3"
byte-unit = { version = "5.0", optional = true }
bytemuck = "1.14"
flate2 = { version = "1.0", optional = true }
flexbuffers = { version = "2.0", optional = true }
ply-rs = { version = "0.1", optional = true }
rand = "0.8"
rayon = { version = "1.8", optional = true }
serde = "1.0"
static_assertions = "1.1"
wgpu = "0.17.1"


[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
wasm-bindgen = "0.2"
wasm-bindgen-rayon = { version = "1.0", optional = true }


# TODO: use minimal bevy features
Expand All @@ -50,7 +96,6 @@ default-features = true
version = "0.12"
default-features = true
features = [
'bevy_ci_testing',
'debug_glam_assert',
]

Expand All @@ -71,10 +116,6 @@ features = [
criterion = { version = "0.5", features = ["html_reports"] }


# remove after close: https://github.com/jakobhellermann/bevy-inspector-egui/issues/163
[profile.dev.package."bevy-inspector-egui"]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

Expand All @@ -99,17 +140,27 @@ path = "src/lib.rs"
[[bin]]
name = "viewer"
path = "viewer/viewer.rs"
required-features = ["viewer"]

[[bin]]
name = "ply_to_gcloud"
path = "tools/ply_to_gcloud.rs"
required-features = ["io_ply"]
required-features = ["io_ply", "tooling"]


[[bin]]
name = "compare_aabb_obb"
path = "tools/compare_aabb_obb.rs"

[[bin]]
name = "test_gaussian"
path = "tests/gpu/gaussian.rs"

[[bin]]
name = "test_radix"
path = "tests/gpu/radix.rs"
required-features = ["debug_gpu", "sort_radix"]


[[bench]]
name = "io"
Expand Down
4 changes: 4 additions & 0 deletions src/gaussian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use serde::{
ser::SerializeTuple,
};

use crate::sort::SortMode;


const fn num_sh_coefficients(degree: usize) -> usize {
if degree == 0 {
Expand Down Expand Up @@ -214,6 +216,7 @@ pub struct GaussianCloudSettings {
pub global_scale: f32,
pub global_transform: GlobalTransform,
pub visualize_bounding_box: bool,
pub sort_mode: SortMode,
}

impl Default for GaussianCloudSettings {
Expand All @@ -223,6 +226,7 @@ impl Default for GaussianCloudSettings {
global_scale: 2.0,
global_transform: Transform::IDENTITY.into(),
visualize_bounding_box: false,
sort_mode: SortMode::default(),
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/io/gcloud/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
use static_assertions::assert_cfg;


#[cfg(feature = "io_bincode2")]
pub mod bincode2;

#[cfg(feature = "io_flexbuffers")]
pub mod flexbuffers;


assert_cfg!(
any(
feature = "io_bincode2",
feature = "io_flexbuffers",
),
"no gcloud io enabled",
);
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use render::RenderPipelinePlugin;

pub mod gaussian;
pub mod io;
pub mod morph;
pub mod render;
pub mod sort;
pub mod utils;


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5c9a20a

Please sign in to comment.