Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump rayon from 1.5.3 to 1.7.0 #43

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 22 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ edition = "2018"

[dependencies]
image = { version = "0.24", default-features = false, features = ["png", "jpeg"] }
glam = "0.21"
glam = "0.22"
rand = { version = "0.8", features = ["small_rng"] }
rayon = "1.5.3"
rayon = "1.7.0"
crossbeam = "0.8.2"
clap = "3.2"
num_cpus = "1.13.1"
clap = "4.0"
num_cpus = "1.15.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

Expand Down
39 changes: 21 additions & 18 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{App, Arg};
use clap::{Arg, Command};

fn integer_non_zero_validator(s: String) -> Result<(), String> {
match s.parse::<u32>() {
Expand Down Expand Up @@ -27,24 +27,27 @@ impl clap::builder::TypedValueParser for AspectRatioParser {
) -> Result<Self::Value, clap::Error> {
if let Some((w, h)) = value.to_str().unwrap().split_once(':') {
let w: crate::Float = w.parse::<crate::Float>().map_err(|_| {
clap::Error::raw(clap::ErrorKind::InvalidValue, "cannot parse width in ratio")
clap::Error::raw(
clap::error::ErrorKind::InvalidValue,
"cannot parse width in ratio",
)
})?;
let h: crate::Float = h.parse::<crate::Float>().map_err(|_| {
clap::Error::raw(
clap::ErrorKind::InvalidValue,
clap::error::ErrorKind::InvalidValue,
"cannot parse height in ratio",
)
})?;
if w == 0.0 || h == 0.0 {
return Err(clap::Error::raw(
clap::ErrorKind::InvalidValue,
clap::error::ErrorKind::InvalidValue,
"w and h cannot be zero",
));
}
Ok((w, h))
} else {
Err(clap::Error::raw(
clap::ErrorKind::InvalidValue,
clap::error::ErrorKind::InvalidValue,
"ratio must have format w:h",
))
}
Expand All @@ -61,40 +64,40 @@ fn aspect_ratio_validator(s: String) -> Result<(), String> {
}
}

pub fn build_app() -> App<'static> {
App::new(env!("CARGO_PKG_NAME"))
pub fn build_app() -> Command {
Command::new(env!("CARGO_PKG_NAME"))
.author(env!("CARGO_PKG_AUTHORS"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.version(env!("CARGO_PKG_VERSION"))
.arg(
Arg::with_name("scene")
Arg::new("scene")
.default_value("0")
.value_parser(clap::builder::RangedU64ValueParser::<u32>::new().range(0..=8))
.takes_value(true)
.num_args(1)
.long("scene"),
)
.arg(
Arg::with_name("width")
.takes_value(true)
Arg::new("width")
.num_args(1)
.long("width")
.value_parser(clap::builder::RangedU64ValueParser::<u32>::new().range(1..=100000)),
)
.arg(
Arg::with_name("aspect ratio")
.takes_value(true)
Arg::new("aspect ratio")
.num_args(1)
.long("ratio")
.value_parser(AspectRatioParser),
)
.arg(
Arg::with_name("samples per pixel")
.takes_value(true)
Arg::new("samples per pixel")
.num_args(1)
.long("samples")
.value_parser(clap::builder::RangedU64ValueParser::<u32>::new().range(1..=100000)),
)
.arg(Arg::with_name("use bvh").takes_value(false).long("bvh"))
.arg(Arg::new("use bvh").long("bvh"))
.arg(
Arg::with_name("job")
.takes_value(true)
Arg::new("job")
.num_args(1)
.short('j')
.value_parser(clap::value_parser!(u32).range(1..)),
)
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn main() {
// Parameters
let matches = cli::build_app().get_matches();
let scene = matches.get_one::<u32>("scene").unwrap();
let use_bvh = matches.is_present("use bvh");
let use_bvh = matches.get_flag("use bvh");
let threads = matches
.get_one::<u32>("job")
.copied()
Expand Down