예제 #1
0
        public static void Run(this ComputeShader shader, int numIterationsX, int numIterationsY = 1, int numIterationsZ = 1, int kernelIndex = 0)
        {
            var threadGroupSize = shader.GetThreadGroupSizes(kernelIndex);
            int numGroupsX      = Mathf.CeilToInt(numIterationsX / (float)threadGroupSize.x);
            int numGroupsY      = Mathf.CeilToInt(numIterationsY / (float)threadGroupSize.y);
            int numGroupsZ      = Mathf.CeilToInt(numIterationsZ / (float)threadGroupSize.y);

            shader.Dispatch(kernelIndex, numGroupsX, numGroupsY, numGroupsZ);
        }