Skip to content

Commit 959a3ec

Browse files
committed
Merge branch 'highp_pos'
2 parents 5f7c9ce + 262cf96 commit 959a3ec

File tree

15 files changed

+122
-264
lines changed

15 files changed

+122
-264
lines changed

src/bin/measure.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ async fn render_views(
6666
viewport: resolution,
6767
gaussian_scaling: 1.,
6868
max_sh_deg: pc.sh_deg(),
69-
show_env_map: false,
7069
mip_splatting: None,
7170
kernel_size: None,
7271
clipping_box: None,
7372
walltime: Duration::from_secs(100),
7473
scene_center: None,
7574
scene_extend: None,
7675
background_color: wgpu::Color::TRANSPARENT,
77-
resolution,
7876
},
7977
&mut None,
8078
);
@@ -116,15 +114,13 @@ async fn render_views(
116114
viewport: resolution,
117115
gaussian_scaling: 1.,
118116
max_sh_deg: pc.sh_deg(),
119-
show_env_map: false,
120117
mip_splatting: None,
121118
kernel_size: None,
122119
clipping_box: None,
123120
walltime: Duration::from_secs(100),
124121
scene_center: None,
125122
scene_extend: None,
126123
background_color: wgpu::Color::TRANSPARENT,
127-
resolution,
128124
},
129125
&mut None,
130126
);

src/bin/render.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ async fn render_views(
9494
viewport: resolution,
9595
gaussian_scaling: 1.,
9696
max_sh_deg: pc.sh_deg(),
97-
show_env_map: false,
9897
mip_splatting: None,
9998
kernel_size: None,
10099
clipping_box: None,
101100
walltime: Duration::from_secs(100),
102101
scene_center: None,
103102
scene_extend: None,
104103
background_color: wgpu::Color::TRANSPARENT,
105-
resolution,
106104
},
107105
&mut None,
108106
);

src/bin/video.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ async fn render_tracking_shot(
122122
viewport: resolution,
123123
gaussian_scaling: 1.,
124124
max_sh_deg: pc.sh_deg(),
125-
show_env_map: false,
126125
mip_splatting: None,
127126
kernel_size: None,
128127
clipping_box: None,
129128
walltime: state_time,
130129
scene_center: None,
131130
scene_extend: None,
131+
background_color: wgpu::Color::TRANSPARENT,
132132
},
133133
&mut None,
134134
);

src/bin/viewer.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ struct Opt {
1919
/// Support HDR rendering
2020
#[arg(long, default_value_t = false)]
2121
hdr: bool,
22-
23-
/// Sky box image
24-
#[arg(long)]
25-
skybox: Option<PathBuf>,
2622
}
2723

