Skip to content

Commit

Permalink
render: fix the 1st frame inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Jul 9, 2024
1 parent 244b0b5 commit 5d9b123
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions blade-render/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,12 @@ impl Renderer {
}
}

fn work_indices(&self) -> (usize, usize) {
let cur = self.frame_index & 1;
let prev = cur ^ 1;
(cur, prev.min(self.frame_index))
}

/// Prepare to render a frame.
#[profiling::function]
pub fn prepare(
Expand Down Expand Up @@ -1082,8 +1088,7 @@ impl Renderer {
ray_config: RayConfig,
) {
let debug = self.make_debug_params(&debug_config);
let cur = self.frame_index % 2;
let prev = cur ^ 1;
let (cur, prev) = self.work_indices();

if let mut pass = command_encoder.compute() {
let mut pc = pass.with(&self.fill_pipeline);
Expand Down Expand Up @@ -1169,8 +1174,7 @@ impl Renderer {
use_motion_vectors: (self.frame_scene_built == self.frame_index) as u32,
pad: 0,
};
let cur = self.frame_index % 2;
let prev = cur ^ 1;
let (cur, prev) = self.work_indices();
let temp = 2;

if denoiser_config.temporal_weight < 1.0 {
Expand Down

0 comments on commit 5d9b123

Please sign in to comment.