mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.1k stars 246 forks source link

Change seed function to take drjit type for seed #1326

Closed DoeringChristian closed 1 month ago

DoeringChristian commented 1 month ago

Description

This PR changes the signature of the seed function for samplers (and their implementations) to take a Dr.Jit UInt32 instead of a uint32_t as the seed. It also changes the signature compute_per_sequence_seed function to take the same type as the argument. The change will eventually be necessary for function freezing, as it allows passing already opaque seeds to the render function and thereby prevents "re-recording" of the frozen function.

Testing

Checklist

DoeringChristian commented 1 month ago

LGTM !

@DoeringChristian thanks. One quick question before I merge: I assume we don't need to change m_base_seed because it won't be part of a function/interface that can be freezed ?

Good point. I think its not necessary for now. As it is now, the base_seed will be frozen and calling the frozen function with a sampler with a different base_seed would use the old one. We have a few of these cases, where C++ types are part of some class that is an argument to a frozen function and a change to this value will be disregarded by the freezing alrorithm. I think we decided to ignore those cases for now.

njroussel commented 1 month ago

Ok, thanks for the clarification!