2824
/// check if there is a scene file in the same directory or parent directory as the input file
@@ -63,7 +59,6 @@ async fn main() {
6359
scene_file,
6460
RenderConfig {
6561
no_vsync: opt.no_vsync,
66-
skybox: opt.skybox,
6762
hdr: opt.hdr,
6863
},
6964
Some(opt.input),

src/gpu_rs.rs

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -63,70 +63,79 @@ unsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] {
6363
impl GPURSSorter {
6464
// The new call also needs the queue to be able to determine the maximum subgroup size (Does so by running test runs)
6565
pub async fn new(device: &wgpu::Device, queue: &wgpu::Queue) -> Self {
66-
let mut cur_sorter: GPURSSorter;
67-
68-
log::debug!("Searching for the maximum subgroup size (wgpu currently does not allow to query subgroup sizes)");
69-
let sizes = vec![1, 8, 16, 32];
70-
let mut cur_size = 2;
71-
enum State {
72-
Init,
73-
Increasing,
74-
Decreasing,
75-
}
76-
let mut biggest_that_worked = 0;
77-
let mut s = State::Init;
78-
loop {
79-
if cur_size >= sizes.len() {
80-
break;
66+
let sg_size = device.limits().min_subgroup_size;
67+
if sg_size == 0 || sg_size > 512 {
68+
let mut cur_sorter: GPURSSorter;
69+
70+
log::debug!("Searching for the maximum subgroup size (wgpu currently does not allow to query subgroup sizes)");
71+
let sizes = vec![1, 8, 16, 32];
72+
let mut cur_size = 2;
73+
enum State {
74+
Init,
75+
Increasing,
76+
Decreasing,
8177
}
82-
log::debug!("Checking sorting with subgroupsize {}", sizes[cur_size]);
83-
cur_sorter = Self::new_with_sg_size(device, sizes[cur_size]);
84-
let sort_success = cur_sorter.test_sort(device, queue).await;
85-
log::debug!("{} worked: {}", sizes[cur_size], sort_success);
86-
match s {
87-
State::Init => {
88-
if sort_success {
89-
biggest_that_worked = sizes[cur_size];
90-
s = State::Increasing;
91-
cur_size += 1;
92-
} else {
93-
s = State::Decreasing;
94-
cur_size -= 1;
95-
}
78+
let mut biggest_that_worked = 0;
79+
let mut s = State::Init;
80+
loop {
81+
if cur_size >= sizes.len() {
82+
break;
9683
}
97-
State::Increasing => {
98-
if sort_success {
99-
if sizes[cur_size] > biggest_that_worked {
84+
log::debug!("Checking sorting with subgroupsize {}", sizes[cur_size]);
85+
cur_sorter = Self::new_with_sg_size(device, sizes[cur_size]);
86+
let sort_success = cur_sorter.test_sort(device, queue).await;
87+
log::debug!("{} worked: {}", sizes[cur_size], sort_success);
88+
match s {
89+
State::Init => {
90+
if sort_success {
10091
biggest_that_worked = sizes[cur_size];
92+
s = State::Increasing;
93+
cur_size += 1;
94+
} else {
95+
s = State::Decreasing;
96+
cur_size -= 1;
10197
}
102-
cur_size += 1;
103-
} else {
104-
break;
10598
}
106-
}
107-
State::Decreasing => {
108-
if sort_success {
109-
if sizes[cur_size] > biggest_that_worked {
110-
biggest_that_worked = sizes[cur_size];
99+
State::Increasing => {
100+
if sort_success {
101+
if sizes[cur_size] > biggest_that_worked {
102+
biggest_that_worked = sizes[cur_size];
103+
}
104+
cur_size += 1;
105+
} else {
106+
break;
107+
}
108+
}
109+
State::Decreasing => {
110+
if sort_success {
111+
if sizes[cur_size] > biggest_that_worked {
112+
biggest_that_worked = sizes[cur_size];
113+
}
114+
break;
115+
} else {
116+
cur_size -= 1;
111117
}
112-
break;
113-
} else {
114-
cur_size -= 1;
115118
}
116119
}
117120
}
118-
}
119-
if biggest_that_worked == 0 {
120-
panic!(
121+
if biggest_that_worked == 0 {
122+
panic!(
121123
"GPURSSorter::new() No workgroup size that works was found. Unable to use sorter"
122124
);
125+
}
126+
cur_sorter = Self::new_with_sg_size(device, biggest_that_worked as u32);
127+
log::info!(
128+
"Created a sorter with subgroup size {}\n",
129+
cur_sorter.subgroup_size
130+
);
131+
return cur_sorter;
132+
} else {
133+
log::info!(
134+
"Created a sorter with subgroup size {}\n",
135+
sg_size
136+
);
137+
return Self::new_with_sg_size(device, sg_size);
123138
}
124-
cur_sorter = Self::new_with_sg_size(device, biggest_that_worked);
125-
log::info!(
126-
"Created a sorter with subgroup size {}\n",
127-
cur_sorter.subgroup_size
128-
);
129-
return cur_sorter;
130139
}
131140

132141
pub fn create_sort_stuff(
@@ -165,7 +174,7 @@ impl GPURSSorter {
165174
}
166175
}
167176

168-
fn new_with_sg_size(device: &wgpu::Device, sg_size: i32) -> Self {
177+
fn new_with_sg_size(device: &wgpu::Device, sg_size: u32) -> Self {
169178
// special variables for scatter shade
170179
let histogram_sg_size: usize = sg_size as usize;
171180
let rs_sweep_0_size: usize = RS_RADIX_SIZE / histogram_sg_size;

src/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl GenericGaussianPointCloud {
7373
) -> Self {
7474
let mut bbox: Aabb<f32> = Aabb::zeroed();
7575
for v in &gaussians {
76-
bbox.grow(&v.xyz.map(|x| x.to_f32()));
76+
bbox.grow(&v.xyz);
7777
}
7878

7979
let (center, mut up) = plane_from_points(
@@ -118,7 +118,7 @@ impl GenericGaussianPointCloud {
118118
) -> Self {
119119
let mut bbox: Aabb<f32> = Aabb::unit();
120120
for v in &gaussians {
121-
bbox.grow(&v.xyz.map(|x| x.to_f32()));
121+
bbox.grow(&v.xyz);
122122
}
123123

124124
let (center, mut up) = plane_from_points(

src/io/npz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a, R: Read + Seek> PointCloudReader for NpzReader<'a, R> {
9393
scaling_factor = Some(try_get_npz_array(&mut self.npz_file, "scaling_factor")?);
9494
}
9595

96-
let xyz: Vec<Point3<f16>> = try_get_npz_array::<f16>(&mut self.npz_file, "xyz")?
96+
let xyz: Vec<Point3<f32>> = try_get_npz_array::<f16>(&mut self.npz_file, "xyz")?
9797
.as_slice()
9898
.chunks_exact(3)
9999
.map(|c: &[f16]| Point3::new(c[0], c[1], c[2]).cast().unwrap())

src/io/ply.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ impl<R: io::Read + io::Seek> PlyReader<R> {
9090
let cov = build_cov(rot, scale);
9191

9292
return Ok((
93-
Gaussian {
94-
xyz: Point3::from(pos).cast().unwrap(),
95-
opacity: f16::from_f32(opacity),
96-
cov: cov.map(|x| f16::from_f32(x)),
97-
},
93+
Gaussian::new(
94+
Point3::from(pos).cast().unwrap(),
95+
f16::from_f32(opacity),
96+
cov.map(|x| f16::from_f32(x)),
97+
),
9898
sh.map(|x| x.map(|y| f16::from_f32(y))),
9999
));
100100
}

0 commit comments

Comments
 (0)