60 this.kernelHandleRandomSwap = this.computeShader.FindKernel(
"RandomSwap");
61 this.kernelHandleValidateCandidates = this.computeShader.FindKernel(
66 public override string name =>
"RS";
97 RandomSwapResultPool.
Release(
this);
110 randomSwapResult.varianceReduction = 0;
112 randomSwapResult.swapFailed =
false;
126 if (clusterCenters.
variance !=
null)
144 randomSwapResult.varianceReduction =
170 randomSwapResult.swapFailed =
true;
176 i + this.clusteringRTsAndBuffers.numClusters
192 return randomSwapResult;
200 this.kernelHandleValidateCandidates,
201 "cbuf_cluster_centers",
205 this.
computeShader.Dispatch(this.kernelHandleValidateCandidates, 1, 1, 1);
213 this.kernelHandleRandomSwap,
214 "cbuf_cluster_centers",
218 this.kernelHandleRandomSwap,
219 "cbuf_random_positions",
223 this.kernelHandleRandomSwap,
228 "random_cluster_center",
230 this.clusteringRTsAndBuffers.numClusters
233 this.
computeShader.Dispatch(this.kernelHandleRandomSwap, 1, 1, 1);
ClusteringRTsAndBuffers clusteringRTsAndBuffers
bool doRandomizeEmptyClusters
readonly ComputeShader computeShader
static Parameters Default()
Parameters(int numIterationsKm)
Call Dispose after using.
StopConditionOverride stopConditionOverride
RandomSwapResult(StopConditionOverride stopConditionOverride, float varianceReduction, bool swapFailed)
ADispatcherRS(ComputeShader computeShader, int numIterations, bool doRandomizeEmptyClusters, bool useFullResTexRef, Parameters parameters, ClusteringRTsAndBuffers clusteringRTsAndBuffers)
override DispatcherParameters abstractParameters
RandomSwapResult ValidateCandidatesReadback()
readonly int kernelHandleRandomSwap
void RandomSwap(ClusteringTextures clusteringTextures)
abstract override void RunClustering(ClusteringTextures clusteringTextures)
abstract override bool usesStopCondition
void ValidateCandidatesGPU()
readonly Parameters parameters
readonly int kernelHandleValidateCandidates
Call Dispose after using.
Call Allocate before using and Dispose after using.
ComputeBuffer cbufRandomPositions
ComputeBuffer cbufClusterCenters
void UpdateRandomPositions()
ClusterCenters GetClusterCenters()
Get a pooled instance of ClusterCenters with a copy of the data from ComputeBuffer....
void SetClusterCenters(Vector4[] clusterCentersBufferData)
Reads the cluster centers data from the array and loads it into the ComputeBuffer.
int PickRandomCluster(int numClusters)
Call Dispose after using.
readonly RenderTexture rtInput