How can I check if the function works correctly? What can I expect to see?
The system was constantly complaining about parameters not being ready. So I decided to push the allocation out of the loop and do it once.
FFireShaderPressureCS::FParameters* Params = GraphBuilder.AllocParameters<FFireShaderPressureCS::FParameters>();
for(int32 I=1; I < Config.NumPressureIterations; ++I)
{
Params->VelocityBounds = Velocity.Bounds;
Params->obstaclesIn = GraphBuilder.CreateSRV(ObstaclesTexture);
Params->divergenceIn = GraphBuilder.CreateSRV(Divergence);
Params->pressureIn = GraphBuilder.CreateSRV(Pressure[SourceIndex]);
Params->outputFloat = GraphBuilder.CreateUAV(Pressure[DestIndex]);
GraphBuilder.AddPass(
RDG_EVENT_NAME("Pressure"),
Params,
ERDGPassFlags::AsyncCompute,
[&Params, Shader, GroupCount,I](FRHIComputeCommandList& RHICmdList)
{
UE_LOG(LogTemp, Warning, TEXT("pressureIn: %d"), Params->pressureIn);
FComputeShaderUtils::Dispatch(RHICmdList, Shader, *Params, GroupCount);
});
Swap(SourceIndex, DestIndex);
}
}
}
}
I’m getting the following readings
Are they within the range of expected parameters for pressure?