diffuse raytracing
This commit is contained in:
parent
729fcb8559
commit
86135cb2ce
6 changed files with 57 additions and 24 deletions
|
@ -61,4 +61,5 @@ pub struct AppData {
|
|||
|
||||
pub scene_rt_memory_size: u64,
|
||||
pub num_lights_per_volume: u32,
|
||||
pub max_iterations_per_light: u32,
|
||||
}
|
|
@ -58,7 +58,7 @@ const DEVICE_EXTENSIONS: &[vk::ExtensionName] = &[
|
|||
vk::KHR_SWAPCHAIN_EXTENSION.name
|
||||
];
|
||||
|
||||
const MAX_FRAMES_IN_FLIGHT: usize = 2;
|
||||
const MAX_FRAMES_IN_FLIGHT: usize = 3;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
pretty_env_logger::init();
|
||||
|
@ -179,6 +179,7 @@ impl App {
|
|||
let mut data = app_data::AppData::default();
|
||||
data.use_geometry_shader = false;
|
||||
data.num_lights_per_volume = 2;
|
||||
data.max_iterations_per_light = 20;
|
||||
let mut scene_handler = scene::Scene::default();
|
||||
|
||||
//load_model::load_model(&mut data)?;
|
||||
|
|
|
@ -138,7 +138,9 @@ impl Scene {
|
|||
let index = self.sized_vertices.len();
|
||||
cube.draw(&data.topology, index, self);
|
||||
|
||||
let mut memory_index = 1; // zero should be the location for the overall length (also will be the invalid memory allocation for pointing to a nonexistant neighbor)
|
||||
let mut memory_index = 2;
|
||||
// 0 - location for the maximum number of lights referenced per chunk (also will be the invalid memory allocation for pointing to a nonexistant neighbor)
|
||||
// 1 - location for the max iterations per light
|
||||
for light in &mut self.point_lights {
|
||||
light.memory_start = memory_index;
|
||||
memory_index += light.get_buffer_mem_size() as usize;
|
||||
|
@ -157,6 +159,8 @@ impl Scene {
|
|||
}
|
||||
println!("Memory size is {} kB, max indes is {}", memory_index * 32 / 8 /1024 + 1, memory_index);
|
||||
let mut volume_vec = vec![data.num_lights_per_volume; memory_index];
|
||||
volume_vec[1] = data.max_iterations_per_light;
|
||||
|
||||
for volume in &empty_volumes {
|
||||
volume_vec = volume.borrow().insert_into_memory(volume_vec, data.num_lights_per_volume, &self.point_lights);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ extern crate rand;
|
|||
|
||||
pub const CHUNK_SIZE_EXPONENT: u32 = 4;
|
||||
pub const CHUNK_SIZE: usize = (2 as usize).pow(CHUNK_SIZE_EXPONENT);
|
||||
pub const MAX_TREE_DEPTH: usize = 2;
|
||||
pub const MAX_TREE_DEPTH: usize = CHUNK_SIZE_EXPONENT as usize - 2;
|
||||
pub const MIN_CHUNK_SIZE: usize = CHUNK_SIZE / (2 as usize).pow(MAX_TREE_DEPTH as u32);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue