voxrender-cpu 0.1.0

The CPU reference renderer for voxrender's render contract.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::MapRows;
use rayon::iter::{IntoParallelIterator, ParallelIterator};

/// The dependencies the `impl` feature provides. `map_rows` spreads the rows
/// across threads.
#[derive(Clone, Copy, Debug, Default)]
pub struct DependenciesImpl;

impl MapRows for DependenciesImpl {
    fn map_rows<T, F>(&self, height: u32, map_row: F) -> Vec<T>
    where
        T: Send,
        F: Fn(u32) -> T + Sync,
    {
        (0..height).into_par_iter().map(&map_row).collect()
    }
}