disable ao, reset timer

This commit is contained in:
2026-01-30 20:59:54 +00:00
parent c0982d80b7
commit c0adfd0598
3 changed files with 92 additions and 12 deletions
+3
View File
@@ -53,6 +53,7 @@ pub(crate) struct GState {
pub(crate) clear_coat: f32, pub(crate) clear_coat: f32,
pub(crate) recreate_pipelines: bool, pub(crate) recreate_pipelines: bool,
pub(crate) reset_time: bool,
} }
impl Default for GState { impl Default for GState {
@@ -81,6 +82,7 @@ impl Default for GState {
clear_coat: 0.85, clear_coat: 0.85,
recreate_pipelines: false, recreate_pipelines: false,
reset_time: false,
} }
} }
} }
@@ -362,6 +364,7 @@ pub(crate) fn gui_up(gui: &mut Gui, state: &mut GState) {
); );
state.recreate_pipelines = ui.button("Force recompile pipelines").clicked(); state.recreate_pipelines = ui.button("Force recompile pipelines").clicked();
state.reset_time = ui.button("Reset time to 0").clicked();
}); });
}); });
}); });
+11 -11
View File
@@ -1,5 +1,6 @@
#![feature(portable_simd)] #![feature(portable_simd)]
#![feature(mpmc_channel)] #![feature(mpmc_channel)]
#![feature(duration_millis_float)]
const DUMP_SPV_TO_FILE: bool = false; const DUMP_SPV_TO_FILE: bool = false;
const PIPELINE_CACHING: bool = false; const PIPELINE_CACHING: bool = false;
@@ -18,15 +19,7 @@ const RUN_RT_PIPELINE: bool = false;
use std::{ use std::{
error::Error, error::Error,
fs::{File, remove_file, rename}, fs::{File, remove_file, rename},
io::{Cursor, Read, Write},acceleration_structure::{ io::{Cursor, Read, Write},
AccelerationStructure, AccelerationStructureBuildGeometryInfo,
AccelerationStructureBuildRangeInfo, AccelerationStructureBuildType,
AccelerationStructureCreateInfo, AccelerationStructureGeometries,
AccelerationStructureGeometryInstancesData, AccelerationStructureGeometryInstancesDataType,
AccelerationStructureGeometryTrianglesData, AccelerationStructureInstance,
AccelerationStructureType, BuildAccelerationStructureFlags, BuildAccelerationStructureMode,
GeometryInstanceFlags,
},
path::{Path, PathBuf}, path::{Path, PathBuf},
simd::{f32x8, num::SimdFloat}, simd::{f32x8, num::SimdFloat},
sync::{Arc, Mutex, atomic::AtomicBool, mpmc, mpsc}, sync::{Arc, Mutex, atomic::AtomicBool, mpmc, mpsc},
@@ -620,6 +613,8 @@ impl App {
let mut gstate = GState::default(); let mut gstate = GState::default();
let cstate = CState::default(); let cstate = CState::default();
gstate.debug.disable_ao = true;
gstate.meshes.append( gstate.meshes.append(
&mut load_obj( &mut load_obj(
&memory_allocator, &memory_allocator,
@@ -2208,10 +2203,15 @@ impl App {
self.gstate.cpu_mpf[i - 1] = self.gstate.cpu_mpf[i]; self.gstate.cpu_mpf[i - 1] = self.gstate.cpu_mpf[i];
} }
self.time = (Instant::now() - self.application_start).as_secs_f32(); if self.gstate.reset_time {
self.application_start = Instant::now();
self.gstate.reset_time = false;
}
self.time = self.application_start.elapsed().as_secs_f32();
self.gstate.cpu_mpf[self.gstate.cpu_mpf.len() - 1] = self.gstate.cpu_mpf[self.gstate.cpu_mpf.len() - 1] =
(Instant::now() - rcx.render_start).as_secs_f64() * 1000.0; rcx.render_start.elapsed().as_millis_f64();
for future in rcx.previous_frame_end.iter_mut().flatten() { for future in rcx.previous_frame_end.iter_mut().flatten() {
future.cleanup_finished(); future.cleanup_finished();
+78 -1
View File
@@ -622,12 +622,89 @@ fn create_csg(seed: u64) -> SSATape {
}, },
vec![sphere[0], torus[0]], vec![sphere[0], torus[0]],
); );
let scaled_time = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAMul,
size: 1,
},
vec![pos[3], SSAInput::Constant(0.2)],
);
let moving_pos = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAAdd,
size: 3,
},
vec![
pos[0],
pos[1],
pos[2],
scaled_time[0],
scaled_time[0],
scaled_time[0],
],
);
let pos_times_20 = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAMul,
size: 3,
},
vec![
moving_pos[0],
moving_pos[1],
moving_pos[2],
SSAInput::Constant(20.0),
SSAInput::Constant(20.0),
SSAInput::Constant(20.0),
],
);
let sine_of_the_times = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSASin,
size: 3,
},
pos_times_20,
);
let sine_of_the_times = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAMul,
size: 3,
},
vec![
sine_of_the_times[0],
sine_of_the_times[1],
sine_of_the_times[2],
SSAInput::Constant(0.3),
SSAInput::Constant(0.3),
SSAInput::Constant(0.3),
],
);
let multiply_out_1 = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAMul,
size: 1,
},
vec![sine_of_the_times[0], sine_of_the_times[1]],
);
let multiply_out_2 = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAMul,
size: 1,
},
vec![multiply_out_1[0], sine_of_the_times[2]],
);
let displacement = tape.push_instruction(
SSAOpcodeSized {
opcode: SSAOpcode::SSAAdd,
size: 1,
},
vec![min[0], multiply_out_2[0]],
);
tape.push_instruction( tape.push_instruction(
SSAOpcodeSized { SSAOpcodeSized {
opcode: SSAOpcode::SSAReturn, opcode: SSAOpcode::SSAReturn,
size: 1, size: 1,
}, },
min, displacement,
); );
tape tape
} }