Fix #129889: EEVEE: Lightprobe Volume bake is non-deterministic

Turns out the sampling module was not initialized when
computing lighting which resulted in undefined shadow location.
In some cases even producing NaN position which would make the
shadow disappear.

Basically, anything returned by `sampling_rng_nD_get` was returning
garbage, and on some occasion, it could be a negative number and
produce NaN if passed into `sample_disk` or any `sqrt`.

ASAN did not catch it because the uninitialized data load
was done on the GPU.

I ran the render tests and, minor difference aside, they all match.

#### Follow Up:
This raises the concern that we have no assertion for correctly
using some modules. At the very least, we should have some
mechanism to catch uninitialized buffer. Investigating this
was a pain au chocolat.

Pull Request: https://projects.blender.org/blender/blender/pulls/130150
This commit is contained in:
Clément Foucault
2024-11-12 15:29:17 +01:00
committed by Clément Foucault
parent 43fde8c39c
commit e3a960ef2e

View File

@@ -711,6 +711,10 @@ void Instance::light_bake_irradiance(
render_sync();
manager->end_sync();
/* Sampling module needs to be initialized to computing lighting. */
sampling.init(probe);
sampling.step();
DebugScope debug_scope(debug_scope_irradiance_setup, "EEVEE.irradiance_setup");
capture_view.render_world();