Better path usage and "extern crate" removal in sub-crates.
This commit is contained in:
parent
28a07de456
commit
508cda6021
|
@ -1,9 +1,6 @@
|
||||||
// Generate table for traversal order of quad BVHs.
|
// Generate table for traversal order of quad BVHs.
|
||||||
|
|
||||||
use std::env;
|
use std::{env, fs::File, io::Write, path::Path};
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Build the traversal table.
|
// Build the traversal table.
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use std::env;
|
use std::{env, fs::File, io::Write, path::Path};
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct Chromaticities {
|
struct Chromaticities {
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
/// Implementation of Float4 for x86_64 platforms with SSE support.
|
/// Implementation of Float4 for x86_64 platforms with SSE support.
|
||||||
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
|
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
|
||||||
mod x86_64_sse {
|
mod x86_64_sse {
|
||||||
use std::arch::x86_64::__m128;
|
use std::{
|
||||||
use std::cmp::PartialEq;
|
arch::x86_64::__m128,
|
||||||
use std::ops::{Add, AddAssign, BitAnd, BitOr, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
cmp::PartialEq,
|
||||||
|
ops::{Add, AddAssign, BitAnd, BitOr, Div, DivAssign, Mul, MulAssign, Sub, SubAssign},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct Float4 {
|
pub struct Float4 {
|
||||||
|
@ -626,8 +628,10 @@ mod x86_64_sse {
|
||||||
/// Implementation fo Float4 for any platform, foregoing any
|
/// Implementation fo Float4 for any platform, foregoing any
|
||||||
/// platform-specific optimizations.
|
/// platform-specific optimizations.
|
||||||
mod fallback {
|
mod fallback {
|
||||||
use std::cmp::PartialEq;
|
use std::{
|
||||||
use std::ops::{Add, AddAssign, BitAnd, BitOr, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
cmp::PartialEq,
|
||||||
|
ops::{Add, AddAssign, BitAnd, BitOr, Div, DivAssign, Mul, MulAssign, Sub, SubAssign},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct Float4 {
|
pub struct Float4 {
|
||||||
|
|
|
@ -22,10 +22,7 @@
|
||||||
|
|
||||||
// Generate Rust code for evaluating Halton points with Faure-permutations for different bases.
|
// Generate Rust code for evaluating Halton points with Faure-permutations for different bases.
|
||||||
|
|
||||||
use std::env;
|
use std::{env, fs::File, io::Write, path::Path};
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
/// How many components to generate.
|
/// How many components to generate.
|
||||||
const NUM_DIMENSIONS: usize = 128;
|
const NUM_DIMENSIONS: usize = 128;
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
extern crate float4;
|
|
||||||
|
|
||||||
mod matrix;
|
mod matrix;
|
||||||
mod normal;
|
mod normal;
|
||||||
mod point;
|
mod point;
|
||||||
mod vector;
|
mod vector;
|
||||||
|
|
||||||
pub use self::matrix::Matrix4x4;
|
pub use self::{matrix::Matrix4x4, normal::Normal, point::Point, vector::Vector};
|
||||||
pub use self::normal::Normal;
|
|
||||||
pub use self::point::Point;
|
|
||||||
pub use self::vector::Vector;
|
|
||||||
|
|
||||||
/// Trait for calculating dot products.
|
/// Trait for calculating dot products.
|
||||||
pub trait DotProduct {
|
pub trait DotProduct {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std;
|
|
||||||
use std::ops::{Index, IndexMut, Mul};
|
use std::ops::{Index, IndexMut, Mul};
|
||||||
|
|
||||||
use float4::{invert, transpose, Float4};
|
use float4::{invert, transpose, Float4};
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::cmp::PartialEq;
|
use std::{
|
||||||
use std::ops::{Add, Div, Mul, Neg, Sub};
|
cmp::PartialEq,
|
||||||
|
ops::{Add, Div, Mul, Neg, Sub},
|
||||||
|
};
|
||||||
|
|
||||||
use float4::Float4;
|
use float4::Float4;
|
||||||
|
|
||||||
use super::{CrossProduct, DotProduct};
|
use super::{CrossProduct, DotProduct, Matrix4x4, Vector};
|
||||||
use super::{Matrix4x4, Vector};
|
|
||||||
|
|
||||||
/// A surface normal in 3d homogeneous space.
|
/// A surface normal in 3d homogeneous space.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::cmp::PartialEq;
|
use std::{
|
||||||
use std::ops::{Add, Mul, Sub};
|
cmp::PartialEq,
|
||||||
|
ops::{Add, Mul, Sub},
|
||||||
|
};
|
||||||
|
|
||||||
use float4::Float4;
|
use float4::Float4;
|
||||||
|
|
||||||
use super::Matrix4x4;
|
use super::{Matrix4x4, Vector};
|
||||||
use super::Vector;
|
|
||||||
|
|
||||||
/// A position in 3d homogeneous space.
|
/// A position in 3d homogeneous space.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::cmp::PartialEq;
|
use std::{
|
||||||
use std::ops::{Add, Div, Mul, Neg, Sub};
|
cmp::PartialEq,
|
||||||
|
ops::{Add, Div, Mul, Neg, Sub},
|
||||||
|
};
|
||||||
|
|
||||||
use float4::Float4;
|
use float4::Float4;
|
||||||
|
|
||||||
use super::{CrossProduct, DotProduct};
|
use super::{CrossProduct, DotProduct, Matrix4x4, Normal, Point};
|
||||||
use super::{Matrix4x4, Normal, Point};
|
|
||||||
|
|
||||||
/// A direction vector in 3d homogeneous space.
|
/// A direction vector in 3d homogeneous space.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
#![allow(clippy::needless_return)]
|
#![allow(clippy::needless_return)]
|
||||||
#![allow(clippy::mut_from_ref)]
|
#![allow(clippy::mut_from_ref)]
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::{
|
||||||
use std::cmp::max;
|
cell::{Cell, RefCell},
|
||||||
use std::mem::{align_of, size_of};
|
cmp::max,
|
||||||
use std::slice;
|
mem::{align_of, size_of},
|
||||||
|
slice,
|
||||||
|
};
|
||||||
|
|
||||||
const GROWTH_FRACTION: usize = 8; // 1/N (smaller number leads to bigger allocations)
|
const GROWTH_FRACTION: usize = 8; // 1/N (smaller number leads to bigger allocations)
|
||||||
const DEFAULT_MIN_BLOCK_SIZE: usize = 1 << 10; // 1 KiB
|
const DEFAULT_MIN_BLOCK_SIZE: usize = 1 << 10; // 1 KiB
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#[macro_use]
|
use bencher::{benchmark_group, benchmark_main, black_box, Bencher};
|
||||||
extern crate bencher;
|
|
||||||
extern crate oct32norm;
|
|
||||||
extern crate rand;
|
|
||||||
|
|
||||||
use bencher::{black_box, Bencher};
|
|
||||||
use oct32norm::{decode, encode};
|
use oct32norm::{decode, encode};
|
||||||
use rand::{rngs::SmallRng, FromEntropy, Rng};
|
use rand::{rngs::SmallRng, FromEntropy, Rng};
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
|
|
||||||
mod matrices;
|
mod matrices;
|
||||||
|
|
||||||
pub use crate::matrices::NUM_DIMENSIONS;
|
pub use crate::matrices::{MATRICES, NUM_DIMENSIONS, SIZE};
|
||||||
use crate::matrices::{MATRICES, SIZE};
|
|
||||||
|
|
||||||
/// Compute one component of the Sobol'-sequence, where the component
|
/// Compute one component of the Sobol'-sequence, where the component
|
||||||
/// corresponds to the dimension parameter, and the index specifies
|
/// corresponds to the dimension parameter, and the index specifies
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
#![allow(clippy::useless_let_if_seq)]
|
#![allow(clippy::useless_let_if_seq)]
|
||||||
#![allow(clippy::cyclomatic_complexity)]
|
#![allow(clippy::cyclomatic_complexity)]
|
||||||
|
|
||||||
extern crate float4;
|
use std::f32;
|
||||||
|
|
||||||
use float4::Float4;
|
use float4::Float4;
|
||||||
use std::f32;
|
|
||||||
|
|
||||||
mod spectra_tables;
|
mod spectra_tables;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#[macro_use]
|
use bencher::{benchmark_group, benchmark_main, black_box, Bencher};
|
||||||
extern crate bencher;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate trifloat;
|
|
||||||
|
|
||||||
use bencher::{black_box, Bencher};
|
|
||||||
use rand::{rngs::SmallRng, FromEntropy, Rng};
|
use rand::{rngs::SmallRng, FromEntropy, Rng};
|
||||||
use trifloat::{decode, encode};
|
use trifloat::{decode, encode};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user