mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Give every stage its own random stream derived from the invocation seed and stage id
Stages no longer share one RandomGenerator. StageContext.random() is the running stage's own stream: java.util.Random seeded with mix(mix(invocationSeed) ^ fnv1a64(utf8(stageId))), mix being the SplitMix64 finalizer. Adding, removing or reordering modules, or how much other stages draw, no longer changes a stage's draws. A block stage keeps one stream across the blocks of its pass. The host passes a long invocation seed to PlacementRunner.place and ChunkRunner.generate instead of a RandomGenerator on the inputs; InvocationContext loses random(), so stages cannot reach a shared stream. ObjectGenerationContext keeps its own random() for geometry generators. StageRandom documents the derivation, and a test pins it to values computed from the specification.
This commit is contained in:
1 parent
4cb718f706
commit
307e488d1a
17 files changed
+293
-34
No files matched your search
@@ -22,17 +22,20 @@ public final class PlacementRunner {
|
||||
}
|
||||
|
||||
/** Takes ownership of a fresh edit and closes it on success, rejection or exception.
|
||||
* The host prepares the edit area, the read-only inputs (with a dedicated RNG) and the
|
||||
* settings configured for this placement. Stages never receive commit/close rights.
|
||||
* The host prepares the edit area, the read-only inputs and the settings configured for this
|
||||
* placement, and derives {@code invocationSeed} from the world seed and the placement's stable
|
||||
* identity. Each stage draws from its own stream of that seed ({@link StageRandom}). Stages never
|
||||
* receive commit/close rights.
|
||||
*/
|
||||
public PlacementOutcome place(
|
||||
PlacementRequest request,
|
||||
PlacementEdit edit,
|
||||
PlacementContext inputs,
|
||||
long invocationSeed,
|
||||
ConfiguredSettings settings) {
|
||||
Objects.requireNonNull(edit, "edit");
|
||||
try (edit) {
|
||||
var stages = new StageInvocation(graph, settings);
|
||||
var stages = new StageInvocation(graph, invocationSeed, settings);
|
||||
var access = PlacementViews.restrict(edit, edit.bounds());
|
||||
var placement = new PlacementInvocation(stages, request, inputs, access);
|
||||
runSegments(placement);
|
||||
|
||||
Reference in new issue
Block a user