Skip to content

Commit c61141b

Browse files
Merge pull request #292 from workingjubilee/go-green
Clear stage 1
2 parents 065021d + 47de491 commit c61141b

File tree

57 files changed

+156
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+156
-141
lines changed

ci/all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cargo_fmt() {
2121
}
2222

2323
cargo_clippy() {
24-
cargo clippy --all -- -D clippy::pedantic
24+
cargo clippy --all -- -D clippy::perf
2525
}
2626

2727
CMD="-1"

examples/aobench/benches/ambient_occlusion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
use aobench_lib::*;
55
use criterion::*;
66
use intersection::Isect;
7-
use scene::Test;
7+
use aobench_lib::scene::Test;
88

99
fn hit_scalar(c: &mut Criterion) {
10-
let mut scene = Test::new();
10+
let mut scene = Test::default();
1111
c.bench(
1212
"scalar",
1313
Benchmark::new("ao_hit", move |b| {
@@ -24,7 +24,7 @@ fn hit_scalar(c: &mut Criterion) {
2424
}
2525

2626
fn hit_vector(c: &mut Criterion) {
27-
let mut scene = Test::new();
27+
let mut scene = Test::default();
2828

2929
c.bench(
3030
"vector",

examples/aobench/benches/isec_plane.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn hit_vector(c: &mut Criterion) {
132132
assert_eq!(v.hit.all(), true);
133133
})
134134
})
135-
.throughput(Throughput::Elements(f32xN::lanes() as u32)),
135+
.throughput(Throughput::Elements(f32xN::lanes() as u64)),
136136
);
137137
}
138138

@@ -175,7 +175,7 @@ fn miss_vector(c: &mut Criterion) {
175175
assert_eq!(v.hit.any(), false);
176176
})
177177
})
178-
.throughput(Throughput::Elements(f32xN::lanes() as u32)),
178+
.throughput(Throughput::Elements(f32xN::lanes() as u64)),
179179
);
180180
}
181181

examples/aobench/benches/isec_sphere.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::geometry::{f32xN, Ray, RayxN, Sphere, V3DxN, V3D};
55
use crate::intersection::{Intersect, Isect, IsectxN};
66
use aobench_lib::*;
77
use criterion::*;
8-
use test::*;
98

109
fn hit_scalar(c: &mut Criterion) {
1110
let mut s = Sphere {
@@ -121,7 +120,7 @@ fn hit_vector(c: &mut Criterion) {
121120
assert_eq!(v.hit.all(), true);
122121
})
123122
})
124-
.throughput(Throughput::Elements(f32xN::lanes() as u32)),
123+
.throughput(Throughput::Elements(f32xN::lanes() as u64)),
125124
);
126125
}
127126

@@ -160,7 +159,7 @@ fn miss_vector(c: &mut Criterion) {
160159
assert_eq!(v.hit.any(), false);
161160
})
162161
})
163-
.throughput(Throughput::Elements(f32xN::lanes() as u32)),
162+
.throughput(Throughput::Elements(f32xN::lanes() as u64)),
164163
);
165164
}
166165

examples/aobench/benches/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn random_vector(c: &mut Criterion) {
2727
black_box(rng.gen());
2828
})
2929
})
30-
.throughput(Throughput::Elements(f32xN::lanes() as u32)),
30+
.throughput(Throughput::Elements(f32xN::lanes() as u64)),
3131
);
3232
}
3333

examples/aobench/src/image.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! Image utilities
22
33
use failure::Error;
4-
use png;
4+
#[allow(unused)]
5+
use png::{BitDepth, ColorType, Encoder};
56
use std::path::Path;
67

78
/// PNG image in RGB format
@@ -53,14 +54,14 @@ impl Image {
5354

5455
let file = File::create(output)?;
5556
let buf_writer = &mut BufWriter::new(file);
56-
let mut encoder = png::Encoder::new(
57+
let mut encoder = Encoder::new(
5758
buf_writer,
5859
self.width as u32,
5960
self.height as u32,
6061
);
6162

62-
encoder.set_color(png::ColorType::RGB);
63-
encoder.set_depth(png::BitDepth::Eight);
63+
encoder.set_color(ColorType::RGB);
64+
encoder.set_depth(BitDepth::Eight);
6465
let mut writer = encoder.write_header().unwrap();
6566

6667
if soa {

examples/aobench/src/intersection/ray_plane.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Intersect<Plane> for RayxN {
3838
let d = -plane.p.dot(plane.n);
3939
let v = ray.dir.dot(plane.n);
4040

41-
let old_isect = isect;
41+
let _old_isect = isect;
4242

4343
let m = v.abs().ge(f32xN::splat(1e-17));
4444
if m.any() {
@@ -58,10 +58,10 @@ impl Intersect<Plane> for RayxN {
5858
// Check that the vector and the scalar version produce the same results
5959
// for the same inputs in debug builds
6060
for i in 0..f32xN::lanes() {
61-
let old_isect_i = old_isect.get(i);
61+
let old_isect_i = _old_isect.get(i);
6262
let ray_i = self.get(i);
6363
let isect_i = ray_i.intersect(plane, old_isect_i);
64-
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nplane: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), plane, old_isect, self, i, old_isect_i, ray_i);
64+
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nplane: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), plane, _old_isect, self, i, old_isect_i, ray_i);
6565
}
6666
}
6767

examples/aobench/src/intersection/ray_sphere.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Intersect<Sphere> for RayxN {
4343
let c = radius.mul_adde(-radius, rs.dot(rs));
4444
let d = b.mul_adde(b, -c);
4545

46-
let old_isect = isect;
46+
let _old_isect = isect;
4747

4848
let m = d.gt(f32xN::splat(0.));
4949
if m.any() {
@@ -64,10 +64,10 @@ impl Intersect<Sphere> for RayxN {
6464
// Check that the vector and the scalar version produce the same results
6565
// for the same inputs in debug builds
6666
for i in 0..f32xN::lanes() {
67-
let old_isect_i = old_isect.get(i);
67+
let old_isect_i = _old_isect.get(i);
6868
let ray_i = self.get(i);
6969
let isect_i = ray_i.intersect(sphere, old_isect_i);
70-
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nsphere: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), sphere, old_isect, self, i, old_isect_i, ray_i);
70+
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nsphere: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), sphere, _old_isect, self, i, old_isect_i, ray_i);
7171
}
7272
}
7373

examples/aobench/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
clippy::cast_sign_loss,
1414
clippy::identity_op,
1515
clippy::erasing_op,
16-
clippy::must_use_candidate
16+
clippy::must_use_candidate,
17+
clippy::float_cmp
1718
)]
1819

1920
pub mod ambient_occlusion;

examples/dot_product/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Vector dot product
22
#![deny(warnings, rust_2018_idioms)]
33
#![feature(custom_inner_attributes)]
4-
#![allow(clippy::must_use_candidate)]
4+
#![allow(clippy::must_use_candidate, clippy::float_cmp)]
55

66
pub mod scalar;
77
pub mod simd;

0 commit comments

Comments
 (0)