Aetheria/Assets/Shaders/Compute/FlowParity.compute
Meta Vens 819bd79424 FlowFieldSceneVerify: the flow as ARPG.unity runs it; parity check on a ramp height and the noise clock
FlowFieldSceneVerify opens ARPG.unity before anything touches the project's types, drives VolumeSampling and Stardust
Start/Update with a zone attached, and asserts no exception or logged error, FLOW_GLOBAL and FLOW_SLOPE enabled,
_FlowAmplitude non-zero, the stardust buffer changing with the flow and freezing with a paused zone, the noise clock,
and CloudShader pass 0 carrying the FLOW_* keywords. FlowFieldParityVerify now binds a ramp height so FLOW_SLOPE and its
pragma matter, and checks the noise follows _NebulaNoiseTime. The mutation harness runs both checks, with six new mutants.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 23:25:45 +02:00

27 lines
1.2 KiB
Text

// Evaluates the shader flow functions for a buffer of positions and gradients, so that
// Aetheria.EditorTools.FlowFieldParityVerify can compare them with FlowField (ServerShared). Reads the same global
// _Flow* uniforms the nebula and stardust read, set by VolumeSampling.LowerFlow.
#pragma kernel Evaluate
// A compute shader declares the global keywords itself (as Stardust.compute does); the flow() it calls is keyword-gated.
#pragma multi_compile __ FLOW_GLOBAL
#pragma multi_compile __ FLOW_SLOPE
#include "Assets/Shaders/Volumetric.cginc"
StructuredBuffer<float3> positions;
StructuredBuffer<float2> gradients;
RWStructuredBuffer<float3> globalOut;
RWStructuredBuffer<float3> slopeOut;
RWStructuredBuffer<float3> gatedOut; // flow(): the keyword-gated function the nebula and stardust call
RWStructuredBuffer<float> noiseOut; // triNoise3d: the nebula noise the flow advects
uint count;
[numthreads(64, 1, 1)]
void Evaluate(uint3 id : SV_DispatchThreadID)
{
if (id.x >= count) return;
globalOut[id.x] = globalFlow(positions[id.x]);
slopeOut[id.x] = slopeFlow(gradients[id.x]);
gatedOut[id.x] = flow(positions[id.x]);
noiseOut[id.x] = triNoise3d(positions[id.x] / 512);
}