Skip to content

Commit

Permalink
Prevent the spread of NaNs in the ircache
Browse files Browse the repository at this point in the history
  • Loading branch information
h3r2tic committed Feb 16, 2024
1 parent 7120301 commit a4ffd34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/shaders/inc/reservoir.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct Reservoir1spp {
}

uint2 as_raw() {
return uint2(payload, pack_2x16f_uint(float2(M, W)));
return uint2(payload, pack_2x16f_uint(float2(M, max(0.0, W))));
}

bool update(float w, uint sample_payload, inout uint rng) {
Expand Down
2 changes: 1 addition & 1 deletion assets/shaders/ircache/sum_up_irradiance.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void main(uint dispatch_idx: SV_DispatchThreadID) {
ircache_irradiance_buf[entry_idx * IRCACHE_IRRADIANCE_STRIDE + basis_i]
* frame_constants.pre_exposure_delta;

const bool should_reset = all(0.0 == prev_value);
const bool should_reset = !any(0.0 != prev_value);
if (should_reset) {
prev_value = new_value;
}
Expand Down

0 comments on commit a4ffd34

Please sign in to comment.